I am trying to calculate the logarithm of a modified Bessel function of second type in MATLAB, i.e. something like that:
log(besselk(nu, Z))
where e.g.
nu = 750;
Z = 1;
I have a problem because the value of log(besselk(nu, Z))
goes to infinity, because besselk(nu, Z)
is infinity. However, log(besselk(nu, Z))
should be small indeed.
I am trying to write something like
f = double(sym('ln(besselk(double(nu), double(Z)))'));
However, I get the following error:
Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead.
Error in sym/double (line 514) Xstr = mupadmex('symobj::double', S.s, 0)`;
How can I avoid this error?
1.7977e+308
, do you need to play with numerical values that big? – ZellersInf
. Technically overflowing would be that the number starts from negative again, but that only happens with integers, not floating points. – Zellers1.7977e+308
. ill ask again: do you need to play with numerical values that big? Why would you? – Zellersbessel
is bigger than1.8e+308
, then its ln would be bigger than700
. That is not small; you have a mistake somewhere. Are you mixingnu
andZ
? – Occidentlog(besselk(nu, Z))
should be small. However, I have no idea how to solve your problem.... Isn't there a way you can know the order ofbesselk(nu, Z)
without computing it? – Zellers800
,1000
or even5000
but small compare toinf
. – Plumpnu
. In my case I have very bignu
. – Plumpf = double(sym('ln(besselk(double(nu), double(Z)))'));
. But I get the following error:Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead. Error in sym/double (line 514) Xstr = mupadmex('symobj::double', S.s, 0);
Is there any way to avoid this error? – Plump