How to avoid repeated calculation in NDSolve ?

• To: mathgroup at smc.vnet.net
• Subject: [mg116974] How to avoid repeated calculation in NDSolve ?
• From: "t. shim" <tokuzoshimada3 at gmail.com>
• Date: Sun, 6 Mar 2011 05:42:55 -0500 (EST)

```Hi,

As the samplke list below,  the rhs of equations in NDSolve may have
many repeated appearance of  the same expression such as (\[Mu][t]^2 +
\[Nu][t]^2) in the denominator.
In Fortran, we first write r = (\[Mu][t]^2 + \[Nu][t]^2) and in what
follows use r insted of (\[Mu][t]^2 + \[Nu][t]^2).
Tell me if such can be applied also in mathematica.

Regards, t. shim

NDSolve[
{p\[Mu]'[t] ==
1/2 (2 \[Mu][
t] (1/2 (
p\[Mu][t]^2 + p\[Nu][t]^2-4)/(\[Mu][t]^2 + \[Nu][t]^2) -
(1 - \[Gamma])/2 (\[Mu][t] p\[Mu][t] - \[Nu][t] p\[Nu][t])^2/ (\[Mu]
[t]^2 + \[Nu][t]^2)^2) +
(1 - \[Gamma]) 1/(\[Mu][t]^2 + \[Nu][t]^2)^2 \[Nu][t] (\[Mu][t] p\[Mu]
[t] -
\[Nu][t] p\[Nu][t]) (\[Nu][t] p\[Mu][t] + \[Mu][t] p\[Nu][t])),
p\[Mu]'[t] == (mu, nu interchanged)
...

```

• Prev by Date: Re: Plotting singularities
• Next by Date: Re: Set diagonal of square matrix
• Previous by thread: TreeMap Visualization in Mathematica
• Next by thread: Re: How to avoid repeated calculation in NDSolve ?