Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

interfaces of SageMaths

hi

as i can not use SageMaths with jupyter (my other post) i am searching something else

here : link text

it is written :

Pour utiliser ce script, votre répertoire SAGE_ROOT doit apparaître dans la variable d’environnement PATH.

i see how to modify $PATH within the temrinal but what is SAGE_ROOT

in the same page i have typed SAGE_ROOT in the "quick research" field but it gave no result

my aim is to run a python/sage script like this one :

#!/usr/bin/env sage

import sys
from sage.all import *


f(x,y)=(-x)/(1+y)+2*x
show(html("<h4>*************</h4>"))    

# 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=[]
for critique in Cr:
    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)])        
show(html("<h5>points critiques</h5>"))
if (len(liste)!=0):
    show(table(liste))
else :
    show("pas de points critiques")

# graphique
h(x,y,z)=f(x,y)-z
implicit_plot3d(h, (x, -1,4), (y, -4, 4), (z, -4, 3),color="green",adaptive=True,mesh=True,region=lambda x,y,z: y<=-1.1 or y>=-0.96)