0

How I can solve these five non-liner equations

where n=3, x=1,3,8 (e.g), and a,b,c, Alpha and Beta should be estimated.

x = {1, 3, 8}; n = Length[x]; eqn1 = n*D[Beta[a, b], a]/Beta[a, b] - 
alpha*c*Sum[x[[i]]^(-beta), {i, 1, n}] == 0;  eqn2 = Sum[Log[1 - Exp[-alpha*c*x[[i]]^(-beta)]], {i, 1, n}] - n*D[Beta[a, b], b]/Beta[a, b] == 0; eqn3 = n/c - alpha*a*Sum[x[[i]]^(-beta), {i, 1, n}] + alpha*(b - 1)*Sum[(x[[i]]^(-beta)*Exp[alpha*c*x[[i]]^(-beta)])/(1 - Exp[-alpha*c*x[[i]]^(-beta)]), {i, 1, n}] == 0; eqn4 = n/alpha - c*a*Sum[x[[i]]^(-beta), {i, 1, n}] + c*(b - 1)*Sum[(x[[i]]^(-beta)*Exp[-alpha*c*x[[i]]^(-beta)])/(1 - Exp[-alpha*c*x[[i]]^(-beta)]), {i, 1, n}] == 0; eqn5 = n/beta - Sum[Log[x[[i]]], {i, 1, n}] + alpha*a*c*Sum[Log[x]*x[[i]]^(-beta), {i, 1, n}] + alpha*beta*c*(b - 1)*Sum[(x[[i]]^(-beta)*Exp[-alpha*c*x[[i]]^(-beta)])/(1 - Exp[-alpha*c*x[[i]]^(-beta)]), {i, 1, n}] == 0; FindRoot[{eqn1, eqn2, eqn3, eqn4, eqn5}, {{a, 0.1}, {b, 0.1}, {c, 0.1}, {alpha, 0.1}, {beta, 0.1}}]

This is not working, and not sure {a,0.1} etc 0.1 is the initial value.

