grzegorzmazur / yacas

Computer calculations made easy
http://www.yacas.org
GNU Lesser General Public License v2.1
124 stars 24 forks source link

Limit #282

Open mikldk opened 4 years ago

mikldk commented 4 years ago

I tried this limit

In> Limit(k, Infinity) (s11+s12*k)/Sqrt((w^2+s11)*(w^2+s11+k^2*s22+2*k*s12))
Out> (s11+s12*Infinity)/Sqrt((w^2+s11)*(w^2+s11+Infinity*s22+2*Infinity*s12))

I was expecting

s12/Sqrt(s22*(s11 + w^2))

See https://www.wolframalpha.com/input/?i=lim+%28s11%2Bs12*k%29%2FSqrt%28%28w%5E2%2Bs11%29*%28w%5E2%2Bs11%2Bk%5E2*s22%2B2*k*s12%29%29+k+-%3E+Inf.

mikldk commented 4 years ago

A smaller example is this:

In> Limit(k, Infinity) (a+b*k)/k
CommandLine(1) : Max evaluation stack depth reached.
Please use MaxEvalDepth to increase the stack size as needed.
CommandLine(1) : Max evaluation stack depth reached.
Please use MaxEvalDepth to increase the stack size as needed.
mikldk commented 4 years ago

Related may be that I cannot get yacas to divide into brackets:

In> Simplify((a+b*k)/k)
Out> (a+b*k)/k

In> FactorialSimplify((a+b*k)/k)
Out> (a+b*k)/k

In> ExpandFrac((a+b*k)/k)
Out> (a+b*k)/k

In> ExpandBrackets((a+b*k)/k)
Out> (a+b*k)/k

What I hoped for something like

In> FactorialSimplify((a+b*k)/k)
Out> a/k + b
grzegorzmazur commented 4 years ago

Hi,

Ok, so the thing is that in the case of pure rational functions, limit in oo depends on the (polynomial) division of numerator by denominator. And exactly this approach is taken, but the division cannot be performed when coefficients are not numerical. Hence, the division returns unevaluated and we attempt to find limit of Div(numerator, denominator), which gets into some weird recursion.

I have to think a bit more what the approach should be in case of general coefficients.

But it's a good catch, thanks!

Grzesiek