discretization and plotting pde system
- To: mathgroup at smc.vnet.net
- Subject: [mg40034] discretization and plotting pde system
- From: john boy <johnboy98105 at yahoo.com>
- Date: Sun, 16 Mar 2003 02:48:17 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
hello. i have been trying to discretize second order derivatives in following system and then solve and plot the solution of the discretized version, using the mathematica software. Being a novice, i have been having some difficulties... first, the actual system looks like this. and this is the one of the systems i would like to learn how to solve... {dS[t,x] = 1 d^2S[t,x]/dx^2 - 10 S[t,x] C[t,x] + 1 SC[t,x] - 10 SC[t,x], dC[t,x] = 0.1 d^2C[t,x]/dx^2 - 10 S[t,x] C[t,x] + 1 SC[t,x] + 10 SC[t,x], dSC[t,x] = 1 d^2SC[t,x]/dx^2 + 10 S[t,x] C[t,x] - 1 SC[t,x] - 10 SC[t,x]} when i make steady state assuptioms( as many mathematicians do) then i can change this system into somethign that doesn't involve time derivatives. ( i wasn't too sure about this. DO you guys know how to do this?) ssd= {0 = 1 d^2S[x]/dx^2 - 10 S[x] C[x] + 1 SC[x] - 10 SC[x], 0 = 0.1 d^2C[x]/dx^2 - 10 S[x] C[x] + 1 SC[x] + 10 SC[x], 0 = 1 d^2SC[x]/dx^2 + 10 S[x] C[x] - 1 SC[x] - 10 SC[x]} at this point the system isn't pde anymore, its just ode's so when i try to solve using, NDSolve[{ssd, S[0]== 0, C[0] == 0, SC[0]== 0, S''[x] == 0, C''[x] ==0, SC''[x]==0}, {S[x], C[x], SC[x]}. {x,-1, 1}] then it gives errors about initial conditions... then if I discretize the second order derivatives, I think it should look somethign like this? (This way i will just have algebraic expression? ) ssrd = {0 = 1 (S[x+1] - 2S[x] -S[x-1])/(Abs[xmas - xmin)/n)^2 - 10 S[x] C[x] + 1 SC[x] - 10 SC[x], 0 = 0.1 (C[x+1] - 2C[x] -C[x-1])/(Abs[xmas - xmin)/n)^2 - 10 S[x] C[x] + 1 SC[x] + 10 SC[x], 0 = 1 (SC[x+1] - 2SC[x] -SC[x-1])/(Abs[xmas - xmin)/n)^2 + 10 S[x] C[x] - 1 SC[x] - 10 SC[x]} But if I use NSolve[ssrd, {S[x], C[x], SC[x]}, {x, -1, 1}] i get some errors about valid variables.. i could really use soem help in solving these equations, I know some of you have natural talent for things like this, but I have been struggling a lot with it. I hope someone knows what i'm talking about and hope is willing to give me soem working codes to do this. I'm pretty new at it and i'm spending a lot of time without getting anywhere. i'll paste the notebook cell expressions below. thank you all veru much in advance. In[1]:= \!\(d = \[IndentingNewLine]{\[PartialD]\_t s[t, x]\ == \ Ds\ \ \[PartialD]\_{x, 2}\ s\ [t, x]\ - \ f\ s[t, x]\ c[t, x]\ + \ r\ sc[t, x]\ - \ a\ t[t, x]\ s[t, x], \ \[IndentingNewLine]\[PartialD]\_t c\ [t, x]\ == \ Db\ \ \[PartialD]\_{x, 2}\ c\ [t, x]\ - \ f\ s[t, x]\ c[t, x]\ + \ r\ sc[t, x]\ + \ l\ t[t, x]\ sc[t, x], \[IndentingNewLine]\[PartialD]\_t\ sc\ [t, x]\ == \ Dc\ \ \[PartialD]\_{x, 2}\ sc\ [t, x]\ + \ f\ s[t, x]\ c[t, x]\ - \ r\ sc[t, x]\ - \ l\ t[t, x]\ sc[t, x]}\) In[2]:= \!\(ssd = \[IndentingNewLine]{0\ == \ Ds\ \ \[PartialD]\_{x, 2}\ s\ [x]\ - \ f\ s[x]\ c[x]\ + \ r\ sc[x]\ - \ 10\ s[x], \ \[IndentingNewLine]0\ == \ Db\ \ \[PartialD]\_{x, 2}\ c\ [x]\ - \ f\ s[x]\ c[x]\ + \ r\ sc[x]\ + \ 10\ sc[x], \[IndentingNewLine]0\ == \ Dc\ \ \[PartialD]\_{x, 2}\ sc\ [x]\ + \ f\ s[x]\ c[x]\ - \ r\ sc[x]\ - \ 10\ \ sc[x]}\) In3:= \!\(\* RowBox[{"NDSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ "ssd", ",", \(s[0] == 0\), " ", ",", " ", \(c[0] == 0\), ",", " ", \(sc[0] == 0\), ",", " ", RowBox[{ RowBox[{ SuperscriptBox["s", "\[Prime]\[Prime]", MultilineFunction->None], "[", "x", "]"}], " ", "==", " ", "0"}], ",", " ", RowBox[{ RowBox[{ SuperscriptBox["c", "\[Prime]\[Prime]", MultilineFunction->None], "[", "x", "]"}], "==", "0"}], ",", " ", RowBox[{ RowBox[{ SuperscriptBox["sc", "\[Prime]\[Prime]", MultilineFunction->None], "[", "x", "]"}], "==", " ", "0"}]}], "}"}], ",", " ", \({s[x], \ c[x], \ sc[x]}\), ",", " ", \({x, \ \(-1\), \ 1}\)}], "]"}]\) In4:= \!\(ssd = \[IndentingNewLine]{0\ == \ \ f\ s[x]\ c[x]\ + \ r\ sc[x]\ - \ a\ t[x]\ s[x], \ \[IndentingNewLine]0\ == \ Db\ \ \[PartialD]\_{x, 2}\ c\ [x]\ - \ f\ s[x]\ c[x]\ + \ r\ sc[x]\ + \ l\ t[x]\ sc[x], \[IndentingNewLine]0\ == \ Dc\ \ \[PartialD]\_{x, 2}\ sc\ [x]\ + \ f\ s[x]\ c[x]\ - \ r\ sc[x]\ - \ l\ t[x]\ sc[x]}\) In5:= \!\(ssd\ = {0\ == \ Ds\ \((\ \(\(\ \)\(s\ [\((n + 1)\)]\ - \ 2\ s[\((n)\)] - \ s[\((n - \ 1)\)]\)\)\/\((dx)\)^2)\)\ - \ f\ s[x]\ c[x]\ + \ r\ sc[x]\ - \ a\ t[x]\ s[x], \ \[IndentingNewLine]0\ == \ Db\ \ \((\ \(\(\ \)\(c\ [\((n + 1)\)]\ - \ 2\ c[\((n)\)] - \ c[\((n \ - 1)\)]\)\)\/\((dx)\)^2)\)\ - \ f\ s[x]\ c[x]\ + \ r\ sc[x]\ + \ l\ t[x]\ sc[x], \[IndentingNewLine]0\ == \ Dc\ \((\ \ \(sc\ [\((n + 1)\)]\ - \ 2\ sc[\((n)\)] - \ sc[\((n - \ 1)\)]\)\/\((dx)\)^2)\)\ + \ f\ s[x]\ c[x]\ - \ r\ sc[x]\ - \ l\ t[x]\ sc[x]}\) In6 := NSolve[ssrd, {s[x], c[x], sc[x]}, {x, -1, 1}] __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com