Re: Solving a DE using Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg90481] Re: Solving a DE using Mathematica
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Thu, 10 Jul 2008 06:38:08 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <g51uce\$6tj\$1@smc.vnet.net>

```Greg wrote:

> I'm having problems solving this problem although it should appear pretty straightfoward:
>
> (-l^2 - m^2 + n^2/(r + 0.016 z)^2) Z[z] + Z''[z] == 0
>
> I am solving for Z[z].  These are the lines I use:
>
> DSolve[Above Equation, Z[z], z]
>
> I get an odd solution so I do a solution check plugging back in Z[z] and Z''[z] yet I don't get 0.  In the above, l,m,n,r are all constants.

Since we are looking for an analytic solution, we use using exact
coefficients rather than machine-size numbers.

Also, we ask for a pure function, which is easier to manipulate and plug
back into the original DE.

Finally, we check the result with *FullSimplify* since the solution
involve special functions.

de = (-l^2 - m^2 + n^2/(r + 0.016 z)^2) Z[z] + Z''[z] == 0

de = Rationalize[de]

sol = DSolve[de, Z, z]

de /. sol[[1]]

FullSimplify[%]

Regards,
-- Jean-Marc

In[1]:= de = (-l^2 - m^2 + n^2/(r + 0.016 z)^2) Z[z] + Z''[z] == 0

Out[1]=
2
2    2         n
(-l  - m  + --------------) Z[z] + Z''[z] == 0
2
(r + 0.016 z)

In[2]:= de = Rationalize[de]

Out[2]=
2
2    2       n
(-l  - m  + ----------) Z[z] + Z''[z] == 0
2 z 2
(r + ---)
125

In[3]:= sol = DSolve[de, Z, z]

Out[3]=
1                     2
{{Z -> Function[{z}, C[1] WhittakerM[0, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] +

1                     2
C[2] WhittakerW[0, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z]]}}

In[4]:= de /. sol[[1]]

Out[4]=
2    2            1   1                    2
4 (l  + m ) C[1] (-(((- - - I Sqrt[-1 + 15625 n ])
2   2

1                     2
WhittakerM[1, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z]) /

2    2              2    2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z) ) +

1  1                 1                     2
- (- WhittakerM[0, -(-) I Sqrt[-1 + 15625 n ],
2  2                 2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] +

1   1                    2
((- - - I Sqrt[-1 + 15625 n ])
2   2

1                     2
WhittakerM[1, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z]) /

2    2              2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z)) +

1   1                    2
((- - - I Sqrt[-1 + 15625 n ])
2   2

1                      1
((- - ---------------------------------------)
2             2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z

1                     2
WhittakerM[1, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] +

3   1                    2
((- - - I Sqrt[-1 + 15625 n ])
2   2

1                     2
WhittakerM[2, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z]) /

2    2              2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z))) /

2    2              2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z)) +

2
2    2       n
(-l  - m  + ----------) (C[1]
2 z 2
(r + ---)
125

1                     2
WhittakerM[0, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] +

1                     2
C[2] WhittakerW[0, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z]) +

2    2                        1                     2
4 (l  + m ) C[2] (WhittakerW[1, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] /

2    2              2    2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z)  +

1  1                 1                     2
- (- WhittakerW[0, -(-) I Sqrt[-1 + 15625 n ],
2  2                 2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] -

1                     2
WhittakerW[1, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] /

2    2              2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z)) -

1                      1
((- - ---------------------------------------)
2             2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z

1                     2
WhittakerW[1, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] -

1                     2
WhittakerW[2, -(-) I Sqrt[-1 + 15625 n ],
2

2    2              2    2
125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z] /

2    2              2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z)) /

2    2              2    2
(125 Sqrt[l  + m ] r + 2 Sqrt[l  + m ] z)) == 0

In[5]:= FullSimplify[%]

Out[5]= True

```

• Prev by Date: Re: How to do that with version 6?
• Next by Date: Re: How to use package without manually evaluating?
• Previous by thread: Re: Solving a DE using Mathematica
• Next by thread: Re: Solving a DE using Mathematica