Jump to content



Photo
- - - - -

Non-linear Equations


  • Please log in to reply
17 replies to this topic

#1 Behnoud

Behnoud

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 338 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    CP 300+ OS2.2/
    FX 3600 pv/
    FX 115 s/
    FX 602P

Posted 22 May 2006 - 05:29 PM

How can I solve a non-linear Equation system?
I khow it is possible for a TI to solve it! :angry:
But what about a CP? :unsure:
I entered equations as below:
solve({x+x*y=5,x^2+y=2},{x,y})
Thanks for your kind attention. :bow:

#2 Daniel (CZE)

Daniel (CZE)

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Milevsko - Czech Republic
  • Interests:Support for Pocket Viewer and ClassPad for Czech Republic.

  • Calculators:
    ClassPad 300, TI-92 Plus, FX-6300G, CFX-9850GB Plus

Posted 22 May 2006 - 08:42 PM

As far as I know ClassPad with OS 2.2 can't solve non-linear equation system with solve() function. You must split calculation to several steps to get result.

#3 Behnoud

Behnoud

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 338 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    CP 300+ OS2.2/
    FX 3600 pv/
    FX 115 s/
    FX 602P

Posted 23 May 2006 - 05:27 PM

How? :(
It's not clear for me! :huh:
Do u mean it needs programming?

#4 R00KIE

R00KIE

    Casio Freak

  • Members
  • PipPipPipPip
  • 155 posts
  • Location:Portugal
  • Interests:Electronics, games, programming

  • Calculators:
    HP49G ROM 1.24; CASIO CFX-9850GB PLUS;CASIO FX-6300G; CASIO FX-82TL

Posted 23 May 2006 - 06:00 PM

My HP49 couldn't solve it and mathematica gave a really long solution,are you sure the TIs can solve this particular one?

#5 unique33

unique33

    Casio Freak

  • Possibly hacked
  • PipPipPipPip
  • 229 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    classpad 300 , fx5500

Posted 23 May 2006 - 06:18 PM

there is no solution in the main application , but you can solve it numerically using LuaNumAn Project written by PAP.

(The Broyden Method , I posted a related problem and the solution on the Engineering Applications Topic)

#6 Daniel (CZE)

Daniel (CZE)

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Milevsko - Czech Republic
  • Interests:Support for Pocket Viewer and ClassPad for Czech Republic.

  • Calculators:
    ClassPad 300, TI-92 Plus, FX-6300G, CFX-9850GB Plus

Posted 23 May 2006 - 06:57 PM

How?
It's not clear for me!
Do u mean it needs programming?


No. :)

You must extract first variable from first equation using solve() then use it in second equation (with | command) and find all results manualy (as you write on paper).

I tried to solve this system but in one part CP didn't return exact expression but approximation only. :( So I don't if this is usable for you.

solve(x^2+y=2,y)
							  {y=-x^2+2}

solve(x+x*y=5,x)|ans[1]
							  {x=-5/(x^2-3)}

solve(x=-5/(x^2-3),x)
// CP can't solve this. We must edit the expression.

solve(x(x^2-3)=-5,x)
							  {x=-2.279018786}
I'll find same problem even if I start with second equation. :huh:

And sorry for my english. I'm not from English-speaking country

#7 TacoFred

TacoFred

    Casio Freak

  • Members
  • PipPipPipPip
  • 145 posts
  • Location:NJ
  • Interests:I LOVE STARCRAFT BROODWAR<br />MUHAHAHAHAHAHAHAHAHAHAHA

  • Calculators:
    cfx 9850gb+, fx 115MS, ClassPad 300, TI-89 Titanium

Posted 23 May 2006 - 10:28 PM

