Hi, everyone
I am try to solve the eqation with IDL, non linear equation.
and I use the broyden ,now I have a question.
the code is below:
function test2, x
return, [ 500 / (1+X[0] * EXP(-1*X[1])) - 3, $
500 / (1+X[0] * EXP(-2*X[1])) - 13]
end
FUNCTION test, X
return, [0.3 * X[0] / (!pi *(1-0.3 * X[1])) + X[2] - 121.362, $
0.4 * X[0] / (!pi * (1-0.4 * X[1])) + X[2] - 156.77, $
0.5 * X[0] / (!pi * (1-0.5 * X[1])) + X[2] - 193.081]
END
XX = [2.0,4.0]
result2 = BROYDEN(XX, 'test2')
prompt: % BROYDEN: singular Jacobian in broydn.
X = [1000.0, 0.0, 21.0]
result = BROYDEN(X, 'test')
this could be ok to get the right value.
while
X = [100.0, 0.0, 21.0]
result = BROYDEN(X, 'test')
it prompt me that % BROYDEN: singular Jacobian in broydn.
in the idl help, it said
;Provide an initial guess as the algorithm's starting point:
how to get the proper initial guess??
or any other function could solve the non linear equation??
FUNCTION broyfunc, X
RETURN, [3.0 * X[0] - COS(X[1]*X[2]) - 0.5,$
X[0]^2 - 81.0*(X[1] + 0.1)^2 + SIN(X[2]) + 1.06,$
EXP(-X[0]*X[1]) + 20.0 * X[2] + (10.0*!PI - 3.0)/3.0]
END
;Provide an initial guess as the algorithm's starting point:
X = [-1.0, 1.0, 2.0]
;Compute the solution:
result = BROYDEN(X, 'BROYFUNC')
;Print the result:
PRINT, result
thank you in advance
|