Re: ts ts ts
- To: mathgroup at smc.vnet.net
- Subject: [mg5001] Re: ts ts ts
- From: Daniel Lichtblau <danl>
- Date: Sat, 19 Oct 1996 02:25:48 -0400
- Organization: wolfram.com
- 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....
>
> Gratitude beyond expression,
>
> --
> Arthur Fritzsche | PowerPC advocate since 11/04/79
> afritzse at limmat.ch | OS/2 forever! UNIX forever! Win 95 forever!
> ---({|})---
> afritzse at pax.eunet.ch | Power Mac 8100/80: In Need of UNIX
> CIS: 100031,1752 | on Grand Friesenberg, Zurich, Switzerland
> *** Drop by at http://www.limmat.ch/afritzse/ -- MARVELLOUS nature! ***
You have a dense symbolic linear system. It is symbolic in the sense
that the numeric quantities Cos[18] etc. are "encapsulated" as
variables. It takes about 20 sec on a pentium pro using version 3.0. The
result has a LeafCount around 1.4 meg.
Wrapping N[] around the equations results in a short numeric solution in
a fraction of a second.
Daniel Lichtblau
Wolfram Research
danl at wolfram.com