[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: limiting the range of solutions with fsolve
From: |
Sergei Steshenko |
Subject: |
Re: limiting the range of solutions with fsolve |
Date: |
Wed, 31 Oct 2012 13:40:27 -0700 (PDT) |
----- Original Message -----
> From: wwwups <address@hidden>
> To: address@hidden
> Cc:
> Sent: Wednesday, October 31, 2012 9:29 PM
> Subject: limiting the range of solutions with fsolve
>
> All,
>
> I am a bit of a newbie to Octave, and have been using it to solve sets of
> (highly) non-linear equations with 2 or 3 variables. I know that all three
> variables (x1, x2, x3) lie within -1 to 1. How can I limit the solutions to
> this range?
>
> Thanks!
>
>
>
It is not an Octave question, it's a general math question.
You need to solve
F(x1, x2, x3) = 0;
Convert your task to solving
F(f(X1), f(X2), f(X3)) = 0;
and choose the 'f' function such that
f(+Inf) == 1
f(-Inf) == -1
.
Then, having found a solution in terms of unconstrained X1, X2, X3 get back to
your original variables:
x1 = f(X1);
x2 = f(X2);
x3 = f(X3);
.
A trivial choice for 'f' is for you case is:
f(X) = 2 * atan(X) / pi
.
Regards,
Sergei.