MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Boundary Conditions for NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41399] Re: Boundary Conditions for NDSolve
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Sun, 18 May 2003 05:01:10 -0400 (EDT)
  • Organization: University of Washington
  • References: <ba50ti$sek$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Lindsey,

Just add ?NumericQ to the definition of F, as in

F[t_?NumericQ]:=phi /. FindRoot[phi-0.1*Sin[phi]==t,{phi,0}]

Now when you use NDSolve, it will complain that Boundary and initial
conditions are inconsistent, but it will still give you a solution.

Carl Woll
Physics Dept
U of Washington

"Lindsey Malcom" <planetlem01 at netscape.net> wrote in message
news:ba50ti$sek$1 at smc.vnet.net...
>
> Dear MathGroup,
>
> I am trying to use mathematica to numerically solve the diffusion
> equation for a body orbiting the sun. In order to do this, I must solve
> for the heliocentric distance as a function of time t, and use this as a
> part of my boundary condition.
>
> First, I use FindRoot to solve for the eccentric anomaly (I am leaving
> out the constants and just setting eccentricity to 0.1 and semimajor
> axis = 1)
>
> F[t_]:=phi /. FindRoot[phi-0.1*Sin[phi]==t,{phi,0}]
>
> Next, I use this result to solve for the heliocentric distance:
>
> rh[t_]:=1-0.1*Cos[F[t]]
>
>
> These two functions work fine, and produce numeric results when i
> evaluate them at a specifc time. However the problems start when I try
> to use the function rh[t] in my boundary condition.
>
> To solve for the temperature at any depth and time, call this function
> u, I do
>
>
> sol= NDSolve[{D[u[x,t],t] == D[u[x,t],x,x], u[x,0]==30,
>     Derivative[1,0][u][1,t]==0,
>     Derivative[1,0][u][0,t]== (1/rh[t])^2-u[0,t]^4},u,{x,0,1},{t,0,5}]
>
>
>
>
> When i try to find the numerical solution, i get all sorts of error
> messages like
>
> FindRoot::frnum:
> Function{0.403324-1.t} is not a length 1 list of numbers at
{phi}={0.446506}
>
> and also something about FindRoot[phi-0.1*Sin[phi]==t, {phi, Random[]}]
> is neither a list of replacement rules nor a valid dispatch table, and
> so cannot be used for replacing.
>
>
> Can anyone offer any suggestions? I am desperate for help.
>
>
> Thanks.
>
> Sincerely,
>
> Lindsey Malcom
>
>
>
>
>
>
>




  • Prev by Date: Re: Re: Euler's Gamma and Beta Functions
  • Next by Date: Re: Boundary Conditions for NDSolve
  • Previous by thread: Boundary Conditions for NDSolve
  • Next by thread: Re: Boundary Conditions for NDSolve