Finding unknown parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg75154] Finding unknown parameters
- From: "Shafiq Ahmad" <shafiq.ahmad at rmit.edu.au>
- Date: Wed, 18 Apr 2007 05:11:36 -0400 (EDT)
Hi, Below are the codes to solve the non-linear equations that I could furnished with help of Mr Jeans-Marc. After running the codes, I got this error message (FindRoot::cvmit: "Failed to converge to the requested accuracy or precision \within 100 iterations) when run some real data of sample size 30. I did try to increase # of interations but could not get success. Any one has any clue? ==================================== In[115]:= LMN[r1_, r2_, b1_, b2_, p_] := Module[{n = Length[x1]}, n*Log[p] + n*Log[p + 1] + n*Log[b1] + n*Log[r1] + n*Log[b2] + n*Log[r2] + (b1 - 1)*Sum[Log[x1[[j]]], {j, 1, n}] + (b2 - 1)*Sum[Log[x2[[j]]], {j, 1, n}] - (p + 2)*Sum[Log[1 + r1*x1[[j]]^b1 + r2*x2[[j]]^b2], {j, 1, n}]] x1 = {1.3, 1.33, 1.28, 1.25, 1.29, 1.32, 1.38, 1.24, 1.26, 1.24, 1.25, 1.3, 1.27, 1.3, 1.32, 1.31, 1.3, 1.26, 1.28, 1.31, 1.33, 1.29, 1.3, 1.32, 1.26, 1.3, 1.32, 1.35, 1.32, 1.29} x2 = {1.25, 1.32, 1.25, 1.3, 1.38, 1.32, 1.25, 1.29, 1.32, 1.35, 1.29, 1.33, 1.32, 1.26, 1.3, 1.25, 1.25, 1.29, 1.31, 1.31, 1.27, 1.26, 1.29, 1.31, 1.28, 1.33, 1.27, 1.26, 1.29, 1.32} rr = z_Complex -> {Re[z], Im[z]} sols = Table[Block[{b1, b2, p, Eqn1, Eqn2, Eqn3}, Eqn1 = D[LMN[r1, r2, b1, b2, p], b1] == 0; Eqn2 = D[LMN[r1, r2, b1, b2, p], b2] == 0; Eqn3 = D[LMN[r1, r2, b1, b2, p], p] == 0; Join[{a -> r1, b -> r2}, FindRoot[{Eqn1, Eqn2, Eqn3}, {b1, 10}, {b2, 10}, {p, 10}]]], {r1, 0.001, 1, 0.15}, {r2, 0.001, 1, 0.15}] /. a -> r1 /. b -> r2 pts = LMN[r1, r2, b1, b2, p] /. sols In[121]:= % /. rr ======================================= Regards Shafiq
- Follow-Ups:
- Re: Finding unknown parameters
- From: "Chris Chiasson" <chris@chiasson.name>
- Re: Finding unknown parameters