complex numbers and paramétric numbers

hi

this program works well for me, i want the critical points but only if real

but my condition if(x.imag()!=0) doesnt work properly if x is a "r_something"

and, of cours, a solution like (x,y)=(r12,r37) interests me, i want it to be displayed

but as maybe Sagemath consider r12 and r37 aspossibly being complex, is does not display it

how can i test if a number is a parametric number ?

f(x,y)=(x+y)^2

# calculs généraux
from sage.manifolds.operators import *
E.<x,y> = EuclideanSpace()
F = E.scalar_field(f)
H=f(x,y).hessian()
show(html("<h5>paramètres généraux</h5>"))
show(T)

# calcul des points critiques
#liste=[["x","y","H"]]
liste=[]
for critique in Cr:
show("tttt",critique)
if(x(critique).imag()==0 and y(critique).imag()==0):
liste.append(["(","x=",x(critique),";","y=",y(critique),")",H(critique)])
show(html("<h5>points critiques</h5>"))
if (len(liste)!=0):
show(table(liste))
else :
show("pas de points critiques")

edit retag close merge delete

Sort by » oldest newest most voted

i have endly found, i write it here in case it intersts someone :

for critique in Cr:
show("tttt",critique, H(critique))
#xxx=critique.variables()
xxxx=x(critique).variables()
#    xxxx=critique.right()
show("~~~~",xxxx,len(xxxx))
x_et_y_reels=(x(critique).imag()==0 and y(critique).imag()==0)
x_et_y_avec_parametre=(len(x(critique).variables())>0 or len(y(critique).variables())>0)
if(x_et_y_reels or x_et_y_avec_parametre):
liste.append(["(","x","=",x(critique),";","y","=",y(critique),")",H(critique)]

more

You can accept your answer (click the accept button next to it) to mark the question as solved.

( 2021-11-24 02:00:57 +0100 )edit