0
$\begingroup$

I have solved a system of $N$ ($N$ is the order of system) ODE with DSolve and found $N$ solutions in the form

f[t]={-7.46396*10^-17 + 6.07946*10^-17 E^(-1.80414*10^9 t) -   3.46759*10^-20 
 E^(-5.89008*10^8 t) +   8.06773*10^-20 E^(-2.59966*10^8 t) -   1.44354*10^-19 
 E^(-1.31932*10^8 t) +   3.26139*10^-17 E^(-6.80231*10^7 t) -   1.67078*10^-18 
 E^(-3.13777*10^7 t) +   1.77792*10^-18 E^(-1.91106*10^7 t) +   4.55638*10^-18 
 E^(-1.80114*10^7 t) +   4.3548*10^-19 E^(-1.61636*10^7 t) +   1.90158*10^-18 
 E^(-1.33903*10^7 t) -   7.98234*10^-19 E^(-9.09799*10^6 t) -   1.21329*10^-18 
 E^(-7.28863*10^6 t) +   1.05423*10^-18 E^(-5.44168*10^6 t) - 2.47138*10^-17 
 E^(-279052. t)}

(this is only the first one) and also other $N-1$ solutions. This solution evidently has the following representation $f(t)=\sum_{i}c_{i}e^{\lambda_{i}t}$, where $\lambda_{i}$ are the eigenvalues and $c_{i}$ are the coefficients of eigenvector. The question is: how to obtain vector $\bf c$ and table of $\lambda_{i}$ separatly ? I have only the solution given above.

$\endgroup$
3
$\begingroup$

One-line solution:

{c, eig} = (Level[f[t], 1] /. {a__*Exp[b__*t] :> {a, b}, 
     x_ /; NumericQ[x] -> {x, 0}})\[Transpose]

test:

f[t] = -7.46396*10^-17 + 6.07946*10^-17 E^(-1.80414*10^9 t) - 
  3.46759*10^-20 E^(-5.89008*10^8 t) + 
  8.06773*10^-20 E^(-2.59966*10^8 t) - 
  1.44354*10^-19 E^(-1.31932*10^8 t) + 
  3.26139*10^-17 E^(-6.80231*10^7 t) - 
  1.67078*10^-18 E^(-3.13777*10^7 t) + 
  1.77792*10^-18 E^(-1.91106*10^7 t) + 
  4.55638*10^-18 E^(-1.80114*10^7 t) + 
  4.3548*10^-19 E^(-1.61636*10^7 t) + 
  1.90158*10^-18 E^(-1.33903*10^7 t) - 
  7.98234*10^-19 E^(-9.09799*10^6 t) - 
  1.21329*10^-18 E^(-7.28863*10^6 t) + 
  1.05423*10^-18 E^(-5.44168*10^6 t) - 2.47138*10^-17 E^(-279052. t)


Grid[{c, eig}\[Transpose], Frame -> All]

enter image description here

$\endgroup$
2
$\begingroup$

To get the eigenvalues, I use Carl Woll's getPatterns

pat=getPatterns[f[t], Exp[n__ t]]
eig=Cases[pat,Exp[n_ t]:>n]

Mathematica graphics

To get the c's

 pat=getPatterns[f[t], m__ Exp[n__ t]]
 c=Cases[pat,m__ Exp[n_ t]:>m]

Mathematica graphics

 Grid[Transpose[{c,eig}],Frame->All]

Mathematica graphics

This function thanks to Carl Woll, see this

getPatterns[expr_, pat_] := 
  Last@Reap[expr /. a : pat :> Sow[a], _, Sequence @@ #2 &];
$\endgroup$
  • $\begingroup$ note that the 1st term is a constant and may be seen as c * exp[0 t] which is not matched by this pattern $\endgroup$ – egwene sedai Mar 12 '18 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.