Re: NDSolve with Dirichlet boundary condition
- To: mathgroup at smc.vnet.net
- Subject: [mg107313] Re: [mg107228] NDSolve with Dirichlet boundary condition
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 9 Feb 2010 02:43:30 -0500 (EST)
- References: <201002060823.DAA14151@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
> Therefore my question is whether it is possible to solve my simplified > example using NDSolve or any other non analytic method of Mathematica. I solved this with DSolve in my post, but NDSolve also works: NDSolve[{y''[r] == 0, y[0] == 50, y[1] == 1/2}, y, {r, 0, 1}] {{y->InterpolatingFunction[{{0.,1.}},<>]}} If your simplified example is like the real problem, there should be a way to transform, as I did, and solve. Bobby On Mon, 08 Feb 2010 03:46:38 -0600, Frank Breitling <fbreitling at aip.de> wrote: > Dear Bobby, > > Thank you very much for your answer. > Unfortunately my original problem doesn't allow for an analytic > solution, since the equation is more complex and involves interpolating > functions. > Therefore my question is whether it is possible to solve my simplified > example using NDSolve or any other non analytic method of Mathematica. > > Frank > > > On 2010-02-06 22:42, DrMajorBob wrote: >> Define y as follows and compute its derivative: >> >> Clear[x,y,r] >> y[r_]=x[r]^2/2; >> y'[r] >> >> x[r] (x^\[Prime])[r] >> >> Hence your equations are equivalent to >> >> {y''[r]==0, y[0] == 50, y[1] == 1/2} >> >> The first equation says that y is linear. Specifically, >> >> y[r_] = InterpolatingPolynomial[{{0, 50}, {1, 1/2}}, r] >> >> 50 - (99 r)/2 >> >> and hence, >> >> x[r_] = Sqrt[2 y[r]] >> >> Sqrt[2] Sqrt[50 - (99 r)/2] >> >> Solving the same thing in Mathematica, we get: >> >> Clear[y] >> DSolve[{y''[r]==0,y[0]==50,y[1]==1/2},y,r] >> {{y->Function[{r},1/2 (100-99 r)]}} >> >> Or, for the original problem: >> >> Clear[x, r] >> DSolve[{D[x[r] x'[r], r] == 0, x[0] == 10, x[1] == 1}, x, r] >> >> {{x -> Function[{r}, -I Sqrt[-100 + 99 r]]}} >> >> That's the same as the earlier (real-valued) solution, even though it >> appears to be Complex. >> >> Simplify[-I Sqrt[-100 + 99 r] - Sqrt[2] Sqrt[50 - (99 r)/2], >> r < 100/99] >> >> 0 >> >> Bobby >> >> On Sat, 06 Feb 2010 02:23:21 -0600, Frank Breitling <fbreitling at aip.de> >> wrote: >> >>> Hello, >>> >>> I was not able to solve the following differential equation with >>> Mathematica 7.01.0 using: >>> >>> NDSolve[{D[x[r]x'[r],r]==0, x[0]==10, x[1]==1}, x, {r,0,1}] >>> >>> Since my original problem is inhomogeneous and involves interpolating >>> functions DSolve is not an option. >>> >>> Is there a way to solve this problem using Mathematica? >>> Any help is highly appreciated. >>> >>> Best regards >>> >>> Frank >>> >> >> > -- DrMajorBob at yahoo.com
- References:
- NDSolve with Dirichlet boundary condition
- From: Frank Breitling <fbreitling@aip.de>
- NDSolve with Dirichlet boundary condition