MathGroup Archive 2004

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

Search the Archive

Re: PDE Notation options (one works the other does not)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51415] Re: [mg51336] PDE Notation options (one works the other does not)
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sat, 16 Oct 2004 04:21:02 -0400 (EDT)
  • References: <3818F76C9AECB645B31DEC4790BEDA0768E6CB@NOR-S-010.americas.shell.com>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

The second call to NDSolve fails because:

D[C[20, t], x] == 0

True

That's accurate, since C[20,t] isn't a function of x. You mean, I suppose, to differentiate with respect to C's first (unnamed) variable, evaluated when that (unnamed) variable is equal to 20. But that's what Derivative does in the other call to NDSolve.

Derivative[1, 0][C][20, t] == 0

Derivative[1, 0][C][20, t] == 0

By the way, it's a very bad idea to use C as a variable like this. Look up C in Help, and you'll see that it's often used to represent arbitrary constants of integration, arbitrary functions, et cetera. Even if you don't see it happening explicitly, it can happen in the background, when NDSolve calls some other function.

To avoid conflicts with built-in symbols, you should NEVER start your own variables with capitals.

Bobby

On Fri, 15 Oct 2004 14:36:42 -0500, Prince-Wright, Robert G SEPCO <robert.prince-wright at shell.com> wrote:

> Bob
>
> Sorry for the gobbledygook posted earlier. I've installed your Palette which makes all the difference, in particular it shows the difference in the way Mathematica is parsing the information using Derivative[] in the first example and D[] in the second! Aren't they the same?
>
> The first  call to NDSolve works whereas the second does not.
>
> In[16]:=
> \[Lambda] = 0.1;
> V = 2.;
> \[Beta] = 0.3;
> C0 = 5;
> L = 20;
>
> solution = C /. First[NDSolve[
>      {D[C[x, t], t] == (-\[Lambda])*C[x, t] -
>         V*D[C[x, t], x] + \[Beta]*D[C[x, t],
>           {x, 2}], C[x, 0] == 0,
>       C[0, t] == C0*(1 - Exp[-t]),
>       Derivative[1, 0][C][20, t] == 0}, C,
>      {x, 0, 20}, {t, 0, 10},
>      MaxStepFraction -> 1/50, AccuracyGoal ->
>       5]]
>
>
> In[5]:=
> solution = C /. First[
>     NDSolve[{D[C[x, t], t] ==
>        (-\[Lambda])*C[x, t] -
>         V*D[C[x, t], x] +
>         \[Beta]*D[C[x, t],
>           {x, 2}], C[x, 0] ==
>        0, C[0, t] ==
>        C0*(1 - Exp[-t]),
>       D[C[20, t], x] == 0},
>      C, {x, 0, 20},
>      {t, 0, 10},
>      MaxStepFraction -> 1/50,
>      AccuracyGoal -> 5]]
>
>
>
> Robert Prince-Wright
> Risk Management Engineer, EP Americas
> Shell Exploration & Production Company
> One Shell Square
> P. O. Box 61933
> New Orleans
> LA 70161-1933
> United States of America
>
> Tel: +1 504 728 7720
> Fax: +1 504 728 4573
> Email: robert.prince-wright at shell.com
> Internet: http://www.shell.com
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Re: Re: Calculus : limits
  • Next by Date: Re: Question about derivatives
  • Previous by thread: Re: PDE Notation options (one works the other does not)
  • Next by thread: Sorting a list of pairs on the second elements