In my problem I have a third order algebraic equation for the variable sigma
, all other letters are parameters. Here is it's right-hand side, left hand side is zero (you can copy it into your programm):
eq = Er k^2 γ ξ (1 + λ Cos[2 ϕ]) (3 I k Cos[ϕ] + 4 σ Cos[2 ϕ] +
I k Cos[3 ϕ]) Subscript[α, ac] + (ξ + σ) (σ + I k Cos[ϕ]) (8 k^4 +
16 k^2 tf1 + 2 k^4 γ + k^4 γ λ^2 + 8 Er k^2 γ σ + 16 Er tf1 γ σ +
4 k^4 γ λ Cos[2 ϕ] + k^4 γ λ^2 Cos[4 ϕ] +
4 k^2 (k^2 + Er γ σ) Sin[2 ϕ]^2 Subscript[μ, 1] +
4 (k^2 + Er γ σ) (k^2 + tf1 - tf1 Cos[2 ϕ]) Subscript[μ, 2])
My purpose here is to get Taylor expansion in parameter k
for all the roots near k=0
:
sol = Solve[eq == 0, σ]
sol = σ /. sol
Series[sol[[1]], {k, 0, 2}
The thing is, that evalution of the line sol = Solve[eq == 0, σ]
takes really long time. It takes couple minutes here, but when I am trying to solve similar equation of the 4th order, it takes forever. Note, that in the line sol = Solve[eq == 0, σ]
, I didn't ask to simplify. But looks like mathematica silently simplifies it, since it is running for a long time. Note, that for the third and forth order equations exact algebraic expressions for the solutions are availible, and indeed, if I type something like Solve[a*x^3+b*x^2+c*x+d==0,x]
, it gives me the answer instantly. It should be really fast procedure to substitute corresponding expressions into the final formula.
Is there a way to get Taylor expansion I need faster? Solving the equations takes much longer time, than Taylor series.
In case someone needs, this is the 4th order equation, which I cannot solve even in 30 minutes:
-Er k^2 γ ξ (1 + λ Cos[2 ϕ]) (4 (k^2 + 2 σ (σ + τ1)) Cos[2 ϕ] + k^2 (3 + Cos[4 ϕ]))
Subscript[α, ac] - (ξ + σ) (k^2 + 2 σ (σ + τ1) + k^2 Cos[2 ϕ]) (8 k^4 + 16 k^2 tf1 +
2 k^4 γ + k^4 γ λ^2 + 8 Er k^2 γ σ + 16 Er tf1 γ σ + 4 k^4 γ λ Cos[2 ϕ] +
k^4 γ λ^2 Cos[4 ϕ] + 4 k^2 (k^2 + Er γ σ) Sin[2 ϕ]^2 Subscript[μ, 1] +
4 (k^2 + Er γ σ) (k^2 + tf1 - tf1 Cos[2 ϕ]) Subscript[μ, 2])
Evaluation of sol = Solve[eq == 0,σ]
takes forever.
I found out, that Defer
can be used to supress evalution, but I need a different thing.
Thanks, MIkhail
sol = Solve[eq == 0, σ]
takes just seconds, although the result is rather large. By the way, avoid usingSubscript
. $\endgroup$sol = Solve[eq == 0, σ]
took 2 minutes on my computer. The method I presented below takes around 3 seconds. $\endgroup$