Re: ts ts ts
- To: mathgroup at smc.vnet.net
- Subject: [mg5033] Re: ts ts ts
- From: Dr Stephen P Luttrell <luttrell at signal.dra.hmg.gb>
- Date: Sat, 19 Oct 1996 16:40:35 -0400
- Organization: Defence Research Agency
- Sender: owner-wri-mathgroup at wolfram.com
Arthur Fritzsche wrote: > > Hi there. > > Does anybody know why Mathematica gets choked trying to solve > this simple equation? (seems like an easy way to calculate Fourier series up to n=3) > > --------------------------------- > x1=3 > y1=3 > x2=4 > y2=4 > x3=5 > y3=5 > x4=10 > y4=-20 > x5=11 > y5=30 > x6=12 > y6=-30 > x7=18 > y7=0 > > Solve[{ > y1==a0+a1 Cos[x1]+b1 Sin[x1]+a2 Cos[2 x1]+b2 Sin[2 x1]+a3 Cos[3 x1]+ > b3 Sin[3 x1], > y2==a0+a1 Cos[x2]+b1 Sin[x2]+a2 Cos[2 x2]+b2 Sin[2 x2]+a3 Cos[3 x2]+ > b3 Sin[3 x2], > y3==a0+a1 Cos[x3]+b1 Sin[x3]+a2 Cos[2 x3]+b2 Sin[2 x3]+a3 Cos[3 x3]+ > b3 Sin[3 x3], > y4==a0+a1 Cos[x4]+b1 Sin[x4]+a2 Cos[2 x4]+b2 Sin[2 x4]+a3 Cos[3 x4]+ > b3 Sin[3 x4], > y5==a0+a1 Cos[x5]+b1 Sin[x5]+a2 Cos[2 x5]+b2 Sin[2 x5]+a3 Cos[3 x5]+ > b3 Sin[3 x5], > y6==a0+a1 Cos[x6]+b1 Sin[x6]+a2 Cos[2 x6]+b2 Sin[2 x6]+a3 Cos[3 x6]+ > b3 Sin[3 x6], > y7==a0+a1 Cos[x7]+b1 Sin[x7]+a2 Cos[2 x7]+b2 Sin[2 x7]+a3 Cos[3 x7]+ > b3 Sin[3 x7]}, {a0, a1, b1, a2, b2, a3, b3}] > --------------------------------- > > Might there be a more straightforward solution? The sinus and cosinus terms >evidently are fixed, so.... You can obtain a quick solution if you wrap your equations in N[], because this forces the Sin[] and Cos[] to evaluate to numerical values. Ther solution I then obtained was: {{a0 -> -908.7749999999999, a1 -> -519.642, b1 -> -1411.07, a2 -> 601.6299999999999, b2 -> -506.1069999999999, a3 -> 193.252, b3 -> 129.722}} -- Dr Stephen P Luttrell luttrell at signal.dra.hmg.gb Adaptive Systems Theory 01684-894046 (phone) Room EX21, Defence Research Agency 01684-894384 (fax) Malvern, Worcs, WR14 3PS, U.K. http://www.dra.hmg.gb/cis5pip/Welcome.html