Ask Your Question

ortollj's profile - activity

2024-04-23 06:40:28 +0200 commented question Is there a SageMath version of Mathematica's '//' shorthand?

Hi f(x)=x^2+1 g(x)=x^2 + x^3 - 31 f(g(x)) But I'm probably missing something here, maybe you could give the function

2024-04-21 13:14:02 +0200 commented question Jupyter finds python kernel but can't find Sage kernel.

which OS ? I ask this question because I encountered this problem with W11 WSL Ubuntu22.04 returning from Windows 11 s

2024-04-21 13:08:42 +0200 commented question Jupyter finds python kernel but can't find Sage kernel.

which OS ?

2024-03-28 12:48:15 +0200 commented answer How to determine there is a k-path between two vertices

As I did not know the difference between walk and path I searched the web and find this link: https://www.quora.com/W

2024-03-28 12:47:47 +0200 commented answer How to determine there is a k-path between two vertices

As I did not know the difference between walk and path I searched the web and find this link: https://www.quora.com/W

2024-03-25 06:58:19 +0200 received badge  Popular Question (source)
2024-03-23 19:06:04 +0200 commented question Resizing the table font to fit into the page

why there is 10 values in the first line and 9 in other lines ? except this it is ok for me in Jupyter notebook.it fit i

2024-03-23 19:04:19 +0200 commented question Resizing the table font to fit into the page

why there is 10 values in the first line and 9 in other lines ? except this it is ok for me in Jupyter notebook.

2024-03-23 19:02:44 +0200 commented question Resizing the table font to fit into the page

why there is 10 values in the first line and 9 in other lines ?

2024-03-17 10:25:07 +0200 commented answer How to see the source code of the function distance_graph

Oops !! sorry. Thank you @rburing.

2024-03-17 10:23:50 +0200 marked best answer running code twice generate error

Hi

W11 ,WSL ,Ubuntu 22.04.4 LTS,SageMath 10.2 (same PB with 10.0) In Jupyter notebook

When I run this code twice (first time is ok) , I get the error about the matrix : TypeError: no canonical coercion from Polyhedra in QQ^3 to Symbolic Ring (I need to reset SageMath kernel to run again without error)

But on sageCell I can run this code many times without getting error. So 3 questions :

Q1 : is there a SageMath kernel reset every time before SageCell code is executed ?

Q2 : Do you see something wrong I do in this code ?

Q3 : If no Q2 , is this the same problem for you ?

# functions
def polyhedronCentroid(vertices):
    # vertices: List of tuples (x, y, z,...) representing the polyhedron vertices dim could be >3
    num_vertices = len(vertices)
    centroid = [sum(coord[i] for coord in vertices) / num_vertices for i in range(len(vertices[0]))]
    return centroid

def translateStructure(structDic,pt):
    newDic={}
    for k in structDic.keys() :
        newDic[k]=list( vector(structDic.get(k))+vector(pt) )       
    return newDic

def rotateStructure(structDic,angleRot,axisRot,sameCenter) :
    global rotX,rotY,rotZ

    if axisRot=='x' : # rotation around x axis
        rotM=matrix( QQ,rotX.subs(t_x=angleRot ) )
    elif axisRot=='y' : # rotation around y axis
        rotM=matrix( QQ,rotY.subs(t_y=angleRot ) )    
    elif axisRot=='z' : # rotation around z axis
        rotM=matrix( QQ, rotZ.subs(t_z=angleRot ) )    
    else :
        print('something wrong for axis rotation')
        return cubeDic

    show('rotM : ',rotM)
    newTDic={}
    for k in structDic.keys() :
        newTDic[k]=list(rotM*vector(list(structDic.get(k))))
    if sameCenter :
        centerV=vector(polyhedronCentroid(list(structDic.values())))
        translatePt=list(vector(centerV-(rotM*centerV)))# reset center at old structure location
        newTDic=translateStructure(newTDic,translatePt)
    else :
        return(newTDic)
    #show('newDic : ' ,newDic) 
    #show('newTDic : ',newTDic)    
    return newTDic

def addAxis(plt,textToPlt,xBound,yBound,zBound,wA,rA) :
    # add axis for real part
    plt += arrow3d((0, 0, 0), (xBound, 0, 0), color='violet',width=wA,radius=rA)
    plt += text3d("ex", (xBound, 0, 0), fontsize='200%', color='violet')
    plt += arrow3d((0, 0, 0), (0, yBound, 0), color='gray',width=wA,radius=rA)
    plt += text3d("ey", (0, yBound, 0), fontsize='200%', color='gray')
    plt += arrow3d((0, 0, 0), (0, 0, zBound), color='pink',width=wA,radius=rA)
    plt += text3d("ez", (0,0, zBound), fontsize='200%', color='pink')
    plt+=textToPlt
    return plt


