Erlang b formula continuous

1 visualización (últimos 30 días)
K_Kharis
K_Kharis el 5 de Ag. de 2016
Editada: per isakson el 5 de Ag. de 2016
Hello,
I'm trying to use a continuous form of Erlang B formula in my code as a function. I also need to differentiate this function so I need to use a symbolic variable in it. I'm using the function in: https://www.mathworks.com/matlabcentral/fileexchange/37279-erlang-b-continuation?product=EL
However, gammainc does not accept symbolic variables, i've tried to use igamma(nu,z)/gamma(nu) for the incomplete gamma upper, the problem with this one is that once I use subs command and then vpa, it always outputs NaN,
I also try another function -> gamma_symbolic (which requires maple as symengine, now i'm using matlab R2015b that cannot change between mupad and maple anymore) https://nl.mathworks.com/matlabcentral/answers/96854-how-can-i-use-incomplete-gamma-function-gammainc-in-matlab-7-5-r2007b-to-accept-symbolic-input
Please help. I spent really a lot of time trying to fix this issue. But I still haven't solved it yet!
PS. Why does the first alternative always outputs NaN? I don't understand. For example, I do:
syms S
tes = igamma(sym(S),0.5)/gamma(sym(S))
diftes = diff(tes,S)
subs(diftes, S,6)
which outputs:
tes =
igamma(S, 1/2)/gamma(S)
diftes =
((1/2)^S*(hypergeom([S, S], [S + 1, S + 1], -1/2)/S^2 - (1/(1/2)^S*pi*(log(2) + psi(1 - S) - pi*cot(pi*(S - 1))))/(gamma(1 - S)*sin(pi*(S - 1)))) + (1/2)^S*log(1/2)*expint(1 - S, 1/2))/gamma(S) - (psi(S)*igamma(S, 1/2))/gamma(S)
ans =
NaN
Please help. It seems like I can never solve this!
  5 comentarios
Torsten
Torsten el 5 de Ag. de 2016
Please exactly tell us whether you want to analyze
igamma(0.5,S)/gamma(0.5)
or
igamma(S,0.5)/gamma(S)
Best wishes
Torsten.
K_Kharis
K_Kharis el 5 de Ag. de 2016
Editada: K_Kharis el 5 de Ag. de 2016
Sorry, I had a typo.
I originally need:
1/(gammainc(A,S,'upper')*x);
with A = 0.5 (given parameter). So I change it using gammainc(z, nu, 'upper') = igamma(nu, z)/gamma(nu). with:
igamma(S, 0.5)/gamma(S)
And I need S as a symbolic variable because I want to differentiate this function.
The differentiation always seems to work, but once I use subs it outputs NaN

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by