Re: Finding unknown parameters using Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg74762] Re: Finding unknown parameters using Mathematica
- From: "Shafiq Ahmad" <shafiq.ahmad at rmit.edu.au>
- Date: Wed, 4 Apr 2007 04:04:55 -0400 (EDT)
Hi Danial, Andres Guzmanand and Group members, Thanks indeed for a good response from Danial and Andres. This is my first experience to find such a cooperative group. I did try to solve these non-linear equations doing some modifications. I put 2 parameters r1 and r2 equal to 1 and solved rest of the equations for 3 parameters using FindRoot function (as mentioned by Andres). Below are the codes in the input form. Thanks for Danial to give me good advice and now really easy for every one to understand codes in the input formate. Next I'm trying to make these codes as generalized in the following manner and strongly appreciate if any one can help me in this regard. 1): I need to use a loop function for r1 and r2 values with an increment of 0.1 and range for 0 to 1, it should come up with an array or list of 10 values for b1, b2 and p. I did try it many ways, but mathematica could not accept it. 2): After having values for all 5 parameters (r1,r2,b1,b2 and p), I need to put all these values in the main equation " LMN" to get another list or array for LMN values . Individually I used all parameter values, I got LMN value but mathematica don't accept if I give all values in the form of list or array and do it all one time. 3): After having LMN values, I would like plot a 3D plot or 3D contour plot / surface plot with array / or list values for r1,r2 and LMN. Strongly appreciate if some one can share his/her thoughts. Regards Shafiq =================================================== n = 4 x1 = {1, 2, 3, 4} x2 = {1.7, 3.8, 4.9, 4.6} r1 = 1 r2 = 1 LMN = 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}] Eqn1 = D[L, b1] == 0 Eqn2 = D[L, b2] == 0 Eqn3 = D[L, p] == 0 FindRoot[{Eqn1, Eqn2, Eqn3}, {b1, 10}, {b2, 10}, {p, 10}] ================================================ Regards Shafiq >>> dh <dh at metrohm.ch> 03/04/07 12:36 AM >>> Hi Shafiq. there is something wrong in your code. What should:"=E2=88=91" mean? I think "Sum". Note that it is better if you change your code to InputForm before posting it. This is done by selecting and then menu: Cell/Convert To/InputForm. Further, your set up of the equations is wrong. What you wrote is: Short Form of drivative == explicite Form of derivative (D[L,r1]==...), what shlould give True. Note that the form: D[L,r1] is only used in differential equations. In your case you would write: eqns={ explicite form of derivative == 0, ...} Solve[eqns,vars] Daniel Shafiq Ahmad wrote: > Dear group members, > > I'm very new to mathematica and trying to solve a set of non-linear system = > of equations to find the unknown parameters for a bivariate distribution. = > I've 5 unknown parameters (i.e. b1,b2,r1,r2,p) and 5 set of equations. I = > tried to get the general solution , but could not. I don't know how to = > solve these nonlinear equations to get the unknown parameters. And also = > not aware how to give initial value in the solve function or any other = > function (e.g all parameters b1,b2,r1,r2,p if I give initial boundary = > value =1). > In the below codes, x1 and x2 are 2 variables (e.g. data from 2 quality = > characteristics; stress and strain etc. etc.) > > Any comments / suggestions how to solve these equation for b1,b2,r1,r2,p = > where as putting intial value for all these unknown parameters =1 > > Ahmad S. >