开发者

Mathematica - DSolve spits out #1 in output

开发者 https://www.devze.com 2023-03-11 08:41 出处:网络
I\'m not quite certain how to go about interpreting this. I\'m solving a fairly large system of differential equations, DSolve sometimes spits out a list of replacement rules that include terms that

I'm not quite certain how to go about interpreting this.

I'm solving a fairly large system of differential equations, DSolve sometimes spits out a list of replacement rules that include terms that have a #1 . I know that #1 is a placeholder for an argument, but I just have no clue where it comes from.

If I have a system of equations similar to

eqs = {
x1'[t] = a1*x1[t] + b1*y1[t]
x开发者_JS百科2'[t] = a2*x2[t] + b2*y2[t]
...
y1'[t] = c1*y1[t] + d1*x1[t]
y2'[t] = c2*y2[t] + d2*x2[t]}

DSolve[eqs,vars,t] spits out something like

x1 -> e^(-ta1)
x2 -> e^(-t)RootSum[a1a2+a3b4#1 + a3a1b2#1]
...

Obviously a little more complicated but you get the point.

Nothing in the documentation hints as to why this is occurring, And it only happens under certain permuations of parameters (e.g. when I play around with parameters in the original system it either works or doesn't)


This RootSum may be generated by Integrate, which is used by DSolve internally, like so:

In[511]:= Integrate[1/(1 + x + x^2 + x^3 + x^4), x]

Out[511]= RootSum[1 + #1 + #1^2 + #1^3 + #1^4 &, 
 Log[x - #1]/(1 + 2 #1 + 3 #1^2 + 4 #1^3) &]

It represents a symbolic expression that is the Sum[ Log[x-t]/(1+2*t+3 t^2+4 t^3), {t, {"roots of 1+t+t^2+t^3+t^4"}] (caution, invalid syntax intentional). You can recover the expected normal form using Normal:

In[512]:= Normal[%]

Out[512]= 
Log[(-1)^(1/5) + x]/(1 - 2 (-1)^(1/5) + 3 (-1)^(2/5) - 4 (-1)^(3/5)) +
  Log[-(-1)^(2/5) + x]/(
 1 - 4 (-1)^(1/5) + 2 (-1)^(2/5) + 3 (-1)^(4/5)) + 
 Log[(-1)^(3/5) + x]/(
 1 - 3 (-1)^(1/5) - 2 (-1)^(3/5) + 4 (-1)^(4/5)) + 
 Log[-(-1)^(4/5) + x]/(1 + 4 (-1)^(2/5) - 3 (-1)^(3/5) + 2 (-1)^(4/5))

Or using the Sum directly:

In[513]:= Sum[
 Log[x - t]/(1 + 2*t + 3 t^2 + 4 t^3), {t, 
  t /. {ToRules[Roots[1 + t + t^2 + t^3 + t^4 == 0, t]]}}]

Out[513]= 
Log[(-1)^(1/5) + x]/(1 - 2 (-1)^(1/5) + 3 (-1)^(2/5) - 4 (-1)^(3/5)) +
  Log[-(-1)^(2/5) + x]/(
 1 - 4 (-1)^(1/5) + 2 (-1)^(2/5) + 3 (-1)^(4/5)) + 
 Log[(-1)^(3/5) + x]/(
 1 - 3 (-1)^(1/5) - 2 (-1)^(3/5) + 4 (-1)^(4/5)) + 
 Log[-(-1)^(4/5) + x]/(1 + 4 (-1)^(2/5) - 3 (-1)^(3/5) + 2 (-1)^(4/5))

In[514]:= % - %% // FullSimplify

Out[514]= 0
0

精彩评论

暂无评论...
验证码 换一张
取 消