Ask Your Question

Bill's profile - activity

2023-06-01 20:42:45 +0200 received badge  Notable Question (source)
2023-06-01 20:42:45 +0200 received badge  Popular Question (source)
2021-02-12 20:53:47 +0200 received badge  Famous Question (source)
2019-10-26 13:28:19 +0200 received badge  Notable Question (source)
2019-02-10 18:44:21 +0200 received badge  Good Question (source)
2017-10-09 15:52:35 +0200 received badge  Popular Question (source)
2017-06-13 18:55:30 +0200 received badge  Notable Question (source)
2016-11-15 23:12:47 +0200 received badge  Good Question (source)
2016-03-20 02:45:46 +0200 received badge  Notable Question (source)
2016-01-17 14:10:14 +0200 received badge  Famous Question (source)
2015-09-08 20:04:20 +0200 received badge  Nice Question (source)
2015-09-08 20:03:20 +0200 received badge  Popular Question (source)
2015-01-14 14:55:12 +0200 received badge  Self-Learner (source)
2015-01-14 14:55:12 +0200 received badge  Teacher (source)
2014-12-10 08:47:19 +0200 received badge  Taxonomist
2014-06-29 20:45:21 +0200 received badge  Popular Question (source)
2014-06-29 20:45:21 +0200 received badge  Notable Question (source)
2014-06-29 03:14:58 +0200 marked best answer Can sage tweet?

How can I tell sage to make a twitter post?

2014-06-29 03:14:56 +0200 marked best answer read from serial port

I'm trying to get sagemath to read from my USB port which has an arduino attached to it. The arduino is throwing a bunch of text to the serial port with address /dev/ttyUSB0

A preliminary Google search reveals that there is a python library pySerial which is designed to do just this. Can I make sagemath recognize this library somehow?

Thanks!

2014-06-29 03:14:56 +0200 marked best answer specify resolution of saved graphic

I can save a graphic I have created as a svg using the following command:

p.save('/home/so10b.svg')

However, my particular graphic is saved as a 39.5MB file, which is too large for my graphic editor to handle well. Saving as .ps creates a 20.4MB file.

In the end, I want a .png, but with particular printed dimensions and resolution. So:

What command will allow me to save a graphic in raster format with specific dimensions and resolution?

2014-06-29 03:14:24 +0200 marked best answer How to populate face_list without using show()?

Is there a way to populate the face_list attribute of the result of parametric_plot3d without showing the plot itself? I am running a script to generate a lot of these surfaces, and I am not interested in closing the jmol window for each surface.

Thanks!

2013-08-30 18:49:25 +0200 received badge  Notable Question (source)
2013-07-06 16:12:26 +0200 received badge  Popular Question (source)
2013-06-08 16:24:38 +0200 commented question Error intersecting polyhedra

Perhaps it is because these polyhedra are degenerate?

2013-06-08 16:22:26 +0200 commented question Error intersecting polyhedra

OK. So, I've lost that original code which produced this error. However, I have noticed some new strange behavior when intersecting polyhedra and can give you specifics: a = Polyhedron([[1.0, 0.0, -0.7071067812], [0.5, -0.5, 0.0]]) b = Polyhedron([[-0.5,-0.5,0.0]]) c = Polyhedron([[0.0, -1.0, 0.7071067812], [0.5, -0.5, 0.0], [-0.5, -0.5, 0.0]]). a & b is empty, while (a & b) & c is 0-dimensional.

2013-06-06 21:50:29 +0200 commented question Error intersecting polyhedra

Right. Sorry. Each poly[i] is a polyhedron defined as a convex hull on some of the points from b.

2013-06-06 21:40:15 +0200 commented question Error intersecting polyhedra

@kcrisman OK. I included a definition of b. It's a dictionary containing the coordinates of the barycentric subdivision of a 3-simplex.

2013-06-06 21:39:25 +0200 received badge  Editor (source)
2013-06-06 17:13:30 +0200 asked a question Error intersecting polyhedra

I have a dictionary of polyhedra which I want to consider various intersections and unions of. For now, my dictionary has four polyhedra in it. When running the following for loop:

v={} # contains coordinates of the tetrahedron, centered at (0,0,0)
v[1] = vector([1,0,-1/sqrt(2)])
v[2] = vector([-1,0,-1/sqrt(2)])
v[3] = vector([0,1,1/sqrt(2)])
v[4] = vector([0,-1,1/sqrt(2)])

