Message Boards Message Boards


Speed up this series expansion?

Posted 2 months ago
4 Replies
1 Total Likes

Hi, I wonder why the following commands:

Fun1[s_] := (1 - BesselK[0, Sqrt[s + gam]]/BesselK[1, Sqrt[s + gam]])/(s*Sqrt[s + gam]);
ser1 = Series[Fun1[s], {s, ?, 60}]; 

are still not completed after a day of calculations on a supercomputer? Is there any way to speed up the computations? Leslaw

4 Replies

Only comment. Comparison with Maple 2019.2.1, takes only 251.297 second.

enter image description here Regards M.I.

My first guess has to be with "s+g" that Mathematica doesn't know if it is two independent variables or a variable and a constant (noting you have separate J(x) - will s or g be constant or in which?). If J is designed for only one variable and tries to "solve" (rather than use table) with two - it could easily just end up in an infinite loop somewhere trying to perform it and waiting for a result it will not get.

Is there a proof the series, using J0(s,g) as you suggest terminates? The book and page citing it?

Fun1[s_] := (1 - BesselK[0, Sqrt[x]]/BesselK[1, Sqrt[x]])/(s*Sqrt[x]);
In[19]:= Series[Fun1[s], {s, \[Infinity], 60}] // Timing

Out[19]= {0.001181, SeriesData[d`s, 
DirectedInfinity[1], {
  d`v^Rational[-1, 2] (1 - BesselK[0, d`v^Rational[1, 2]]/BesselK[
    1, d`v^Rational[1, 2]])}, 1, 61, 1]}

(Is there some reason you cannot, here, say %/.x->(g+s)) ?)

I could ask questions like whether (s*Sqrt[g+s]) ends up being a solution to another besselK but have no time - but I understand such inputs to J are common after converting an ODE to a bessel form ODE by substitution.

I wonder at times why Mathematica doesn't seem to use a larger "table of equations" solutions to produce what (doesn't need to be solved because it's in a table). on the other hand i know some sol'n by mm are by table - but the tables seem to be "brief" when working in certain areas (where try to constrain variables doesn't seem to find more applicable sol'n).

Posted 2 months ago

If I choose the maximum order 5 instead of 60 in the series, it works more quickly and produces an answer, but the formulae are very complicated so that probably this is why the calculations become very slow for the 60 case. However, we had a discussion several months ago which showed that the Series commands has bugs and produces wrong answers to this or similar problems. I noticed that chosing a large maximum order at least makes the initial terms reproducible upon order variations. I need 20 correct terms, and for this requiring 60 seems necessary. I will try to replace g+s by a single variable. By the way, can you send me the Maple results? Leslaw

Maple result converted to Mathematica code with only 20 terms. Converting is extremely CPU and RAM intensive.

See attached file.

I send you tomorrow series with 30 terms.

Regards M.I.

EDITED: 2020-01-16

I added file: Series only 30 terms.nb .You must change file extension to *.zip and extract file.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract