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>"))
T=table([["f",f],["grad f=",grad(F)[:]],["H=",H]],frame=True,align='center')
show(T)
# calcul des points critiques
Cr= solve([grad(f)[0]==0,grad(f)[1]==0],[x,y],solution_dict=True)
#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")