[Date Index]
[Thread Index]
[Author Index]
Re: Why am I getting this error?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg60366] Re: Why am I getting this error?
*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
*Date*: Wed, 14 Sep 2005 03:27:33 -0400 (EDT)
*Organization*: The Open University, Milton Keynes, U.K.
*References*: <dg69s7$a9j$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
ksmath wrote:
> I am attempting to solve a system with 3 pde's and I keep getting this error even though I think all of my equations have independent variables:
>
> NDSolve::dvnoarg: The function v appears with no arguments.
>
> If anyone could find the mistake in my code I would really appreciate it. C,V, and R are the dependent variables, and t (time) and x(distance-does not depend on time) are the independent variables. All other variables are constants.
>
> Thank you for any assistance you can provide me.
>
> \!\(\(rRHS\ = \ \(d\_r\) D[r[t,
> x], {x, 2}] + Î² \((1 - \((r[t, x] - r\_base)\)/\((k\_r -
> r\_base)\))\) \((r[t, x] - r\_base)\);\)\[IndentingNewLine]
> \(vRHS\ = \ \(d\_v\) D[v[t, x], {x, 2}] - Ï?\ v[t, x]\ -
> Î·\ v[t, x]\ c[t, x]/\((Î³\_1 + v[t, x])\) + If[
> q\_large < q\_min, Î» \((q\_large - q\_min)\), 0];\)\[IndentingNewLine]
> \(\(cRHS\ = \ D[c[t, x]\ v[t, x]\ D[v[t, x], x], x] + If[v[
> t, x] â?¥ v\_g, Ï?\ v[t, x]\ c[t,
> x]\ /\((Î³\_2 +
> v[t, x])\), Ï? \((v[t, x] -
> v\_d)\) c[t, x]];\)\(\[IndentingNewLine]\)
> \)\[IndentingNewLine]
> \(reqn\ = D[r[t, x], t]\ == \ rRHS;\)\[IndentingNewLine]
> \(veqn\ = \ D[v[t, x], t]\ == \ vRHS;\)\[IndentingNewLine]
> \(ceqn\ = \ D[c[t, x], t]\ == \ cRHS;\)\)
>
> BC1 = Derivative[0, 1][r][t, 0] == 0;
> BC2 = Derivative[0, 1][r][t, 1] == 0;
> BC3 = Derivative[0, 1][v][t, 0] == 0;
> BC4 = Derivative[0, 1][v][t, 1] == 0;
> BC5 = c[t, 0] == 1;
> BC6 = c[t, 1] v[t, 1] Derivative[0, 1][v][t, 1] == 0;
>
> \!\(\(c\_init = \(c\_o\) Exp \((\(-150\) x\^2)\) == c[0,
> x];\)\[IndentingNewLine]
> \(r\_init = \((K\_r -
> r\_base)\) Exp \((\(-100\) x\^2)\) + r\_base == r[0, x];\)\
> \[IndentingNewLine]
> \(v\_init = \((v\_g - v\_d)\)/\((2 v\_o)\) == v[0, x];\)\)
>
> \!\(\(solution\ = \ NDSolve[{reqn, \ veqn, \ ceqn, q1\_i,
> q2\_i, \ c\_init, \ v\_init, \
> r\_init, \ BC1, \ BC2, \ BC3, \ BC4, \ BC5, \ BC6}, {r[t, x], v[t,
> x], c[t, x], q1[t, x], q2[t, x]}, {t, 0, 1}, {x, 0, 1}];\)\)
>
> Any help is much appreciated.
>
> Katie
>
Hi Katie,
By default, Mathematica does not recognized subscripted variables as
symbols but as more complex constructions. Say we want to solve the
following ODE. Note that we are using two subscripted variables y_0 and
y_air.
In[1]:=
eqn = Derivative[1][y][t] ==
(-p)*(y[t] - Subscript[y, air])
Out[1]=
Derivative[1][y][t] == (-p)*(-Subscript[y, air] +
y[t])
Here, everything looks fine. However, when we try to solve the ODE with
initial value y{0} == y_0
In[2]:=
sols = DSolve[{eqn, y[0] == Subscript[y, 0]}, y, t]
From In[2]:=
DSolve::dvnoarg: The function y appears with no arguments. More...
Out[2]=
DSolve[{Derivative[1][y][t] ==
(-p)*(-Subscript[y, air] + y[t]),
y[0] == Subscript[y, 0]}, y, t]
Mathematica complains about the function y that is supposed to be called
with no arguement. In fact, a mixed up in the interpretation of symbols
and subscripts occurred. To fix this issue, you must use the *Notation*
package and _from the notation palette_ use the function *Symbolize* to
transform subscripted names into symbols. See the following example
In[3]:=
Needs["Utilities`Notation`"]
In[4]:=
Symbolize[NotationBoxTag[\(y\_air\)]]
In[5]:=
Symbolize[NotationBoxTag[\(y\_0\)]]
In[6]:=
eqn = Derivative[1][y][t] ==
(-p)*(y[t] - y\[UnderBracket]Subscript\[UnderBracket]air)
Out[6]=
Derivative[1][y][t] == (-p)*(-y\[UnderBracket]Subscript\[UnderBracket]air +
y[t])
In[7]:=
sols = DSolve[{eqn, y[0] == y\[UnderBracket]Subscript\[UnderBracket]0},
y, t]
Out[7]=
{{y -> Function[{t}, (y\[UnderBracket]Subscript\[UnderBracket]0 -
y\[UnderBracket]Subscript\[UnderBracket]air + E^(p*t)*
y\[UnderBracket]Subscript\[UnderBracket]air)/E^(p*t)]}}
Hope this helps,
/J.M.
Prev by Date:
**Re: Draw3D ColorFunction->Hue**
Next by Date:
**Re: Why am I getting this error?**
Previous by thread:
**Re: Why am I getting this error?**
Next by thread:
**Re: Why am I getting this error?**
| |