[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Unable to write algebraic equations in correct Oct. syntax

**From**: |
Ivan Sutoris |

**Subject**: |
Re: Unable to write algebraic equations in correct Oct. syntax |

**Date**: |
Wed, 7 Jan 2009 18:10:17 +0100 |

2009/1/7 Gene Partlow <address@hidden>:
>* Hi all...*
>
>* I am having terrible trouble forming correct Octave syntax. I am*
>* sending this to you in hopes that someone might help me with re-*
>* phrasing rather standard nonlinear algebraic equations into a form*
>* suitable for the online Octave solver website at*
>
>* http://www.online-utility.org/math/math_calculator.jsp*
>
>* [Yes... I know that many of you would urge that I get hold of the new*
>* Octave 3.0.3 instead of using the old on-line site... but regardless,*
>* when I try to put the equations in 0 = f(x,y,v) form, whatever I do*
>* results in "errors".]*
Hi
Indeed, I would recommend you to download regular Octave installation
:) Anyway, I think what you are looking for is function "fsolve",
which takes two arguments: first, a function "f", which for given
vector of variables X returns vector of deviations from your
equalities (so you need to rewrite your equations in f(X)==0 form),
and a starting vector X0.
For example, to solve system
x^2 + y^2 == 1
y == x^2
f could be written like this:
function y = f(u)
%first equation
y(1) = u(1)^2 + u(2)^2 - 1;
%second equation
y(2) = u(1)^2 - u(2);
endfunction
and solution would be obtained by
u0 = [2,2];
sol = fsolve("f", u0)
It is important that f has only one input vector, which includes all
your variables (so in the example above, x becomes u(1), y becomes
u(2)).
Regards
Ivan Sutoris