So I have some variables $\,x_{1},\, x_{2},\, \nu\, =\, 12.654,\, 13.487,\, 0\,$ and the following function:
$\dfrac{(x_{1}\cdot(-BesselK(\nu,x_{1}\cdot125))\cdot BesselI(\nu,x_{2}\cdot125))-(x_{2}\cdot BesselK(\nu+1,x_{1}\cdot 125)\cdot BesselI(\nu+1,x_{2}\cdot 125))}{\dfrac{-1}{125\cdot x_{1}}}$
What's my problem? Well even though the final output is a reasonable number, the output of the Bessel functions are either super-huge or super-small and the calculation requires quad-precision (which is very sluggish). I need to scale down the value going into the Bessel function but I need to be able to get the end result to be the same as if I used quad-precision.
Thank you.
So it turns out I can use the exponentially scaled modified bessel functions, namely:
$BesselI_{exp}(\nu,x) = \exp(-x)BesselI(\nu,x)\\BesselK_{exp}(\nu,x) = \exp(x)BesselK(\nu,x)$
and so,
$BesselI(\nu,x) = \exp(\log(BesselI_{exp}(\nu,x))+x)\\BesselK(\nu,x) = \exp(\log(BesselK_{exp}(\nu,x))-x)$
These scaled variants must be somehow magically coded into Pythons scipy package to avoid using huge numbers. Very impressive and quite fortunate.
This allows me to modify my equations to use the scaled functions which returns normal sized numbers and then modify the end result to account for the scale.