###################################################################################
##################### end functions area ##########################################
var('t_x',latex_name=r"\\teta_{x}")
var('t_y',latex_name=r"\\teta_{y}")
var('t_z',latex_name=r"\\teta_{z}")



rotX=matrix(SR,[[1,0,0],[0,cos(t_x),-sin(t_x)],[0,sin(t_x),cos(t_x)]])
rotY=matrix(SR,[[cos(t_y),0,sin(t_y)],[0,1,0],[-sin(t_y),0,cos(t_y)]])
rotZ=matrix(SR,[[cos(t_z),-sin(t_z),0],[sin(t_z),cos(t_z),0],[0,0,1]])

xBound=1.5 ;yBound=1.5 ;zBound=1.5
shiftV=vector([1/10,1/10,1/10])
width=0.2 ;radius=0.02


cubeAdic={0: [0, 0, 0], 1: [1, 0, 0], 2: [1, 1, 0], 3: [0, 1, 0] , \
          4: [0, 0, 1], 5: [1, 0, 1], 6: [1, 1, 1], 7: [0, 1, 1]}
cubeArevDic=dict(zip([str(cubeAdic.get(k)) for k in cubeAdic.keys()],[k for k in cubeAdic.keys()]))

cubeAsimplex3=[[0, 4, 5, 7], [0, 1, 2, 6], [0, 1, 5, 6], [0, 2, 3, 7], [0, 5, 6, 7], [0, 2, 6, 7]]

tetraHedron=cubeAsimplex3[0]
tetraHedronDic={}
for vertice in tetraHedron :
    tetraHedronDic[vertice]=cubeAdic.get(vertice)

axisRot='z'
locationXYZ=[0,0,1]
angleRot=pi/2
structureDic=rotateStructure(tetraHedronDic,angleRot,axisRot,False)  

textToPlt = text3d("AB",vector( (xBound, yBound, 1.5*zBound))+shiftV, fontsize='300%', fontweight=800)


print( 'tetraHedronDic.values : ',list(tetraHedronDic.values()) )
pi=Polyhedron(list(tetraHedronDic.values()) , base_ring=QQ)
print( 'structureDic.values : ',list(structureDic.values()) )
po=Polyhedron(list(structureDic.values()), base_ring=QQ)
plt=addAxis(Graphics(),textToPlt,xBound,yBound,zBound+1,width,radius)
plt+=pi.plot(color='black',opacity=0.5)
plt+=po.plot(color='red',opacity=0.5)
plt.show()
2024-03-17 10:23:38 +0200 commented answer running code twice generate error

Oops sorry !! Thank you @rburing.

2024-03-17 09:57:24 +0200 commented question running code twice generate error

same pb in JupyterLab

2024-03-17 07:52:59 +0200 edited question running code twice generate error

running code twice generate error Hi W11 ,WSL ,Ubuntu 22.04.4 LTS,SageMath 10.2 (same PB with 10.0) In Jupyter notebook

2024-03-17 07:51:32 +0200 asked a question running code twice generate error

running code twice generate error Hi W11 ,WSL ,Ubuntu 22.04.4 LTS,SageMath 10.2 (same PB with 10.0) When I run this co

2024-03-14 19:23:48 +0200 commented answer ring pb with Polyhedron

yes, it’s simpler!

2024-03-14 12:50:05 +0200 marked best answer ring pb with Polyhedron

Hi

why is an error generated if I comment the line:

#lNew=[[0, 0, 0], [0, -1, 0], [1, -1, 0], [0, -1, 1]]

in the code below:

var('t_x',latex_name=r"\\teta_{x}")

Adic={0: [0, 0, 0], 1: [1, 0, 0], 2: [1, 1, 0], 3: [0, 1, 0] , 
          4: [0, 0, 1], 5: [1, 0, 1], 6: [1, 1, 1], 7: [0, 1, 1]}

tetraHedron=[0, 4, 5, 7]
tetraHedronDic={}
for vertice in tetraHedron :
    tetraHedronDic[vertice]=Adic.get(vertice)

angleRot=pi/2
rotX=matrix(SR,[[1,0,0],[0,cos(t_x),-sin(t_x)],[0,sin(t_x),cos(t_x)]])
newDic={}
for k in tetraHedronDic.keys() :
    newDic[k]=list((rotX.subs(t_x=angleRot)*vector(tetraHedronDic.get(k))))

