DSolveConstants problem

• To: mathgroup at christensen.cybernetics.net
• Subject: [mg1141] DSolveConstants problem
• From: rich_klopp at qm.sri.com (Richard W. Klopp)
• Date: Wed, 17 May 1995 04:19:21 -0400
• Organization: SRI International

```I am (still) having problems with DSolve. As you will see at In[8]: below,
the kernel is brought to its knees when I try to define the integration
constants to be something other than the default C[i].  I am running
version 2.2.2 on a PowerMac 7100/66 and have allocated 5 Megs to the
kernel.
In[1]:=<<Calculus`DSolve`
Define a nonlinear ODE:
In[2]:= r[z] := a z^2 + g
In[3]:= leftside1 = (r[z]^2 + e) D[u[z],{z,2}] +
D[r[z]^2,z] D[u[z],z];
In[4]:= eq1 = (leftside1 == 0)
Out[4]=
2                       2 2
4 a z (g + a z ) u'[z] + (e + (g + a z ) ) u''[z] == 0
Solve the ODE and time how long it takes.
In[5]:= Timing[DSolve[eq1, u[z],z]]
Out[5]=
{26.35 Second, {{u[z] ->

1
C[2] + C[1] Integrate[-------------------------, z]}}
2          2    2  4
e + g  + 2 a g z  + a  z

}
Let's define the same ODE with a new dependent variable.
In[6]:= leftside2 = (r[z]^2 + e) D[v[z],{z,2}] +
D[r[z]^2,z] D[v[z],z];
In[7]:= eq2 = (leftside2 == 0)
Out[7]=
2                       2 2
4 a z (g + a z ) v'[z] + (e + (g + a z ) ) v''[z] == 0

Solve the new ODE and time how long it takes.
***Use a different, non-default integration constant this time.***

In[8]:= Timing[DSolve[eq2, v[z],z,{DSolveConstants->b}]]

******After 15 minutes, I give up!  What's wrong here?*******
Out[8]= \$Aborted

Let's do a simpler problem to make sure we've got the DSolveConstants
syntax right.
In[9]:= eq3 = ( D[w[z],{z,2}] == -2 T )
Out[9]= w''[z] == -2 T
In[10]:= DSolve[eq3,w[z],z,{DSolveConstants -> f}]
Out[10]=
2
{{w[z] -> -(T z ) + f[1] + z f[2]}}
Looks like the syntax is correct.  Let's time it, and the default version.
In[11]:= Timing[DSolve[eq3,w[z],z,{DSolveConstants -> f}]]
Out[11]=
2
{0.116667 Second, {{w[z] -> -(T z ) + f[1] + z f[2]}}}
In[12]:= Timing[DSolve[eq3,w[z],z]]
Out[12]=
2
{0.266667 Second, {{w[z] -> -(T z ) + C[1] + z C[2]}}}
So, what's the problem at In[8]:?  I want to define different constants
because I want to solve several similar ODEs and keep their integration
constants separate.