[Date Index]
[Thread Index]
[Author Index]
Re: FW: Solving Nonlinear Equations
*To*: mathgroup at smc.vnet.net
*Subject*: [mg80563] Re: FW: [mg80515] Solving Nonlinear Equations
*From*: DrMajorBob <drmajorbob at bigfoot.com>
*Date*: Sun, 26 Aug 2007 03:04:17 -0400 (EDT)
*References*: <24026302.1187974889600.JavaMail.root@m35>
*Reply-to*: drmajorbob at bigfoot.com
All [[]] instances can likely be eliminated, and should be. For instance,
since w, S, and delta have the same length, we have
m1 = Total[w S Exp[r-delta]]
Several of your expressions still have unmatched parentheses, though --
including the one for m1. For purposes of FindRoot, though, m1...m4 are
just numbers, so never mind.
Just guessing where parens should and shouldn't go, I get:
Clear[a, b, c, d, m1, m2, m3, m4]
step1 = {m1 == c - d*Exp[1/(2*b^2)]*Sinh[a/b],
m2 == c^2 + (c^2/2) (Exp[2/b^2] Cosh[2 a/b] - 1) -
2 c*d*Exp[1/(2 b^2)]*Sinh[a/b],
m3 == c^3 - 3*c^3*d*Exp[1/(2 b^2)]*Sinh[a/b] +
3*c (d^2/2)*(Exp[2/b^2] Cosh[2 a/b] - 1) + (d^3/
4) (3*Exp[1/(2 b^2)] Sinh[a/b] - Exp[9/(2 b^2)] Sinh[3 a/b]),
m4 == c^4 - 4 (c^3) d*Exp[1/(2 b^2)]*Sinh[a/b] +
3 (c*d)^2*(Exp[2/b^2] Cosh[2 a/b] - 1) + (d^3/4) +
c*d^3 (3*Exp[1/(2 b^2)] Sinh[a/b] - Exp[9/(2 b^2)] Sinh[3 a/b]) +
d^4/8 Exp[8/b^2]*Cosh[4 a/b] - 4*Exp[2/(b^2)] Cosh[2 a/b]} //
Simplify
{c == m1 + d \[ExponentialE]^(1/(2 b^2)) Sinh[a/b],
m2 == 1/2 c (c + c \[ExponentialE]^(2/b^2) Cosh[(2 a)/b] -
4 d \[ExponentialE]^(1/(2 b^2)) Sinh[a/b]),
6 c d^2 + 4 m3 + d^3 \[ExponentialE]^(9/(2 b^2)) Sinh[(3 a)/b] ==
4 c^3 + 6 c d^2 \[ExponentialE]^(2/b^2) Cosh[(2 a)/b] +
3 d (-4 c^3 + d^2) \[ExponentialE]^(1/(2 b^2)) Sinh[a/b],
3 c^2 d^2 + m4 + 4 c^3 d \[ExponentialE]^(1/(2 b^2)) Sinh[a/b] +
c d^3 \[ExponentialE]^(9/(2 b^2)) Sinh[(3 a)/b] ==
c^4 + d^3/
4 + (-4 + 3 c^2 d^2) \[ExponentialE]^(2/b^2) Cosh[(2 a)/b] +
1/8 d^4 \[ExponentialE]^(8/b^2) Cosh[(4 a)/b] +
3 c d^3 \[ExponentialE]^(1/(2 b^2)) Sinh[a/b]}
Notice that c is given, immediately, in terms of other variables, so the
system reduces in size:
cRule = First@ToRules@First@step1;
step2 = DeleteCases[step1 /. cRule, True] // Simplify;
A little experimentation now shows that each equation of step2 can be
solved for d:
dSolns = Solve[#, d] & /@ step2;
Length /@ dSolns
{2, 4, 4}
Ten partial solutions!
Inspection of these (with your knowledge of the actual problem) may allow
you to eliminate some, but the test is whether one solution solves ALL
THREE equations in step2 -- which I doubt, but you may as well try, with
soln2 = Solve[step2, d]
I didn't let this run to completion, but if you let it run and it
succeeds, you'll have a rule for setting d, and the system is down to two
equations (step3). Then you can try to solve for a or b to get further, or
use the new dRule to initialize for FindRoot.
If Solve doesn't succeed, you can still use the two solutions from step2's
first equation as starting points for d in FindRoot. Solve's failure may
mean that NO overall solution exists, but then again, FindRoot may find
something Solve cannot.
Good luck!!
Bobby
On Fri, 24 Aug 2007 05:31:30 -0500, Biyana, D. (Dugmore)
<DugmoreB at Nedbank.co.za> wrote:
> Let me fill the missing gaps on my question:
> m1= Sum[w[[i]]S[[i]]Exp[(r-delta[[i]]),{i,Length[S]}];
> m2=
> Sum[w[[i]]w[[j]]S[[i]]S[[j]]Exp[(2r-delta[[i]]-delta[[j]]+rho[[i,j]]sig[[i]]
> sig[j]])T,{i,Length[S]},{j,Length[S]}];
> m3=
> Sum[w[[i]]w[[j]]w[[k]]S[[i]]S[[j]]S[[k]]Exp[(3r-delta[[i]]-d[[j]]-delta[[k]]
> +rho[[i,j]]sig[[i]]sig[j]]+rho[[i,k]]sig[[i]]sig[k]]+rho[[j,k]]sig[[j]
]sig[k
> ]])T,{i,Length[S]},{j,Length[S]},{k,Length[S]}];
> m4=
> Sum[w[[i]]w[[j]]w[[k]]w[[l]]S[[i]]S[[j]]S[[k]]S[[l]]Exp[(4r-delta[[i]]-d[[j]
> ]-delta[[k]]-delta[[l]]+rho[[i,j]]sig[[i]]sig[j]]+rho[[i,k]]sig[[i]]sig[k]]+
> rho[[j,k]]sig[[j]]sig[k]]+rho[[i,l]]sig[[i]]sig[l]]+rho[[j,l]]sig[[j]] sig[l]
> ]+rho[[k,l]]sig[[k]]sig[l]])T,{i,Length[S]},{j,Length[S]},{k,Length[S] },{l,L
> ength[S]}];
> With
> r=0.063;T=1;S=Table[1,{i,7}];w={0.1,0.15,0.15,0.1,0.05,0.2,0.25};delta={0.01
> 69,0.0136,0.0239,0.0362,0.0192,0.0081,0.0166};sig={0.1155,0.1453,0.2068,0.14
> 62,0.1799,0.1559,0.1568};rho={{1,0.35,0.1,0.27,0.04,0.17,0.71},{0.35,1.,0.39
> ,0.27,0.5,-0.08,0.15},{0.1,0.39,1.,0.53,0.7,-0.23,0.9},{0.27,0.27,0.53,1.,0.
> 46,-0.22,0.32},{0.04,0.5,0.7,0.46,1.,-0.29,0.13},{0.17,-0.08,-0.23,-0. 22,-0.
> 29,1.,-0.03},{0.71,0.15,0.09,0.32,0.13,-0.03,1.}};
> FindRoot[{m1==c-d*Exp[1/(2*b^2)]*Sinh[a/b],
>> m2==c^2+(c^2/2)(Exp[2/b^2]Cosh[2a/b]-1)-2c*d*Exp[1/(2b^2)]*Sinh[a=
/b],
>>
> m3==c^3-3*c^3*d*Exp[1/(2b^2)]*Sinh[a/b],+3*c(d^2/2))*(Exp[2/b^2]Co=
sh[2a/b]-1
>> )+(d^3/4)(3*Exp[1/(2b^2)]Sinh[a/b]-Exp[9/(2b^2)]Sinh[3a/b]),
>>
> m4==c^4-4(c^3)d*Exp[1/(2b^2)]*Sinh[a/b]+3(c*d)^2))*(Exp[2/b^2]Cosh=
[2a/b]-1)+
>>
> (d^3/4)+c*d^3(3*Exp[1/(2b^2)]Sinh[a/b]-Exp[9/(2b^2)]Sinh[3a/b])+(d^4/8=
)(Exp[
>> 8/(b^2)]*Cosh
>> [4a/b]-4*Exp[2/(b^2)]Cosh[2a/b]),{{a,-1.},{b,1.},{c,1.},{d,0.05}}] gi=
ves
> {a->12.1929,b->9.05339,c->0.33727,d->0.393214}. I know that these are
> coorrect roots because the results of the underlying problem tally wit=
h =
> what
> I expect. I must emphasise that the initial values of a, b, c, and d =
> were a
> product of trial and error. However, when I change inputs to
> T=5;r=0;S={100,100,100,100};w={0.25,0.25,0.25,0.25};delta={0=
,0,0,0};sig={0.4
> ,0.4,0.4,
> 0.4};rho={{1.0,0.5,0.5,0.5},{0.5,1.0,0.5,0.5},{0.5,0.5,1.0,0.5},{0.5=
,0.5,0.5
> ,1.0}} I just can't seem be "lucky" to hit the jackpot initial values.=
My
> main point is how do I get input initial values without relying on tri=
al =
> and
> error, or what is the alternative approach?
> P.S. (I'm aware about the potential confusion that C, and D are likel=
y =
> to
> cause on the system as global variables, I apologise for not using the=
> actual variables used)
>
> Regards
>
> MD Biyana
>
> -----Original Message-----
> From: DrMajorBob [mailto:drmajorbob at bigfoot.com]
> Sent: 24 August 2007 09:46 AM
> To: Biyana, D. (Dugmore); mathgroup at smc.vnet.net
> Subject: Re: [mg80515] Solving Nonlinear Equations
>
> That's not a legal syntax (mismatched brackets, etc.), and if it were,=
=
> you
> didn't give the initial values or the values of m1, m2, m3, and m4, so=
...
> what can we do?
>
> In addition, C and D are system-defined symbols. FindRoot probably use=
s =
> D to
> take derivatives, so you're just asking for trouble with variable name=
s =
> like
> that. I never, never, EVER start one of my own variables with a capita=
l;
> that makes it obvious whose symbol it is.
>
> Bobby
>
> On Fri, 24 Aug 2007 00:56:16 -0500, Biyana, D. (Dugmore)
> <DugmoreB at Nedbank.co.za> wrote:
>
>>
>> I'm using Mathematica V6.0.1 and I have a system of 4 nonlinear =
>> equations
>> which I'm trying to solve using FindRoot:
>> FindRoot[{m1==C-D*Exp[1/(2*B^2)]*Sinh[A/B],
>> m2==C^2+(D^2/2)(Exp[2/B^2]Cosh[2A/B]-1)-2C*D*Exp[1/(2B^2)]*Sinh[A=
/B],
>>
> m3==C^3-3*C^3*D*Exp[1/(2B^2)]*Sinh[A/B],+3*C(D^2/2))*(Exp[2/B^2]Co=
sh[2A/B]-1
>> )+(D^3/4)(3*Exp[1/(2B^2)]Sinh[A/B]-Exp[9/(2B^2)]Sinh[3A/B]),
>>
> m4==C^4-4(C^3)D*Exp[1/(2B^2)]*Sinh[A/B]+3(C*D)^2))*(Exp[2/B^2]Cosh=
[2A/B]-1)+
>>
> (D^3/4)+C*D^3(3*Exp[1/(2B^2)]Sinh[A/B]-Exp[9/(2B^2)]Sinh[3A/B])+(D^4/8=
)(Exp[
>> 8/(B^2)]*Cosh
>>
> [4A/B]-4*Exp[2/(B^2)]Cosh[2A/B]),{{A,initA},{B,initB},{C,initC},{D,ini=
tD}}]
>> I get the message " FindRoot::cvmit : Failed to converge to the =
>> requested
>> accuracy..." which I suspect is a result of initial values of A, B,C,=
>> and D.
>> What trick can one use to get accepatble initial values?
>> MD Biyana
>>
>> ********************
>> Nedbank Limited Reg No 1951/000009/06. The following link displays th=
e
>> names of the Nedbank Board of Directors and Company Secretary.
>> [ http://www.nedbank.co.za/terms/DirectorsNedbank.htm ]
>> This email is confidential and is intended for the addressee only. Th=
e
>> following link will take you to Nedbank's legal notice.
>> [ http://www.nedbank.co.za/terms/EmailDisclaimer.htm ]
>> ********************
>>
>>
>>
>
>
>
-- =
DrMajorBob at bigfoot.com
Prev by Date:
**Bad imports of data files -- extra empty lists showing up?**
Next by Date:
**Re: ParametricPlot3D from 5.2 to 6.0**
Previous by thread:
**Re: Solving Nonlinear Equations**
Next by thread:
**FW: Solving Nonlinear Equations**
| |