Re: DSolve Issues

*To*: mathgroup at smc.vnet.net*Subject*: [mg88357] Re: [mg88335] DSolve Issues*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sat, 3 May 2008 06:13:58 -0400 (EDT)*Reply-to*: hanlonr at cox.net

Use exact numbers Clear[Phi]; eqn1 = Phi''[r] + 2*r^(-1) Phi'[r] + 104479/1000000*Phi[r] == 0; soln1 = DSolve[{eqn1, Phi[0] == K}, Phi[r], r][[1]] // FullSimplify {Phi[r] -> (1000*K*Sin[(Sqrt[104479]*r)/ 1000])/(Sqrt[104479]*r)} eqn1 /. NestList[D[#, r] &, soln1[[1]], 2] // Simplify True Limit[soln1[[1, 2]], r -> 0] K bc1 = soln1[[1, 2]] /. r -> 3 R; bc2 = D[soln1[[1, 2]], r] /. r -> 3 R // Simplify; eqn2 = Phi''[r] + 2*Phi'[r]/r - 2831/100*Phi[r] == 0; soln2 = DSolve[{eqn2, Phi[3 R] == bc1, Phi'[3 R] == bc2}, Phi[r], r][[1]] // ExpToTrig // FullSimplify {Phi[r] -> (1000*K*Cosh[(1/10)*Sqrt[2831]* (r - 3*R)]* Sin[(3*Sqrt[104479]*R)/1000])/ (Sqrt[104479]*r) + (10*K*Cos[(3*Sqrt[104479]*R)/1000]* Sinh[(1/10)*Sqrt[2831]* (r - 3*R)])/(Sqrt[2831]*r)} eqn2 /. NestList[D[#, r] &, soln2[[1]], 2] // Simplify True (soln2[[1, 2]] /. r -> 3 R) == bc1 True (D[soln2[[1, 2]], r] /. r -> 3 R) == bc2 // Simplify True solnR = Simplify[Reduce[bc1 == 0, R], {K != 0, R > 0, C[1] == 1}][[1]] // ToRules {R -> (2000*Pi)/(3*Sqrt[104479])} soln2[[1, 2]] /. solnR (10*K*Sinh[(1/10)*Sqrt[2831]* (r - (2000*Pi)/Sqrt[104479])])/ (Sqrt[2831]*r) Bob Hanlon ---- donkorgi12 <ringtailinblacklw02 at gmail.com> wrote: > I am solving the following Differential Equation > > Phi''[r]+2*r^(-1)Phi'[r]+0.104479*Phi[r]==0 and Phi[0]==K (some > constant) ; kinda has a cos/sin solution > > 2.71828^(-0.323232 \[ImaginaryI] r) ((0.+ > 0. \[ImaginaryI]) + (0.+ 0. \[ImaginaryI]) 2.71828^( > 0.646465 \[ImaginaryI] r) + (0.+ 1.54687 \[ImaginaryI]) K - (0.+ > 1.54687 \[ImaginaryI]) 2.71828^(0.646465 \[ImaginaryI] r) K) > > all divided by r. > > My problem is that Mathematica is not treating those "zeros".... as > well zeros. Thus, the solution cannot really be used. In fact, if I > manually reproduce the solution and remove those "zeros", then the > solution is fine. > > I have another similar ODE Anyone have any ideas. > > Phi''[r]+2*r^(-1)Phi'[r]- 287.31*Phi[r]==0 and Phi[3R]==0(some > constant) ; kinda has a cosh/sinh solution > > As you might have notice I need to match these two solutions and their > derivatives at some point. The ratio of which gives me what I desire > the value of R. > > Yet, Mathematica treats those "zeros" as something else. > > >