MathGroup Archive 2008

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

Search the Archive

Re: ODE in mathematica. what is wrong?

hoi-su jung wrote:

> I am a freshman of Mathematica, I need help here...
> I met such problem as:
> NDSolve[{ y'[x] == -\[Rho]y[x], y[0] == Subscript[y, 0], 
>   I\[HBar] y'[x] == \[Epsilon]y[x], y[0] == Subscript[y, 0], 
>   y''[x] + 2 \[Rho]y'[x] + k^2 == 0, y'[0] == Subscript[g, 0]}, y, x]
> NDSolve::dvnoarg: The function y appears with no arguments.
> How to Handle???

Few remarks:

. Do not use subscripted functions/variables or use the Symbolize 
command from the Notation package

. Spaces between variables are important since they are interpreted as 
implicit multiplication (a b == a*b != ab) otherwise you just have a 
name two ore more symbols

. Capital I is a reserved/built in symbol that denote the imaginary unit 
Sqrt[-1], here I believe you want i

. Your system is overdetermined, which usually mean that you have 
conflicting equations

. NDSolve requires to have numeric values for every parameter, otherwise 
you may want to use DSolve, which is a symbolic solver

   In[1]:= NDSolve[{(y^\[Prime])[x]==-\[Rho] y[x],y[0]==y0,i \[HBar]
   (y^\[Prime])[x]==\[Epsilon] y[x],y[0]==y0,(y^\[Prime]\[Prime])[x]+2
   \[Rho] (y^\[Prime])[x]+k^2==0,(y^\[Prime])[0]==g0},y,x]

   During evaluation of In[1]:= NDSolve::overdet: There are fewer
   dependent variables, {y[x]}, than equations, so the system is

   Out[1]= NDSolve[{(y^\[Prime])[x]==-\[Rho] y[x],y[0]==y0,i \[HBar]
   (y^\[Prime])[x]==\[Epsilon] y[x],y[0]==y0,k^2+2 \[Rho]

   In[2]:= DSolve[{(y^\[Prime])[x]==-\[Rho] y[x],y[0]==y0},y,x]

   Out[2]= {{y->Function[{x},E^(-x \[Rho]) y0]}}

-- Jean-Marc

  • Prev by Date: Re: Another Out of Memory Problem
  • Next by Date: Re: Another Out of Memory Problem
  • Previous by thread: Re: ODE in mathematica. what is wrong?
  • Next by thread: Another Out of Memory Problem