From help-request at octave dot org Sun Feb 6 17:57:01 2005 Subject: Re: two quadratic eq, please help From: Geordie McBain To: shih lin Cc: help at octave dot org Date: Mon, 7 Feb 2005 09:46:54 -0500 On Sun, Feb 06, 2005 at 12:25:18AM -0800, shih lin wrote: > dear octave and math programmers: > > highly appreciate anyone can tell me how (or hint) to use octave to > solve:(12-x)^2 + y^2 =15^2, (16+y)^2+x^2=25^2 (by programming or using its built > in function)? > that ^2 mean square. > looking to any math&programer's help, > eric, fsshl at yahoo dot com Create a function to return the residual: function z = f (x) z = [(12-x(1))^2+x(2)^2-15^2, (16+x(2))^2+x(1)^2-25^2]; endfunction and fsolve it: octave> fsolve ("f", [0, 0]) ans = 1.8887e-15 9.0000e+00 Geordie McBain www.aeromech.usyd.edu.au/~mcbain ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------