If you really have to solve nonlinear systems of equations, and you have time, you can just do it by hand...simplest way unless you can make the CP do it (which it doesn't without modifications, but by that time, you can just do it by hand).

#8 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 25 May 2006 - 08:05 AM

How can I solve a non-linear Equation system?
I khow it is possible for a TI to solve it! :angry:
But what about a CP? :unsure:
I entered equations as below:
solve({x+x*y=5,x^2+y=2},{x,y})
Thanks for your kind attention. :bow:

A quick solution:
require("table","LuaNumAn/Broyden")
local function F(x)
return {x[1]+x[1]*x[2]-5,x[1]^2+x[2]-2}
end
local function J(x)
return{{1+x[2],x[1]},{2*x[1],1}}
end
root=Broyden({-1,0},F,J,5E-16)
table.foreach(root,print)
You get {-2.27901878616659,-3.19392662770025}, accurate to at least 15 decimal digits. See LuaNumAn's documentation for details B).

#9 DrCoyote

DrCoyote

    Casio Freak

  • Members
  • PipPipPipPip
  • 156 posts
  • Gender:Male
  • Location:Cleveland, Ohio USA

  • Calculators:
    CFX-9850GB PLUS, FX-9860G, TI 92+, TI89 Titanium, TI-Nspire, TI-Nspire CAS, TI 84+ SE, HP 50G, HP 35S, Elektronika MK-90, Elektronika MK-52, Elektronika MK-61, Elektronika B3-21, Elektronika MK-152, Elektronika MK-161, Sharp EL-9900

Posted 25 May 2006 - 01:03 PM

My HP49 couldn't solve it and mathematica gave a really long solution,are you sure the TIs can solve this particular one?


My TI-92 Plus gives x = -2.27901878617, y = -3.1939266277. So yes, the TI calculators can solve it.

#10 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 25 May 2006 - 03:33 PM

A quick solution:

require("table","LuaNumAn/Broyden")
local function F(x)
return {x[1]+x[1]*x[2]-5,x[1]^2+x[2]-2}
end
local function J(x)
return{{1+x[2],x[1]},{2*x[1],1}}
end
root=Broyden({-1,0},F,J,5E-16)
table.foreach(root,print)
You get {-2.27901878616659,-3.19392662770025}, accurate to at least 15 decimal digits. See LuaNumAn's documentation for details B).

I don't remember having said that require() now accepts several arguments. But since you use it, that means you know it. :lol: Glad to see it's useful.
Btw, I noticed that you often use the "table" package only for the foreach() function. You could have the same result with
for key,value in pairs(root) do print(key,value) end
The pairs() function does not require any extra package ;)

And again, this is another proof of the utility of CPLua and LuaNumAn ^_^

#11 R00KIE

R00KIE

    Casio Freak

  • Members
  • PipPipPipPip
  • 155 posts
  • Location:Portugal
  • Interests:Electronics, games, programming

  • Calculators:
    HP49G ROM 1.24; CASIO CFX-9850GB PLUS;CASIO FX-6300G; CASIO FX-82TL

Posted 25 May 2006 - 05:35 PM

i was looking for an EXACT solution not an aproximation, the HP can't solve it as a system directly because it can't factor the expression, but if i use the same method used to solve it on the classpad i get not one but three solutions
{x=1.14+.946i , x=1.14-.946i , x=-2.279} and {y=1.597-2.157i , y=1.597+2.157i , y=-3.194}, these are the rounded results (obviously).
we must use the calc together with our heads not appart. anyway, this system gives a third order system, that can still be solved exactly but calcs don't have it implemented.

#12 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 25 May 2006 - 07:26 PM

There is no such thing as an exact solution here, you may only find some good approximations for it :huh:

#13 Guest_Anonimo_*

Guest_Anonimo_*
  • Guests

Posted 25 May 2006 - 10:12 PM

My HP49 couldn't solve it and mathematica gave a really long solution,are you sure the TIs can solve this particular one?


MMmmmm....the program name is Solvesys. For the hp 49g. Find hpcalc.org

#14 Behnoud

Behnoud

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 338 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    CP 300+ OS2.2/
    FX 3600 pv/
    FX 115 s/
    FX 602P

Posted 26 May 2006 - 08:25 AM

I found an eActivity for systems on classpad.org. B)
It solved the equations system which I post.

#15 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 26 May 2006 - 11:41 PM

I don't remember having said that require() now accepts several arguments. But since you use it, that means you know it. :lol: Glad to see it's useful.

Oh, yes, you did ;).

Btw, I noticed that you often use the "table" package only for the foreach() function. You could have the same result with

for key,value in pairs(root) do print(key,value) end
The pairs() function does not require any extra package ;)

I know this solution, but it doesn't make the program shorter, and I usually want to print a table more than once in a program. But if the "table" package uses a lot of memory, your solution is definitely better.

