Re: Solving Nonlinear Transcedental equations

• To: mathgroup at smc.vnet.net
• Subject: [mg66121] Re: [mg66103] Solving Nonlinear Transcedental equations
• From: "Carl K. Woll" <carlw at wolfram.com>
• Date: Sun, 30 Apr 2006 04:21:19 -0400 (EDT)
• References: <200604290741.DAA23503@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```shyam d wrote:
> I got a problem with Mathematica 5.1 ,as i am going to solve a Nonlinear
> Transcedental Equations, which are five variables with five eqations.it is
> not able to solve the problem and it is not showing any thing can any
> on please solve the problem using mathematica 5.1.
> and send me how to solve in mathematica 5.1
> The problem statement is
>
> solving the 5 simultaneous Non linear Transcedental equations
>
> cos(5a)+cos(5b)+cos(5c)+cos(5d)+cos(5e)=0
>  cos(7a)+cos(7b)+cos(7c)+cos(7d)+cos(7e)=0
>  cos(11a)+cos(11b)+cos(11c)+cos(11d)+cos(11e)=0
>  cos(13a)+cos(13b)+cos(13c)+cos(13d)+cos(13e)=0
>  cos(a)+cos(b)+cos(c)+cos(d)+cos(e)=4
>
> solve for a= ?,b= ?,c= ?,d= ?
>
> thanks
> shaym
>

Assuming you want the real solution, the simplest approach is to just
use FindRoot:

coseqns = {
Cos[a] + Cos[b] + Cos[c] + Cos[d] + Cos[e] == 4,
Cos[5 a] + Cos[5 b] + Cos[5 c] + Cos[5 d] + Cos[5 e] == 0,
Cos[7 a] + Cos[7 b] + Cos[7 c] + Cos[7 d] + Cos[7 e] == 0,
Cos[11 a] + Cos[11 b] + Cos[11 c] + Cos[11 d] + Cos[11 e] == 0,
Cos[13 a] + Cos[13 b] + Cos[13 c] + Cos[13 d] + Cos[13 e] == 0
};

In[11]:= FindRoot[coseqns, {a, .3}, {b, .4}, {c, .5}, {d, .6}, {e, .7}]

Out[11]= {a -> 0.474437, b -> 0.114665, c -> 1.08634, d -> 0.330568,
e -> 0.787768}

However, if for some reason you are interested in the exact answer (as
would be produced by Solve) then you can use the symmetry of your
problem to simplify things. The first step is to convert your eqns with
cosines into an equation without cosines. That is, we'll relabel
Cos[a]->a, Cos[b]->b, etc. and work in the new variables. The easiest
way to convert your equations in Cos[n a] into equations in Cos[a] is to
use ChebyshevT:

eqns = coseqns /. Cos[(n_Integer: 1 ) x_] -> ChebyshevT[n, x];

For example, the first two equations now look like:

In[13]:= Take[eqns, 2]

Out[13]= {a + b + c + d + e == 4,
16 a^5 - 20 a^3 + 5 a + 16 b^5 + 16 c^5 + 16 d^5 + 16 e^5 - 20 b^3 -
20 c^3 - 20 d^3 - 20 e^3 + 5 b + 5 c + 5 d + 5 e == 0}

where the new variables a, b, c, d, and e are the cosines of your old
variables. The next step is to use the symmetry of your problem. To do
this, we need SymmetricReduction, so we load the package
SymmetricPolynomials:

Needs["Algebra`SymmetricPolynomials`"]

Then we transform from the variables a, b, c, d, e to the variables
SymmetricPolynomial[{a,b,c,d,e},n] with n running from 1 to 5:

In[18]:= Table[SymmetricPolynomial[{a, b, c, d, e}, n], {n, 5}]

Out[18]= {a + b + c + d + e,
a b + c b + d b + e b + a c + a d + c d + a e + c e + d e,
a b c + a d c + b d c + a e c + b e c + d e c + a b d + a b e + a d e +
b d e, a b c d + a b e d + a c e d + b c e d + a b c e, a b c d e}

To do this we use SymmetricReduction, and we'll call the symmetric
polynomials s1, s2, s3, s4, and s5:

symeqns = eqns /.
x_ == y_ :>
SymmetricReduction[x,{a, b, c, d, e},{s1, s2, s3, s4, s5}][[1]] == y;

For example, the first two equations have now been transformed to:

In[20]:= Take[symeqns, 2]

Out[20]= {s1 == 4,
16 s1^5 - 80 s2 s1^3 - 20 s1^3 + 80 s3 s1^2 + 80 s2^2 s1 + 60 s2 s1 -
80 s4 s1 + 5 s1 - 80 s2 s3 - 60 s3 + 80 s5 == 0}

Now, we try to solve the symmetrized equations using Solve:

In[21]:= symbresults = Solve[seqns]; // Timing

Out[21]= {10.609 Second, Null}

There are 9 solutions:

In[24]:= Length[symbres]

Out[24]= 9

However, only 3 of the solutions give real results for s1, s2, etc.:

realres = Cases[symbresults, a_ /; Element[{s1, s2, s3, s4, s5} /. a,
Reals]];

In[26]:= Length[realres]

Out[26]= 3

To find out what a, b, c, d, and e are given s1, s2, etc., we use the
fact that a, b, c, d, and e are the roots of the equation:

roots =
Table[Solve[x^5 - s1 x^4 + s2 x^3 - s3 x^2 + s4 x - s5 == 0 /.
realres[[n]],
x],
{n, 3}];

Applying N to roots shows that only the second result produces real
results. So, a solution for a, b, c, d and e can be obtained as follows:

ans = Thread[ {a,b,c,d,e} -> roots[[2, All, 1, 2]] ];

In[30]:= ArcCos[{a, b, c, d, e}] /. N[ans]

Out[30]= {1.08634, 0.787768, 0.474437, 0.330568, 0.114665}

Recalling the FindRoot result:

{a -> 0.474437, b -> 0.114665, c -> 1.08634, d -> 0.330568,
e -> 0.787768}

we see that the answers are the same (up to a permutation). The benefit
of the Solve approach is that ans gives the exact results for the values
of Cos[a], Cos[b], etc. For example, the value 1.08634 is the ArcCos of
the extremely large Root object that I give at the end of this post.

Carl Woll
Wolfram Research

In[60]:= N[ArcCos[a /. ans]]

Out[60]= 1.08634

In[59]:= a /. ans

Out[59]= Root[

37351364546074803894679853650111685881031823731808069709440733644062720000000\
00 #1^45 -

134464912365869294020847473140402069171714565434509050953986641118625792000\
000000 #1^44 +

236985841582529310483574820147870451705244601444583843665739457937539072000\
0000000 #1^43 -

272596770557464840805860387248647692490002928937009009702824725545473802240\
00000000 #1^42 +

230195347099028328714805219886619906890176347002313358331551351470590787584\
000000000 #1^41 -

152202908134158254048591823779673952786966190625129301037640577686417923112\
9600000000 #1^40 +

820684124992971895423706349695842257027875508354982581091252008534639231631\
3600000000 #1^39 -

371140919214166112860604619529312562063704008843873556596959517164328116551\
68000000000 #1^38 +

143685749319116195168007961940238075604194283838070152007983258162951947812\
864000000000 #1^37 -

483708081733925621201663085162186339099180461032016189939669199118293742387\
200000000000 #1^36 +

143343555203881923866721090437701765598883070853811028631014598796428299808\
5386240000000 #1^35 -

377646891417523826582548408010954273357049026647098692097340655728782334821\
9248640000000 #1^34 +

891694429446091689663521966944091304789263018682818998558361916396643345134\
7804160000000 #1^33 -

189966553787651756148153988347171238279403741310855250284409576656293679151\
76263680000000 #1^32 +

367197189622504144121532450807420127708361780853131298364063950097666007608\
57722880000000 #1^31 -

647025150850733878698212760651504823021676540762343478314708197637430499203\
88530176000000 #1^30 +

104340285530067143236276375728114299260543533186726385581380224906575420304\
075194368000000 #1^29 -

154496369008263821694216137468252261436938386973574067098929464311406821220\
187897856000000 #1^28 +

210618990147436981572747323472242876326178496911008746287827027031471193572\
482351104000000 #1^27 -

264938236139435586344335892343082408276713739853595035963241088355564053635\
551133696000000 #1^26 +

308043365160478605934659563122027973792376267504858770095133809400545861541\
618574131200000 #1^25 -

331485522067471337664545741277467311517243709784712592591698389914139016646\
758242713600000 #1^24 +

330440988057898404128921545656346453847176314478478186515590536439587647104\
085690572800000 #1^23 -

305300220129989091857218719812914969414628012897632175077884478684308959393\
625980928000000 #1^22 +

261478506284757068279344167046572947899027749124486312968369506427962373716\
958015283200000 #1^21 -

207560221410780336130475181633266381578044058950148042002467559705225280083\
370335682560000 #1^20 +

152627532338280763134657487896059778280028282793346884523264336489943804859\
482219484160000 #1^19 -

103883454319406216595259313464995978249843758613073565205438591349203807463\
763631667200000 #1^18 +

653725035878933464216776733715854113468282871452228887213391728994496451454\
17225611520000 #1^17 -

379802330437355976720132246346422559264028742311144662114724783733288592273\
42831603200000 #1^16 +

203366174521608239881338184805590952922744658856337145240024272090022866512\
37340872128000 #1^15 -

100152438004153185532584606641418750723275024949556445524828308441125112986\
50986385536000 #1^14 +

452531181946386906747733070548782678802269676271427985315245970816082831875\
8115302776000 #1^13 -

187061235281545016696317061105075391422705506039390711607113753133841751616\
9202370656000 #1^12 +

704929127622159959258321748695542118956733012440420411851939020270918865095\
844446476000 #1^11 -

241119592047659546947424622742691246087009923858686125013765328131112717765\
905300945600 #1^10 +

744368672052620822159397508245460433523140048851029423082916673833752665842\
11755609100 #1^9 -

205843852952123552474215845112819268207187144320217451482638413525462596656\
41929945600 #1^8 +

504683294007418297998388511818335737167514663616609500511233983683763544855\
7359863825 #1^7 -

108158246820859574195979970825439674942331611089891140781415528039660069770\
7107644700 #1^6 +

198621701021787855197113156284702135675227591087390151430763563757124400955\
343973760 #1^5 -

303827500463780325479273350291223160289457767146085116517774811310037395506\
41486080 #1^4 +

371295164878704126650377950067314083986499287453711879888971665240455195546\
6673140 #1^3 -

339300203023983330413432511364933646198468779556645352139108159871247896770\
971600 #1^2 +

205685297220947731922666228074910817819091111176254694859426343134176723038\
98560 #1 -

619009799065719073110429095957680080341702341327461247801235771922807605266\
176 &, 1]

```

• Prev by Date: Re: Re: Illusory Multicore Support in 5.2?
• Next by Date: Re: Solving Nonlinear Transcedental equations
• Previous by thread: Solving Nonlinear Transcedental equations
• Next by thread: Re: Solving Nonlinear Transcedental equations