Ask Your Question
1

complex numbers and paramétric numbers

asked 2021-11-23 15:27:58 +0100

ErWinz gravatar image

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")
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2021-11-23 19:06:52 +0100

ErWinz gravatar image

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)]
edit flag offensive delete link more

Comments

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-11-23 15:27:58 +0100

Seen: 806 times

Last updated: Nov 23 '21