V = {1,2,3,4}

b={} # will contain coordinates of vertices of the subdivision of the tetrahedron

for X in powerset(V):
  q = len(X)
  if q > 0:
    b[tuple(X)] = (1/q)*sum([v[i] for i in X])

poly_int = Polyhedron([b[key] for key in b.keys()]) # this is a tetrahedron containing
# all of my polyhedra
for i in [1,2,3,4]:
  poly_int = poly[i] & poly_int

I get a very nasty error:

AttributeError: 'Polyhedra_RDF_cdd_with_category.element_class'
object has no attribute '_Vrepresentation'

(The traceback for the error is quite long. I can include it if needed.)

Manually computing

poly[1] & poly[2] & poly[3] & poly[4]

gives the same error. HOWEVER, if instead I compute

(poly[1] & poly[2]) & (poly[3] & poly[4])

I get no errors. While this is a fine workaround for this particular case, I'm scripting these intersections and need some way to actually compute these intersections automatically. Using something like

poly[1].intersection(poly[2]) # etc.

doesn't help either. Any thoughts?

2012-10-31 13:43:15 +0200 received badge  Popular Question (source)
2012-04-09 22:57:46 +0200 asked a question What do these messages after a crash indicate?

I was recently running a script I wrote to triangulate a polygon, and after a few hours sage crashed. I was left with the following messages:

/usr/local/bin/sage/local/bin/sage-sage: line 301: 20880 Killed                  sage-cleaner &>/dev/null
/usr/local/bin/sage/local/bin/sage-sage: line 301: 20881 Killed                  sage-ipython "$@" -i

What happened? What do these messages indicate?

2012-04-05 14:29:07 +0200 commented answer How to triangulate polygon with sage?

I will look at that algorithm. Thanks.

2012-04-05 11:41:30 +0200 commented answer How to triangulate polygon with sage?

Thanks for the suggestion. Unfortunately, I am working in a setting where taking the convex hull of the vertices of my polygon is not what I want to do. (My polygons have holes in them.)

2012-04-05 01:56:02 +0200 asked a question How to triangulate polygon with sage?

If I feed sage a list of vertices, then the polygon() function can create a 2D polygon determined by visiting these edges in order (with self-intersections, repeated edges, holes, etc.).

Does sage have a built-in method to triangulate the resulting polygon? (It appears to me as though this is not the case.)

If not, I would love to see your homemade code to do this.

2012-03-28 12:31:21 +0200 marked best answer How to populate face_list without using show()?

I figured it out. The .triangulate() function does exactly this.

2012-03-27 13:43:00 +0200 received badge  Nice Question (source)
2012-03-27 12:34:13 +0200 marked best answer Variable parameter range in parametric_plot3d?

Try this:

someTriangle = parametric_plot3d(t*(1-s)*v + s*w, (t,0,1), (s,0,1))

In general, if you want t to be in the interval [a(s), b(s)], just use t' = a(s) + t*(b(s) - a(s)) and let t range from 0 to 1. For example, to graph the function f(s,t) = 1 for s in [0,1] and t in [s^2, s]:

sage: var('s,t')
(s, t)
sage: parametric_plot3d([s,(s^2 + t*(s - s^2)),1], (t,0,1), (s,0,1))

image description

And here's a more complicated example:

sage: var('s,t,x,y')
(s, t, x, y)
sage: f = sin(x)*cos(y)
sage: tprime = s^2 + t*(s - s^2)

The rectangular plot:

sage: parametric_plot3d([s,t,f(x=s,y=t)], (t,0,1), (s,0,1))

image description

Change coordinates to plot only a part of the t range:

sage: parametric_plot3d([s,tprime,f(x=s,y=tprime)], (t,0,1), (s,0,1))

image description

2012-03-27 12:34:09 +0200 commented answer Variable parameter range in parametric_plot3d?

Thanks, Niles. I'm kicking myself now.

2012-03-26 23:20:20 +0200 asked a question Variable parameter range in parametric_plot3d?

Is it possible to give parametric_plot3d parameter ranges where one parameter is a function of the other? For example, I would like the following command to execute and create a plot of a triangle in $\mathbb{R}^3$.

v = some vector
w = some other vector
someTriangle = parametric_plot3d(t*v + s*w, (t,0,1-s), (s,0,1))

Thanks!