Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: How to pass Jacobian to IDA via NDSolve
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Cheol

Posts: 1
Registered: 7/11/13
How to pass Jacobian to IDA via NDSolve
Posted: Jul 11, 2013 1:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

According to the IDA manual, when solving DAEs, there is an option to supply J=df/dx+c=E2=88=97df/dx=E2=80=B2(where d is for partial derivatives) to the IDA module. How can I do the same via NDSolve? I tried the following just to see what happens:

vars = { alphan0, alphan1, alphan2, alphan3, alphan4, alphan5};

tvars = { alphan0[t], alphan1[t], alphan2[t], alphan3[t], alphan4[t], alphan5[t};

tvarsp = D[tvars, t];
Jdae1 = D[dae1[[All, 1]], {tvars}] - D[dae1[[All, 2]], {tvars}];
Jdae2 = D[dae1[[All, 1]], {tvarsp}] - D[dae1[[All, 2]], {tvarsp}];
jfun[t_, x_, xp_, c_] := Module[{j, jj},
j = (Jdae1 /. tvars -> x) + c (Jdae2 /. tvarsp -> xp);
Function[# jj] /. jj -> j];

sol3 = First@
NDSolve[{dae1, ic}, vars, {t, 0, 10},
WorkingPrecision -> 25, AccuracyGoal -> 5, PrecisionGoal -> 5,
Method -> {
IDA,
"ImplicitSolver" -> {
"Newton",
"LinearSolveMethod" -> {"Dense", "Jacobian" -> jfun}
}
}
]

Mathematica did not generate any error messages, however I am certain I am not doing it correctly since no difference in output can be observed. Many thanks!




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.