Re: NDSolve[] and Differential Equations: Problem solving two

*To*: mathgroup at smc.vnet.net*Subject*: [mg85864] Re: NDSolve[] and Differential Equations: Problem solving two*From*: dh <dh at metrohm.ch>*Date*: Mon, 25 Feb 2008 07:40:52 -0500 (EST)*References*: <fpkvbe$hjt$1@smc.vnet.net>

Hi Gopinath, consider: Table[NDSolve[{eqn1[[im]] == 0, icon1[[im]] == 0, icon2[[im]] == 0}, bdefmitr[[im]], {t, 0, 1 + sep/len}], {im, 1, nmx}]; This are nmx different calls to NDSolve that are completely independent. Say im==1, then bdefmitr[[im]]==vi[1][t]. That is, you are declaring that there is only ONE function to solve for. Here is a simple example of a coupled system: eqns={f1'[t]== 2 f1[t]+f2[t],f2'[t]==2 f1[t]+2 f2[t],f1[0]==1,f2[0]==2}; sol={f1,f2} /.NDSolve[eqns,{f1,f2},{t,0,1}][[1]]; Plot[{ sol[[1]][t],sol[[2]][t]},{t,0,1}] hope this helps, Daniel Gopinath Venkatesan wrote: > Dear Daniel > > Thanks for the suggestion. > > I looked into the set of equations once again to verify it, but the equation phieq contains the phi terms and along with phicon1 and phicon2 (initial conditions) they are all included in the equation as shown below: > > eqn1 = Table[ > Flatten[{wdef1icon1, wdef1icon2, wdef2icon1, wdef2icon2, sdeficon1, > sdeficon2, phicon1, phicon2, phieq, v3eq, v1eq, v2eq, > modsetitr[[im]]}], {im, 1, nmx}]; > > So it is something I messed up with solving several different differential equations related to each other. I don't see any example in the Help section. All discusses one differential equation only. If you have any examples please post here. > > Also one problem I experienced is that in the definition (used in the code) like below: > > reactP1[t_] := (\[Pi]^4 \[Kappa] wrf1^2)/ > 24 (Chop[wdef1itr[t]] - Chop[func[t, t]]); > > or simply r1[t_]:=k*(a[x,t]-b[t]) for easy understanding, > > I am only checking if the entire term i.e., k(a[x,t]-b[t]) is positive and if not positive, substitute zero for that term. For that I am using the below syntax. > > r[t] = r[t] /. t_?Negative -> 0; (This only checks if the argument is negative or not. Isn't it? If so, then I have to store the a[x,t]-b[t] to another variable and check if that variable is negative). > > Problem is, if b[t] evaluates to negative, it removes it and shows only k*a[x,t] i.e. r1[t]=k*(a[x,t]-1) becomes r1[t]=k*a[x,t]. If the entire term is not computable i.e. a[x,t] is yet to be found, then I want it to be r1[t]=k*(a[x,t]-1) only and not k*a[x,t]. However in the later steps, (after I introduce Do loop) a[x,t] values will be available and hence it will evaluate the whole term and see if it is negative. That case works fine for me. > > Do you know workaround for that? Currently I can do one simple thing, I will check the step number, if step is zero (in the Do loop with step=0 in the beginning), I keep it as k*(a[x,t]-1), and as step increments, I do the check so it evaluates the whole term. > > Thank you for the suggestions. I wish you and others pour some more hints for solving this problem. > > Gopinath Venkatesan > University of Oklahoma >