Ask Your Question

glee2's profile - activity

2024-03-13 10:13:36 +0200 received badge  Notable Question (source)
2024-03-13 10:13:36 +0200 received badge  Famous Question (source)
2020-05-29 18:03:59 +0200 received badge  Popular Question (source)
2020-04-23 09:44:11 +0200 received badge  Student (source)
2019-11-19 02:56:34 +0200 received badge  Popular Question (source)
2019-07-18 14:44:22 +0200 received badge  Famous Question (source)
2016-12-23 15:04:53 +0200 received badge  Notable Question (source)
2016-11-25 19:22:37 +0200 received badge  Popular Question (source)
2016-06-22 19:59:37 +0200 received badge  Popular Question (source)
2012-08-14 06:24:22 +0200 asked a question plotting 5,8,16,24,120 and 600-cells

How would one go about plotting these shapes in sage? I think it's using polytopes. but I haven't found ones for 16-cell and 120-cell.

Also is this correct?

5-cell = n_simplex(4)

8-cell = n_cube(4)

24-cell = twenty_four_cell

600-cell = six_hundred_cell

2012-08-06 11:49:11 +0200 asked a question Interact: getting a slider to change its range

How would I get a slider to change its range when the stuff in the input box before it is changed?

Making two interacts somehow doesn't seem to work...

2012-07-30 17:36:15 +0200 commented question canvas3d: displaying labels on axes and more

Actually, nevermind- I've solved the error but I still don't know about the axes... is there a way to put labels?

2012-07-30 10:03:21 +0200 asked a question canvas3d: displaying labels on axes and more

Is there a way to show the labels and numbers on the axes when plotting wireframe polygons in canvas3d? (so that the display is more like Jmol) So far I've managed the axes to be shown but there are no labels and there is no benefit from displaying it.

Also, I'm trying to make sage print the coordinates of the vertices of the selected facet... this code displays "'_PolytopeFace' object is not callable" error. I need sage to print the coordinates so that I can use this to plot tiny spheres at the vertices (as canvas3d doesn't allow you to print points...). Is there a more efficient way of going about it?

Thank you


P = LatticePolytope([[1,2,3,4],[5,2,5,6],[2,2,5,2],[-3,-2,-5,-1],[-2,-2,-2,-1]])
from sage.geometry.polyhedron.plot import ProjectionFuncStereographic
r=7
facets = P.faces()[3]

@interact 

def _(theta_one = slider(0,2*pi,pi/20, default = pi/4, label="theta_one"), 
      theta_two = slider(0,2*pi,pi/20, default = pi/4, label="theta_two"),
      phi = slider(0,2*pi,pi/20, default = pi/4, label="phi"),
      u = slider(0, P.nfacets()-1, step_size=1, default=None, label="Nominate a facet")): 
          a=r*sin(theta_one)*sin(theta_two)*cos(phi)
          b=r*sin(theta_one)*sin(theta_two)*sin(phi)
          c=r*sin(theta_one)*cos(theta_two)
          d=r*cos(theta_one)

          proj = ProjectionFuncStereographic([a,b,c,d])
          projected_vertices = [proj(v) for v in P.vertices().columns()]


          faces = P.faces()[2]
          faces_as_vertex_lists = [[projected_vertices[n] for n in face.traverse_boundary()] for face in faces]
          scene = Graphics()
          for vert_list in faces_as_vertex_lists:
              scene = scene + polygon3d(vert_list, color='blue')

          scene.show(viewer='canvas3d', axes=True, )


          ff = facets[u]
          print ff

          selected_v = [ff(i) for i in projected_vertices]
          print selected_v
2012-07-26 12:31:49 +0200 asked a question using interact and canvas 3d

Hi, I'm not sure what I'm doing wrong but my code doesn't seem to be working. I have no errors when I run this code but the input box doesn't appear at all...


