MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Finding unknown parameters using Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74766] Re: Finding unknown parameters using Mathematica
  • From: Daniel Huber <dh at metrohm.ch>
  • Date: Wed, 4 Apr 2007 04:06:58 -0400 (EDT)
  • References: <461390240200000B002AF1AB@its-gw-inet57.its.rmit.edu.au>

Hi Shafiq,
If L has no value, your code can not work. Consider: D[L,b1]==0. If L 
has no value the drivative will be zero and the statement gives True.
To make a list from 0.1..1: Table[x,{x,0.1,1,0.1}]
To calculate an expression (LMN) for different sets of parameters we 
make an example: Assume that pars={a,b} are the parameters and vals are 
a list of different sets of values: vals={{0,0},{0,1},{1,1}} and expr= b 
a^2 is the expression you wish to evaluate for different sets of 
parameters.. We then create a list of rules:
rules= MapThread[Rule,{pars,#}]&/@valsset
and applies the rules to expr: expr /. rules. This gives a list of 
values of expr for different values of the parameters.
To make a 3D Plot we need a rectangular array of height (expr) values. 
We can get automatically this if we replace in the foregoing the values 
of  vars by an rectangular arra, e.g.: 
vars={{{0,0},{0,1}},{{1,0},{1,1}}. The foregoing procedure then returns 
an arry of values of expr, e.g.: {{0,0},{0,1}}. This is what ListPlot3D 
or ListContourPlot wants as input.
Daniel


Shafiq Ahmad wrote:
> 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.
>>
>>     
>
>
>
>   


-- 

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.ch>
Internet:<http://www.metrohm.ch>



  • Prev by Date: Re: Finding unknown parameters using Mathematica
  • Next by Date: Re: Series and order
  • Previous by thread: Re: Finding unknown parameters using Mathematica
  • Next by thread: Re: Finding unknown parameters using Mathematica