Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can you help with a powerful Sage code to solve the system in N-R method or other numerical methods ?

I want to approximate the zeros of the following nonlinear system using Newton-Raphson process/ any other method. F(x,y)=x+y323+x3532+y3733+x31034=0, G(x,y)=y+x333+y3532+x3833+y31034=0.


For the following easier system f(x,y)=x+y222+x2522+y2723=0, g(x,y)=y+x232+y2522+x2823=0, we can use the initial guess (1,1), and checked that the N-R process converges at 8th iteration.


IR = RealField(150)

var('x,y');

f = x + y^4/2 + x^32/4 + y^128/8

g = y + x^4/2 + y^32/4 + x^256/8

a, b = IR(-1), IR(-1)

J = matrix(2, 2, [diff(f, x), diff(f, y), diff(g, x), diff(g, y)])

v = vector(IR, 2, [IR(a), IR(b)])

for k in range(9):

a, b = v[0], v[1]
fv, gv = f.subs({x : a, y : b}), g.subs({x : a, y : b})
print(f'x{k} = {a}\ny{k} = {b}')
print(f'f(x{k}, y{k}) = {fv}\ng(x{k}, y{k}) = {gv}\n')
v = v - J.subs({x : a, y : b}).inverse() * vector(IR, 2, [fv, gv])

That is all about the code.

Unfortunately the same code seems to be inefficient to solve the above system

F(x,y)=0, G(x,y)=0.

It seems this system is associated with higher degrees.

I think this code needs to be modified.

Can you help with a powerful Sage code to solve the system in N-R method or other numerical methods ?

click to hide/show revision 2
None

updated 3 years ago

dan_fulea gravatar image

Can you help with a powerful Sage code to solve the system in N-R method or other numerical methods ?

I want to approximate the zeros of the following nonlinear system using Newton-Raphson process/ any other method. F(x,y)=x+y323+x3532+y3733+x31034=0, G(x,y)=y+x333+y3532+x3833+y31034=0.


For the following easier system f(x,y)=x+y222+x2522+y2723=0, g(x,y)=y+x232+y2522+x2823=0, we can use the initial guess (1,1), and checked that the N-R process converges at 8th iteration.


IR = RealField(150)

var('x,y');

RealField(150) var('x,y'); f = x + y^4/2 + x^32/4 + y^128/8

y^128/8 g = y + x^4/2 + y^32/4 + x^256/8

x^256/8 a, b = IR(-1), IR(-1)

IR(-1) J = matrix(2, 2, [diff(f, x), diff(f, y), diff(g, x), diff(g, y)])

y)]) v = vector(IR, 2, [IR(a), IR(b)])

IR(b)]) for k in range(9):

range(9):

    a, b = v[0], v[1]
 fv, gv = f.subs({x : a, y : b}), g.subs({x : a, y : b})
 print(f'x{k} = {a}\ny{k} = {b}')
 print(f'f(x{k}, y{k}) = {fv}\ng(x{k}, y{k}) = {gv}\n')
 v = v - J.subs({x : a, y : b}).inverse() * vector(IR, 2, [fv, gv])

That is all about the code.

Unfortunately the same code seems to be inefficient to solve the above system

$$F(x,y)=0,$$ $$G(x,y)=0.$$

It seems this system is associated with higher degrees.

I think this code needs to be modified.

Can you help with a powerful Sage code to solve the system in N-R method or other numerical methods ?