P = LatticePolytope([[1,2,3,4],[5,2,5,6],[2,2,5,2],[-3,-2,-5,-1],[-2,-2,-2,-1]])
from sage.geometry.polyhedron.plot import ProjectionFuncStereographic
r=7
@interact 
def _(theta_one = slider(0,2*pi,pi/20, default = pi/4, label="theta_one"), 
      theta_two = slider(0,2*pi,pi/20, default = pi/4, label="theta_two"),
      phi = slider(0,2*pi,pi/20, default = pi/4, label="phi")): 
          a=r*sin(theta_one)*sin(theta_two)*cos(phi)
          b=r*sin(theta_one)*sin(theta_two)*sin(phi)
          c=r*sin(theta_one)*cos(theta_two)
          d=r*cos(theta_one)

          proj = ProjectionFuncStereographic([a,b,c,d])
          projected_vertices = [proj(v) for v in P.vertices().columns()]
          faces = P.faces()[2]

          faces_as_vertex_lists = [[projected_vertices[n] for n in face.traverse_boundary()] for face in faces]
          scene = Graphics()
          for vert_list in faces_as_vertex_lists:
              scene = scene + polygon3d(vert_list, color='blue')

          scene.show(viewer='canvas3d', axes=True)

def highlight_facet(facet_index = input_box(x, label="facet index")):
      facet_index = P.facets()[x]
      if facet_index == False:
          print "this facet does not exist"
      if facet_index == True:
          V = [projected_vertices(n) for n in facet_index]
          print V
2012-07-24 14:38:36 +0200 asked a question 3D graphics bug-revised

EDIT: updated the code because I am silly and I accidentally posted a wrong one... sorry about unnecessary posting! I am new to AskSage.....

When I use the following code and I change the values of phi or theta, the previous red dot(point of projection) remains on the image and the new dot is added onto the image, giving two red dots. If I repeatedly change the values then more red dots appear. This problem does not occur if I get rid of the polygon inside the sphere. I'm not sure why this is happening...


Z = Polyhedron([[2,3,3],[3,0,3],[2,6,1],[1,0,1],[6,7,2]]) Z_set_as_graphics = Z.show() S = sphere(size=10,color="yellow",opacity=0.5) north_pole = point3d((0,0,10), color="blue") r = 10 @interact def _(theta = slider(0,2pi,pi/20, default = pi/3, label="theta"), phi = slider(0,2pi,pi/20, default = pi/4, label="phi")): point_of_projection = point3d((rsin(theta)cos(phi),rsin(theta)sin(phi),r*cos(theta)), color="red")

      show(Z_set_as_graphics + S + north_pole + point_of_projection)
2012-07-24 14:25:13 +0200 commented question 3D graphics bug?

Z = Polyhedron([[2,3,3],[3,0,3],[2,6,1],[1,0,1],[6,7,2]]) Z_set_as_graphics = Z.show() S = sphere(size=10,color="yellow",opacity=0.5) north_pole = point3d((0,0,10), color="blue") r = 10 @interact def _(theta = slider(0,2*pi,pi/20, default = pi/3, label="theta"), phi = slider(0,2*pi,pi/20, default = pi/4, label="phi")): point_of_projection = point3d((r*sin(theta)*cos(phi),r*sin(theta)*sin(phi),r*cos(theta)), color="red") show(Z_set_as_graphics + S + north_pole + point_of_projection)

2012-07-24 14:25:07 +0200 commented question 3D graphics bug?

sorry! here's the code:

2012-07-24 14:04:56 +0200 asked a question 3D graphics bug?

Hi,

When I use the following code and I change the values of phi or theta, the previous red dot(point of projection) remains on the image and the new dot is added onto the image, giving two red dots. If I repeatedly change the values then more red dots appear. This problem does not occur if I get rid of the polygon inside the sphere. I'm not sure why this is happening...


Works:

S = sphere(size=10,color="yellow",opacity=0.5)
north_pole = point3d((0,0,10), color="blue")
r = 10
@interact
def _(theta = slider(0,2*pi,pi/20, default = pi/3, label="theta"),
      phi = slider(0,2*pi,pi/20, default = pi/4, label="phi")):
          point_of_projection = point3d((r*sin(theta)*cos(phi),r*sin(theta)*sin(phi),r*cos(theta)), color="red")
          show(S + north_pole + point_of_projection)

Doesn't work:

Z = Polyhedron([[2,3,3],[3,0,3],[2,6,1],[1,0,1],[6,7,2]]) 
Z_set_as_graphics = Z.show() 
S = sphere(size=10,color="yellow",opacity=0.5) 
north_pole = point3d((0,0,10), color="blue") 
r = 10 
@interact 
def _(theta = slider(0,2*pi,pi/20, default = pi/3, label="theta"), phi = slider(0,2*pi,pi/20, default = pi/4, label="phi")): 
    point_of_projection = point3d((r*sin(theta)*cos(phi),r*sin(theta)*sin(phi),r*cos(theta)), color="red")
    show(Z_set_as_graphics + S + north_pole + point_of_projection)