pOld=Polyhedron([tetraHedronDic.get(k) for k in tetraHedronDic.keys() ])
print('pOld vertices: ',pOld.integral_points())

lNew=[newDic.get(k) for k in newDic.keys() ]
print('lNew : ',lNew)
#lNew=[[0, 0, 0], [0, -1, 0], [1, -1, 0], [0, -1, 1]]
print('lNew : ',lNew)
pNew=Polyhedron(lNew)
print('pNew vertices : ',pNew.integral_points())
2024-03-14 12:50:00 +0200 commented answer ring pb with Polyhedron

Thank you @Max Alekseyev

2024-03-14 10:42:46 +0200 asked a question ring pb with Polyhedron

ring pb with Polyhedron Hi why is an error generated if I comment the line: #lNew=[[0, 0, 0], [0, -1, 0], [1, -1, 0],

2024-03-10 10:01:28 +0200 received badge  Notable Question (source)
2024-02-27 09:01:32 +0200 edited answer how display labels edges and color with dictionary? ​

I did this little workaround: def g3dPlot(g,colorsDic) : plt=Graphics() locationDic=g.get_pos(dim=3) fo

2024-02-27 08:53:10 +0200 answered a question how display labels edges and color with dictionary? ​

I did this little workaround: def g3dPlot(g,colorsDic) : plt=Graphics() locationDic=g.get_pos(dim=3) fo

2024-02-27 06:04:34 +0200 commented question how display labels edges and color with dictionary? ​

It seems that plot3d is not able to display the labels . newLabels=[] for e in g.edges(sort=True) : ec=list(copy(e)

2024-02-26 13:08:37 +0200 asked a question how display labels edges and color with dictionary? ​

how display labels edges and color with dictionary? ​ Hi How can I label edges style :edge (0,1) ='01' and give the

2024-02-13 17:41:57 +0200 commented question How to make ubuntu launch jupyter(sage) in windows browser?

look here maybe it could help ? : best-and-easy-way-to-install-sagemath-in-w11

2024-02-11 20:11:23 +0200 received badge  Notable Question (source)
2024-02-11 20:11:23 +0200 received badge  Famous Question (source)
2024-02-06 07:55:05 +0200 received badge  Famous Question (source)
2024-01-29 19:12:07 +0200 received badge  Notable Question (source)
2023-11-05 02:58:53 +0200 received badge  Famous Question (source)
2023-10-23 10:27:11 +0200 received badge  Famous Question (source)
2023-10-23 10:27:11 +0200 received badge  Notable Question (source)
2023-10-22 18:55:18 +0200 received badge  Famous Question (source)
2023-10-06 22:56:40 +0200 received badge  Famous Question (source)
2023-10-05 18:20:21 +0200 received badge  Famous Question (source)
2023-10-05 18:20:21 +0200 received badge  Notable Question (source)
2023-09-18 08:49:10 +0200 commented question How to plot the real line in SageMath

I ask myself if you are trolling, if not, look here: plotting tutorial.

2023-09-17 19:33:50 +0200 commented answer How to plot the real line in SageMath

do you want plot in 3D ?,2D ?

2023-09-17 19:31:23 +0200 edited answer How to plot the real line in SageMath

Hi @Garald I propose something like that first, because as @Emmanuel Charpentier points out, your request is not very c

2023-09-17 19:27:33 +0200 answered a question How to plot the real line in SageMath

Hi @Garald I propose something like that first, because as @Emmanuel Charpentier points out, your request is not very c

2023-09-06 08:16:39 +0200 received badge  Notable Question (source)
2023-09-03 19:05:20 +0200 commented answer graph plot: size of arrow heads

yes indeed @dsejas, it works very well to adjust the sizes of the arrows for the graphs.

2023-08-31 19:31:30 +0200 commented question graph plot: size of arrow heads

maybe look at this graph below and try to change width and radius, tell us if it is what you want or not: graph with a

2023-08-31 16:54:59 +0200 commented question graph plot: size of arrow heads

oops maybe I'm off topic, and these arrows are integrated into a special graph, sorry if that's the case.;-(

2023-08-31 16:53:43 +0200 commented question graph plot: size of arrow heads

oops maybe I'm off topic, and these are arrows integrated into a special graph, sorry if that's the case.;-(

2023-08-31 16:49:45 +0200 commented question graph plot: size of arrow heads

maybe look at this graph below and try to change width and radius, tell us if it is what you want or not: graph with a

2023-08-31 16:45:09 +0200 commented question graph plot: size of arrow heads

maybe look at this graph below and try to change width and radius, tell us if it is what you want or not: graph with a