How to solve this non-linear system of equations? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: How to solve this non-linear system of equations? (/thread-1770.html) |
How to solve this non-linear system of equations? - alexzkter - 07-02-2014 01:44 PM Making O3=x and O4=y Code: 0.84=0.3606cos(45)+0.3824cos(x)+0.3912cos(y) I want the results to be in the interval [0º 360º] for obvious reasons or even [-360º 360º] Tried 3 times: 1st time with no interval, 2nd and 3rd time with same interval but different results, the last try ignored the interval. So I keep pressing enter and it keeps showing different results. Take a look: How can I directly get proper (possitive) angle values for my system ? The condition should be something like... x<y AND x>0 AND y<360 RE: How to solve this non-linear system of equations? - slawek39 - 07-02-2014 03:59 PM Use Advanced Graphing to fint initial solution. Then use the applet Solve to find the exact solution. RE: How to solve this non-linear system of equations? - parisse - 07-02-2014 05:15 PM You can not use conditions for multivariate systems with approx coefficients, you can only give an initial guess, and if it is not far from a solution, fsolve will return a solution up to machine precision. Your solution does not seem to work by the way: fsolve([eq1,eq2],[x,y],[11.3,302.5]) returns [-3.39546756307,313.410392968] (with degree mode) RE: How to solve this non-linear system of equations? - slawek39 - 07-02-2014 05:42 PM Software Version (6030) solve({0.84 = (0.3606*cos(45)+0.3824*cos(x)+0.3912*cos(y)),0 = (0.3606*sin(45)+0.3824*sin(x)+0.3912*sin(y))},{x,y},{0..12,-100..0}) and fsolve({0.84 = (0.3606*cos(45)+0.3824*cos(x)+0.3912*cos(y)),0 = (0.3606*sin(45)+0.3824*sin(x)+0.3912*sin(y))},{x,y},{0..12,-100..0}) restart the calculator and emulator in degree mode. RE: How to solve this non-linear system of equations? - alexzkter - 07-02-2014 05:54 PM Quote:Use Advanced Graphing to fint initial solution.I didn't know how to use that App. I always plot functions inside the Solve app, but it didn't let me plot several equations at the same time, lol. Thanks. (07-02-2014 05:15 PM)parisse Wrote: You can not use conditions for multivariate systems with approx coefficients, you can only give an initial guess, and if it is not far from a solution, fsolve will return a solution up to machine precision. Your solution does not seem to work by the way: So if coeficients were integer numbers I'd be able to use conditions for multivariable systems? Interesting. I just typed in fsolve([eq1,eq2],[x,y],[11.3,302.5]) and it returned [11.316938475 302.475831894] which was the answer I was looking for ,but if I first have to plot the system, then it could be faster if I just Trace-found intersections on Advanced Graphing. Anyway, thanks guys you helped me a lot. RE: How to solve this non-linear system of equations? - alexzkter - 07-02-2014 05:58 PM (07-02-2014 05:42 PM)slawek39 Wrote: Software Version (6030) Why {0..12,-100..0} ? I was looking for positive only solutions between 0-360 There are several ways to do this, but never on 1 step only procedure unless you have a drawing on which you can rely on, like I wanted to do so. RE: How to solve this non-linear system of equations? - parisse - 07-02-2014 06:54 PM For exact data *and* polynomial system, you can find all solutions in theory, therefore conditions on variables *could* be checked. For everything else, there is no hope. The best I can imagine is to compute a grid of points in a given product of intervals, find the smallest in absolute value and start an iterative algorithm with this guess. This is really something everyone should understand before using fsolve/solve and so. Sorry, no blackbox here... |