Re: ODE in mathematica. what is wrong?
- To: mathgroup at smc.vnet.net
- Subject: [mg91329] Re: ODE in mathematica. what is wrong?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 15 Aug 2008 06:56:22 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g813bb$4r$1@smc.vnet.net>
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 overdetermined. 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] (y^\[Prime])[x]+(y^\[Prime]\[Prime])[x]==0,(y^\[Prime])[0]==g0},y,x] In[2]:= DSolve[{(y^\[Prime])[x]==-\[Rho] y[x],y[0]==y0},y,x] Out[2]= {{y->Function[{x},E^(-x \[Rho]) y0]}} Regards, -- Jean-Marc