Solving equation sets in Mathematica

451 views
Skip to first unread message

nandan jha

unread,
Jun 26, 2009, 11:44:36 AM6/26/09
to sympy
Hello

I am trying to solve a set of non-linear equations in Mathematica 7.0
and every time it shows a error message :
"FindRoot::jsing: Encountered a singular Jacobian at the point
{B1,B2,B3,Ea1,Ea2,Ea3} =
{31.501,0.9004,38.5013,-1000.1,-1000.01,-2000.1}. Try perturbing the
initial point(s). >> ".

Sometimes it also shows this error message: "FindRoot::lstol: The line
search decreased the step size to within tolerance specified by
AccuracyGoal and PrecisionGoal but was unable to find a sufficient
decrease in the merit function. You may need more than
MachinePrecision digits of working precision to meet these tolerances.
>>" .

The equations that I am trying to solve are:
------------------------------------------------------------------------------------------------------------------------------------------------------------------
FindRoot[{Exp[B1 + Ea1*0.000374526] + Exp[B2 + Ea2*0.000374526] +
Exp[B3 + Ea3*0.000374526] == 0.0183,
Exp[B1 + Ea1*0.00037925] + Exp[B2 + Ea2*0.00037925] +
Exp[B3 + Ea3*0.00037925] == 0.00995,
Exp[B1 + Ea1*0.00038287] + Exp[B2 + Ea2*0.00038287] +
Exp[B3 + Ea3*0.00038287] == 0.0075,
Exp[2*B1 + 2*Ea1*0.000374526] + Exp[2*B2 + 2*Ea2*0.000374526] +
Exp[2*B3 + 2*Ea3*0.000374526] +
2*Exp[B1 + B2 + (Ea1 + Ea2)*0.000374526] +
2*Exp[B2 + B3 + (Ea3 + Ea2)*0.000374526] -
2*Exp[B1 + B3 + (Ea1 + Ea3)*0.000374526] == 0.01784*0.01784,
Exp[2*B1 + 2*Ea1*0.00037925] + Exp[2*B2 + 2*Ea2*0.00037925] +
Exp[2*B3 + 2*Ea3*0.00037925] +
2*Exp[B1 + B2 + (Ea1 + Ea2)*0.00037925] +
2*Exp[B2 + B3 + (Ea3 + Ea2)*0.00037925] -
2*Exp[B1 + B3 + (Ea1 + Ea3)*0.00037925] == 0.00983*0.00983,
Exp[2*B1 + 2*Ea1*0.00038287] + Exp[2*B2 + 2*Ea2*0.00038287] +
Exp[2*B3 + 2*Ea3*0.00038287] +
2*Exp[B1 + B2 + (Ea1 + Ea2)*0.00038287] +
2*Exp[B2 + B3 + (Ea3 + Ea2)*0.00038287] -
2*Exp[B1 + B3 + (Ea1 + Ea3)*0.00038287] == 0.00742*0.00742}, {B1,
40.001}, {B2, 110.9004}, {B3,
47.001309}, {Ea1, -1000.1}, {Ea2, -1000.01}, {Ea3, -2000.1},
MaxIterations -> Infinity, AccuracyGoal -> Infinity]
-------------------------------------------------------------------------------------------------------------------------------------------------------------

Can someone tell me if this can be solved in sympy and shouldn't the
Mathematica itself change the initial value and do a computation to
get the answer.

Thanks for any help in advance.
Nandan

Alan Bromborsky

unread,
Jun 26, 2009, 12:43:05 PM6/26/09
to sy...@googlegroups.com
You might want to look at the root finders in scipy.

Luke

unread,
Jun 26, 2009, 1:21:14 PM6/26/09
to sympy
I would recommend looking at scipy.optimize.fsolve(), as Alan
suggested. If you have a decent initial guess, it should work.
~Luke

smichr

unread,
Jun 27, 2009, 3:49:39 AM6/27/09
to sympy
>
> Can someone tell me if this can be solved in sympy and shouldn't the
> Mathematica itself change the initial value and do a computation to
> get the answer.

This equation set has the same form as the previous one you posted.
Although there are 6 unknkowns and although you may find 6 values to
satisfy the equations, it seems to me that this equation set is
insufficient to determine those values and I think that's why you are
getting the singular matrix error.

/c

Vinzent Steinberg

unread,
Jun 27, 2009, 7:55:45 AM6/27/09
to sympy
^^^^^^^^
I'm not familiar with Mathematica, but does this mean you want
infinite accuracy? This seems hard to achieve. :)

> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Can someone tell me if this can be solved in sympy

In sympy use nsolve(), but this uses simply Newton's method and
requires a very good starting point (so rather try scipy). Mathematica
is more advanced I think.

> and shouldn't the
> Mathematica itself change the initial value and do a computation to
> get the answer.

That is sadly not trivial.

Vinzent

nandan jha

unread,
Jun 27, 2009, 10:21:33 AM6/27/09
to sympy
Thanks for the help Vinzent.
I am actually not looking for infinite accuracy but I need some answer
rather then just an error message that Perturb your initial value.
I know it is not trivial but i think Mathematica somehow should have
an option for perturbing the initial point itself.

Thanks again,
Nandan.

On Jun 27, 1:55 pm, Vinzent Steinberg
Reply all
Reply to author
Forward
0 new messages