Here is a quirk discovered by a colleague:
asympt does not seem to honour the Order setting the first time it is called for a particular expression:
> restart: R:=sqrt(r^2-a^2); 2 2 R := sqrt(r - a )
Series expansion for large r converted to an algebraic expression. Note that Order is ignored.
I think this is well described as a ’quirk’; Maple seems to need to do one series expansion of the expression before it starts to honour the value of Order. If you skip/execute the a0 line below then the a1 line ignores/honours the Order option. If you cange the - in the a0 line to +, it works differently, so it seems to be something to do with remembering the series for that particular expression.
> a0:=asympt(1/sqrt(x^2-a^2),x); 2 4 6 a a a 1 a0 := 1/x + 1/2 ---- + 3/8 ---- + 5/16 ---- + O(----) 3 5 7 9 x x x x > a1:=asympt(1/R,r,4); 2 a 1 a1 := 1/r + 1/2 ---- + O(----) 3 5 r r > a2:=asympt(1/R,r,4); 2 a 1 a2 := 1/r + 1/2 ---- + O(----) 3 5 r r > a3:=asympt(1/R,r); 2 4 a a 1 a3 := 1/r + 1/2 ---- + 3/8 ---- + O(----) 3 5 7 r r r
Without executing the a0 line we get:
> restart: R:=sqrt(r^2-a^2); > a1:=asympt(1/R,r,4); 2 4 a a 1 a1 := 1/r + 1/2 ---- + 3/8 ---- + O(----) 3 5 7 r r r > a2:=asympt(1/R,r,4); 2 a 1 a2 := 1/r + 1/2 ---- + O(----) 3 5 r r > a3:=asympt(1/R,r); 2 4 6 a a a 1 a3 := 1/r + 1/2 ---- + 3/8 ---- + 5/16 ---- + O(----) 3 5 7 9 r r r r
This is not a great problem, but I am intrigued as to why it happens, and if there is a better anser than ’do it twice’
This is actually a bug in "series" (which "asympt" calls). I don’t have any advice other than to call it twice. The reason it works the second time, I think, is that "series" consults its remember table to see if it has computed the same series before to this or higher order; if it has done so, it truncates the series appropriately.