Solving exponential equations for maxent with opensource applications or coding

314 Views Asked by At

I am working on maximum entropy. And I have a problem solving some equations.

Look at these 2 equations:

$\frac{(2*e^{-a*2-b*2^2}) +(6*e^{-a*6-b*6^2}) +(10*e^{-a*10-b*10^2}) +(14*e^{-a*14-b*14^2})}{(e^{-a*2-b*2^2})+(e^{-a*6-b*6^2})+(e^{-a*10-b*10^2})+(e^{-a*14-b*14^2})} = 5.77 $

$\frac{(4*e^{-a*2-b*2^2}) +(36*e^{-a*6-b*6^2}) +(100*e^{-a*10-b*10^2}) +(196*e^{-a*14-b*14^2})}{ (e^{-a*2-b*2^2})+(e^{-a*6-b*6^2})+(e^{-a*10-b*10^2})+(e^{-a*14-b*14^2})} = 45.48 $

I need advice for solving for a and b. There are 2 equation and 2 unknown variables $\{a,b\}$

These equations can be 3 or 4 in number, and unknown variables also be 3 or 4 in number.

And that coefficient $(2,6,10,14)$ can increase to $2,6,10,14,...,n$ or $1,3,5,7,...,n$

My real problem is solving equations and I am in need of ideas to solve them. I tried Matlab and solved them but I need to create that algorithm or using some open source solutions.

You can look here ; http://mathbin.net/175372

1

There are 1 best solutions below

0
On

This can be solved because there is 2 unknown var and 2 equations. It is exponantial but it can be solved.

I tried to use octave (http://www.gnu.org/software/octave/) octave -q filename.math

and filename.math seems like;

function y = f (x)

       y = zeros (2, 1);

    y(1) = ((0.1*exp(-0.1*x(1)-0.1^2*x(2)))  +(0.3*exp(-0.3*x(1)-0.3^2*x(2)))  +(0.5*exp(-0.5*x(1)-0.5^2*x(2)))  +(0.7*exp(-0.7*x(1)-0.7^2*x(2)))  +(0.9*exp(-0.9*x(1)-0.9^2*x(2)))  )/((exp(-0.1*x(1)-0.1^2*x(2)))+(exp(-0.3*x(1)-0.3^2*x(2)))+(exp(-0.5*x(1)-0.5^2*x(2)))+(exp(-0.7*x(1)-0.7^2*x(2)))+(exp(-0.9*x(1)-0.9^2*x(2))))-0.471287128713;

    y(2) = ((0.01*exp(-0.1*x(1)-0.1^2*x(2)))  +(0.09*exp(-0.3*x(1)-0.3^2*x(2)))  +(0.25*exp(-0.5*x(1)-0.5^2*x(2)))  +(0.49*exp(-0.7*x(1)-0.7^2*x(2)))  +(0.81*exp(-0.9*x(1)-0.9^2*x(2)))  )/((exp(-0.1*x(1)-0.1^2*x(2)))+(exp(-0.3*x(1)-0.3^2*x(2)))+(exp(-0.5*x(1)-0.5^2*x(2)))+(exp(-0.7*x(1)-0.7^2*x(2)))+(exp(-0.9*x(1)-0.9^2*x(2))))-0.307722772277; 

endfunction

  [x] = fsolve (@f, [0; 1])

I am not sure about selecting root for solving. I am not sure fsolve has a good solver but i have one solution at least.