       How to pass Jacobian to IDA via NDSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg131467] How to pass Jacobian to IDA via NDSolve
• From: Cheol <cheol_w_lee at hotmail.com>
• Date: Thu, 11 Jul 2013 02:03:08 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net

```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!

```

• Prev by Date: Re: inconsistent refinement behavior
• Next by Date: maze generation
• Previous by thread: Re: Arrow on arc using Circle
• Next by thread: maze generation