#16 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 26 May 2006 - 11:59 PM

i was looking for an EXACT solution not an aproximation, the HP can't solve it as a system directly because it can't factor the expression, but if i use the same method used to solve it on the classpad i get not one but three solutions
{x=1.14+.946i , x=1.14-.946i , x=-2.279} and {y=1.597-2.157i , y=1.597+2.157i , y=-3.194}, these are the rounded results (obviously).

First, I want to ask something: What do you mean by "i use the same method used to solve it on the classpad"? As far as I know the only way to solve nonlinear systems in ClassPad is to use the "Broyden" function, included in my LuaNumAn package. Don't tell me that you have translated it for the HP :blink:? You probably mean something else...
About the solutions you have find: Indeed, there are also complex conjugate solutions, but LuaNumAn can't handle complex numbers... yet. The main problem with complex arithmetics is that Lua doesn't support complex numbers directly. I could probably use the "cas" package to overpass this problem, but I'm afraid that it will be slow, since I will need to use plenty of CAS commands within a Lua program (even a simple addition will need the CAS, or a Lua script for adding complex numbers :cry:). Implementing a complicated numerical method this way will be a real nightmare. For the moment, LuaNumAn contains numerical methods for real -not complex- numbers.

anyway, this system gives a third order system, that can still be solved exactly but calcs don't have it implemented.

Incorrect. In most cases, nonlinear systems cannot be solved "exactly" by any CAS system, simply because there is no exact solution, or because there is an exact solution, but it is very complicated and useless. This is when Numerical Analysis is involved. Nonlinear systems can be solved "exactly" only in very special (simple) cases. Their numerical solution is not an easy task as well: numerical methods for nonlinear systems are not easy.
In general, if you seek for "exact" solutions in real problems, you will dissapointed. But I understand, most programmers, novice to Numerical Analysis, always seek for "exact" solutions, even if there is no such a thing.

Btw, the TI probably solves this system numerically, using a numerical method which is, quite probably, a version of Broyden's method, similar to the corresponding implementation I have included in LuaNumAn.

#17 R00KIE

R00KIE

    Casio Freak

  • Members
  • PipPipPipPip
  • 155 posts
  • Location:Portugal
  • Interests:Electronics, games, programming

  • Calculators:
    HP49G ROM 1.24; CASIO CFX-9850GB PLUS;CASIO FX-6300G; CASIO FX-82TL

Posted 29 May 2006 - 05:11 PM

When i said "i use the same method used to solve it on the classpad" i meant i used the same method "Daniel (CZE)" used.
"Incorrect. In most cases, nonlinear systems cannot be solved "exactly" by any CAS system", i guess you should take a look at the cardano method to solve third order systems at http://mathworld.wol...bicFormula.html
also i wasn't trying in any way to say anything bad about LuaNumAn.
you are right to say that in the real world exact solutions are worthless, but it's still a good exercise to know if it is possible or not to find them and why.
my point is, you should have a math background even when solving linear or nonlinear problems with a calculator or pc, so you can at least see if the result is coherent.

#18 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 30 May 2006 - 01:13 PM

When i said "i use the same method used to solve it on the classpad" i meant i used the same method "Daniel (CZE)" used.

Ok. I guessed that you used some method, but you didn't specified which one.

i guess you should take a look at the cardano method to solve third order systems at http://mathworld.wol...bicFormula.html

No offence, but this is not correct. The web page you mentioned does not describe a way to solve third order nonlinear systems. It describes a way to solve general cubic equations, which is a completely different thing. Cardano's method involves some nonlinear systems, but they are only special cases, not an arbitrarily complex nonlinear system. I insist: there is no general method to solve nonlinear systems analytically, including third order systems; only special nonlinear systems can be solved exactly, and this is the exception, not the rule.

also i wasn't trying in any way to say anything bad about LuaNumAn.

I know that, it was obvious that you didn't wanted to be offensive.

my point is, you should have a math background even when solving linear or nonlinear problems with a calculator or pc, so you can at least see if the result is coherent.

I absolutely agree. We use calculators to perform addition, but we should know how to add numbers anyway. We use numerical methods to solve a complicated problem, but we should at least know what exactly we solve, and how. I never said that one must use numerical methods blindly.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users