Re: Try again to send my message: problems about "for"
- To: mathgroup at smc.vnet.net
- Subject: [mg96571] Re: Try again to send my message: problems about "for"
- From: dh <dh at metrohm.com>
- Date: Mon, 16 Feb 2009 16:38:03 -0500 (EST)
- References: <gnbkaa$3cg$1@smc.vnet.net>
Hi Laura, curly bracket are used to denote lists not bracketing, you must use "(..)" for bracketing. Therefore "{-2+C1}==1" is not an equation. Then, the function DE is not defined. Further, a compound statement uses ";" as delimiter, not ",". There is no {..} needed inside the For loop: Fot[ ..; ..; ... ,++i] hope this helps, Daniel laura parisi wrote: > Dear Mathematica Users, > the last message was unreadable and so i send it again. > > > I've realized a loop using Euler method: > For[i = 1, i < 2, > {S = (1/2)*(N1^2/DE[i - 1]) - (1/2)*DE[i - 1]*\[Epsilon]rif^2, > a[i] = DSolve[Derivative[1][\[Rho]][t] - S == 0, \[Rho][t], t], > \[Rho][t] = \[Rho][t] /. a[i], > \[Rho][t] = \[Rho][t] /. C[1] -> C1, > eq = \[Rho][t] /. t -> (t1[[i]] - 1), > a = Solve[eq == \[Rho][i - 1], C1], > \[Rho][i] = \[Rho][t] /. {C1 -> a, t -> t1[[i]]}, > DE[i] = DE[i - 1]*\[Rho][i]}; i++]; > > in this expression, N1 is stated like a sinusoidal function: > N1 = N0 + B*Sin[\[Omega]*t]; > > and T1 is a vector of time: > t1 = Table[i, {i, 20}] > > All the other parameters are allocated: > B = 1; > N0 = 2; > \[Omega] = 1; > A = 1; > E0 = 1; > \[Rho][0] = 1; > \[Epsilon]rif = 1; > > The loop give me this error: > Solve::eqf:{-2+C1}==1 is not a well-formed equation. >> > > with C1 constant of integration. > > > What can I do for this loop in this case and in a case if i want to > reapet the loop for i<100? > Is better to use "DO"? > > > Help me..It's important. > > Thank you! >