Re: Problems about "For"
- To: mathgroup at smc.vnet.net
- Subject: [mg96548] Re: Problems about "For"
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 16 Feb 2009 06:56:47 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <gn8j97$7md$1@smc.vnet.net>
In article <gn8j97$7md$1 at smc.vnet.net>, laura parisi <lau.parisi at gmail.com> wrote: > Dear Mathematica Users, > > I've realized a loop using Euler method: > > For[i=1,i<2, > {S=1/2*N12/DE[i-1]-1/2*DE[i-1]*=83=D5rif2, > a[i]=DSolve[=83=E2'[t]-S=83=FA0,=83=E2[t],t],=83=E2[t]==83=E2[t]/.a[= > i], > =83=E2[t]==83=E2[t]/.C[1]=84_C1, > eq==83=E2[t]/.t=84_(t1[[i]]-1), > a=Solve[eq===83=E2[i-1],C1], > =83=E2[i]==83=E2[t]/.{C1=84_a,t=84_t1[[i]]},DE[i]=DE[i-1]*=83=E2[i]}= > ;i++]; > > in this expression, N1 is stated like a sinusoidal function: > N1=N0+B*Sin[=83=E7*t]; > > and T1 is a vector of time: > t1=Table[i,{i,20}]; > > All the other parameters are allocated: > B=1; > N0=2; > =83=E7=1; > A=1; > E0=1; > =83=E2[0]=1; > =83=D5rif=1; > DE[0]=1; > > The loop give me this error: > > Solve::eqf : {-2+C1}=83=FA1 is not a well-formed equation. =83=F7 > with C1 constant of integration. > > > What can I do for this loop in this case and if i want to reapet the > loop for i<100? > Is better to use "DO"? > > > Help me..It's important. > > Thank you! Laura, Your message is unreadable on my different systems (Mac OS X, Windows, and Linux, web browsers Safari, Firefox, or Chrome, or news reader MT-NewsWatcher) for it is crippled by to many non-rendered characters such as =84 or =83=E2. (Of course, other readers might have a different experience.) You should try to copy and past Mathematica expressions in InputForm[], for it is way more readable and far less prone to misinterpretation (especially when your email/newsgroup client adds spurious equal sings and/or other unwanted characters or character conversions). To use the _InputForm_ when copying an expression from a Mathematica notebook to an email client: select the cell(s) you want to include in your email, then within the *Cell* menu select either *Convert To* or *Display As* and choose *InputForm*. Finally, copy and paste as usual. Regards, --Jean-Marc