SAAN
  • 617
  • 6
  • 15
  • Is this a Mathematica question or is it more about mathematics? What have you tried so far? You should at least demonstrate that you already put some effort into solving the Problem. It helps to give some working code snippets, others can built upon. – Markus Roellig Jun 21 '13 at 11:05
  • actually i am new in Mathematica, but i am sure there is must a method to handle this problem. – SAAN Jun 21 '13 at 11:18
  • Then a good starting point would be: http://mathematica.stackexchange.com/questions/18/where-can-i-find-examples-of-good-mathematica-programming-practice – Sektor Jun 21 '13 at 11:25
  • Nikola: I just want what should be the basic function to solve this problem. – SAAN Jun 21 '13 at 11:38
  • Maybe have a look at this : http://reference.wolfram.com/mathematica/ref/Solve.html – Emy Jun 21 '13 at 11:43
  • @Azeem I know what you meant, it's just that I think you will use Mathematica more than once judging by the question you posted, so it will be useful to start learning the language :); – Sektor Jun 21 '13 at 11:45
  • 1
    @Emy Solve can't solve that system :) But, generally speaking, yes that's what you will use Azeem when you need to solve a system of equations :) – Sektor Jun 21 '13 at 11:47
  • @NikolaDimitrov Ah well, I tried. :P – Emy Jun 21 '13 at 12:04
  • Is this a differential equation? A Differentio-Algebraic Equation? What is B[a,b]? – Eric Brown Jun 21 '13 at 12:08
  • @Eric It is simple beta function Beta[a,b] – SAAN Jun 21 '13 at 12:10
  • @Azeem Thanks, that helps a lot. I think this is a job for FindRoot. – Eric Brown Jun 21 '13 at 12:12
  • @Eric they are not differential equation nor Differentio-Algebraic Equation. You can say them system of equations. These equations must be solved through simulation best of my knowledge. I need a program which simulate the values of a,b,c Alpha and Beta and give such values of these parameters for which all these five equations are approximately zero. – SAAN Jun 21 '13 at 12:16
  • @Azeem Right, I think you want to find the root. Maybe FindRoot? – Eric Brown Jun 21 '13 at 12:19
  • @Eric yes a,b,c, Alpha and Beta are the roots of these equations. but please keep in mind we have distinct value of x, not any interval domain. – SAAN Jun 21 '13 at 12:23
  • @Azeem Did you try FindRoot with, e.g. x={1,3,8}; n=Length[x]; Sum[x[[i]]^(-beta), {i,1,n}] ? – Eric Brown Jun 21 '13 at 12:25
  • @Eric I try, but FindRoot need to specify the value of {a,a0}, {b,b0} etc. but i cant assume a0, b0 etc. – SAAN Jun 21 '13 at 12:38
  • @Azeem That's the "nature of the beast." You would have to supply starting values for this nonlinear problem. I was able to set up FindRoot with your system, but I ran out of memory for n > 1. Sorry, I won't be able to help any further (if this was help at all). – Eric Brown Jun 21 '13 at 13:00
  • @Azeem -- let us see the attempts you have made to solve this using FindRoot. Edit the code into the question, and we can try and help you get it working. – bill s Jun 21 '13 at 13:00
  • @ bill s I edit my question according you. – SAAN Jun 21 '13 at 13:29
  • @EricBrown What are the specs of your system ? – Sektor Jun 21 '13 at 13:39
  • @NikolaDimitrov 8 gigs of RAM, os x 10.8.4, mma 9.0.1. I don't know exactly what the issue was, but I worked around it by using N[eqns]. – Eric Brown Jun 21 '13 at 13:40
  • eqn5 is not entered correctly because it is a list of three equations rather than one. You need to fix this: also, when you get an error, tell us what the message is because it can point you to the right place. – bill s Jun 21 '13 at 13:51
  • @ bill s The error is (:FindRoot::nveq: "The number of equations does not match the number of variables in FindRoot[{eqn1,eqn2,eqn3,eqn4,eqn5},{{a,0.1},{b,0.1},{c,0.1},{alpha,0.1},{beta,0.1}}]":). eqn5 has three sums, it is ok. – SAAN Jun 21 '13 at 14:05
  • @ bill s May be it consider x and n as a variables. – SAAN Jun 21 '13 at 14:06
  • @azeem -- the message is telling you that eqn5 is not written properly. Indeed, you can see that eqn5 is actually a list of 3 equations. Hence: you believe you have 5 equations and 5 unknowns but you really have 8 equations and 5 unknowns. So you need to fix equation 5. – bill s Jun 21 '13 at 14:50
  • @ bill s please see the following link, where actual equations are written,( http://www.4shared.com/download/_x5P-1YO/nonlinear_equations.bmp?tsid=20130621-150937-82bd4900 ) in eqn4 there is list of two equation (that is the point you mention as error) – SAAN Jun 21 '13 at 15:10
  • @Azeem could you revert this to your formatted math, and double check my work? Thanks – Eric Brown Jun 21 '13 at 16:54
  • Thank you all, specially Eric Brown. – SAAN Jun 21 '13 at 17:17

1 Answers1

5

With the help of the formulae that you posted, I came up with:

x = {1, 3, 8};
n = Length[x];

eqns = Simplify[
{
  n D[Beta[a, b], a]/Beta[a, b] + alpha c Sum[x[[i]]^(-beta), {i, 1, n}],
  Sum[Log[1 - Exp[-alpha c x[[i]]^(-beta)]], {i, 1, n}] - n D[Beta[a, b], b]/Beta[a, b],
n/c - alpha a Sum[x[[i]]^(-beta), {i, 1, n}] + alpha (b - 1) Sum[(
    x[[i]]^(-beta) Exp[-alpha c x[[i]]^(-beta)])/(
    1 - Exp[-alpha c x[[i]]^(-beta)]), {i, 1, n}],
n/alpha - alpha c Sum[x[[i]]^(-beta), {i, 1, n}] + 
c (b - 1) Sum[(x[[i]]^(-beta) Exp[-alpha c x[[i]]^(-beta)])/(
    1 - Exp[-alpha c x[[i]]^(-beta)]), {i, 1, n}],
n/beta - Sum[ Log[x[[i]]], {i, 1, n}] + 
  alpha a c Sum[x[[i]]^(-beta), {i, 1, n}] + 
  alpha beta c (b - 1)  Sum[(
    x[[i]]^(-beta - 1) Exp[-alpha c x[[i]]^(-beta)])/(
    1 - Exp[-alpha c x[[i]]^(-beta)]), {i, 1, n}]
}
];


soln=FindRoot[
 eqns
 , {{a, 0.1}, {b, 0.1}, {c, 0.1}, {alpha, 0.1}, {beta, 0.1}}]

which returns

 {a -> 0.74093, b -> 0.571156, c -> 3.38077, alpha -> 0.74093, 
  beta -> 1.90692}

Then you can verify the solution:

 eqns /. soln

which should return a list with five "essentially zeros".

  {9.47241*10^-7,-0.0000120965,-2.58065*10^-7,-1.17752*10^-6,-1.86303*10^-6}

(If you omit the "==0" parts of the definition of the equations (eqns), Mathematica will assume that you mean "==0" for purposes of FindRoot. )

Eric Brown
  • 4,406
  • 1
  • 18
  • 36
  • ...and if someone could point me in a direction that gives advice on how to format these monster-sized expressions... – Eric Brown Jun 21 '13 at 16:43