## 3D printing of Mathematical Objects!

Back in the fall I did some work on getting hacklab.to‘s 3d-printer to print mathematical objects created in sage. Unfortunately, shortly after I got it to work and printed a test sphere, the 3d printer broke. Thus began a long succession of the makerbot — nicknamed the break-r-bot — being fixed and broken… spending most of its time broken.

But recently it was fixed and I decided to dig out my old code and get to work on it.

(In the interim, someone else ran with it and did some cool work. It’s really neat to see code I wrote get used by someone!)

In any case, here are some initial results:

An implicit plot of $x^2+y^2+z^4=5^4$:

Notice that the bottom was messed up because the overhand was too great, but the top turned out fine.

An implicit plot of the 3-torus (see previous post) $(((x-9/2)^2+(y-1)^2+(z-2)^2+3^2-1^2)^2-4*3^2*((x-9/2)^2+(y-1)^2))*(((x+9/2)^2+(y-1)^2+(z-2)^2+3^2-1^2)^2-4*3^2*((x+9/2)^2+(y-1)^2))*((x^2+(y+6)^2+(z-2)^2+3^2-1^2)^2-4*3^2*(x^2+(y+6)^2))-23000000$:  Once again, a fairly successful print for an object with absurd overhang.

A plot of the real component of the square function (bounded within $[-5,5]^3$; print stopped prematurely when the makerbot crashed).

In conclusion, there is some pretty neat stuff to be done with printing 3d math. I should be able to print some more cool stuff this coming week!

Tags: , , ,

### 7 Responses to “3D printing of Mathematical Objects!”

1. Cross post of 3d Plotting of Mathematical Objects | Tacitcogito's Blog Says:

[…] Posted on August 22, 2010 by Tacit Cogito I thought this was rather interesting Here. This person tries to actually use sage which is a mathematical software application similar to […]

2. George G. Says:

Looking at your implicit equation for a 3-torus makes me feel really stupid: some time ago I tried to derive it, but I failed because it didn’t occure to me to add a constant to smoothen the surface. D’oh!

Btw, what is this ‘sage’? How does it sompare to commercially available math software? Is it just for plotting or for everything? Is it as good as Maple/Mathematica/MatLab?

• christopherolah Says:

> Looking at your implicit equation for a 3-torus makes me feel really stupid: some time ago I tried to derive it, but I failed because it didn’t occure to me to add a constant to smoothen the surface. D’oh!

Yeah. Don’t you hate it when things are so obvious in retrospect?

> Btw, what is this ‘sage’? How does it sompare to commercially available math software? Is it just for plotting or for everything? Is it as good as Maple/Mathematica/MatLab?

Sage is an open source replacement fro mathematica and such. It’s pretty much for everything. As a contributor, I’m kind of biased regarding its quality. You can try it online at sagenb.org.

• George G. Says:

A little bit. Usually I try not to be too hard on myself for not seening something “obvious”, or not noticing ir quickly enough. I even have [something like a] proverb: “If I never ever failed to see something retrospectively obvious, they would award me one Fields Medal every Saturday”.
This particular trick however is trivial enough that I *should* have seen it right away. But oh well.

I would try Sage, but I want to have at least one GB on my disk that is not taken by mathematical software or books. But! I have one particular question about Sage, the question I always use as a Litmus test: how well does it handle matrix functions? How long will it take it to compute exp(M), where M is 15×15? Can it compute sin(M) at all? (Btw Mathematica is pretty awful at it.) I think it shouldn’t take you to much time to find out, especially if you are a contributor.

• christopherolah Says:

> “If I never ever failed to see something retrospectively obvious, they would award me one Fields Medal every Saturday”.

I have to remember that one

> I would try Sage, but I want to have at least one GB on my disk that is not taken by mathematical software or books.

As I said, you don’t need to install sage to try it. You can try it online at sagenb.org. You have to make an account, but it only asks for a login and password. Not like some of those irritating websites that want all sorts of private info.

> But! I have one particular question about Sage, the question I always use as a Litmus test: how well does it handle matrix functions? How long will it take it to compute exp(M), where M is 15×15?

Matrices are completely outside my expertise, however:

sage: M = matrix([[i+j for i in range(15)] for j in range(15)])
sage: time eM = exp(M)
CPU times: user 21.80 s, sys: 0.16 s, total: 21.96 s
Wall time: 131.38 s

I’m on a netbook with a fairly old version of sage, so this isn’t really a fair test…

I don’t have a copy of Mathematica, so I can’t say how that performs on my computer.

> Can it compute sin(M) at all? (Btw Mathematica is pretty awful at it.)

The version I have on me can’t, no clue about others. I’m presuming that sin(M) is just generalisation of sine’s taylor series to matrices? Cute. Here’s a rough approximation:

sage: sinM= matrix([[0 for i in range(15)] for j in range(15)])
sage: time for n in range(100): sinM += (-1)^n/factorial(2*n+1)*M^(2*n+1)
CPU times: user 3.50 s, sys: 0.01 s, total: 3.51 s
Wall time: 3.51 s

I’m guessing that isn’t very useful to you, however.

You might be interested in this.

• George G. Says:

Ah, you don’t have to install it! That is pretty cool. Now I have no excuse not to try it.

Considering matrix functions: sage seems to be at least as good as Mathematica. Those times aren’t that bad. Not as good as MatLab, but then working with matrices is what MatLab was designed for, so maybe it’s not a fair comparison.

Yes, Taylor series is what sin(M) is, you guessed correctly. Matrix functions are pretty useful when you have to solve a big system of differential equations: you can rewrite it as one single matrix equation and then solve it with traditional methods as if it were a plain old scalar equation, only instead of normal functions you’ll be using matrix functions this time. (of course, you have to prove a whole bunch of tehchnical lemmas, convergence and existence theorems and the like before you can pull that trick off, but it’s worth it.)

• christopherolah Says:

Oh dear, this thread is getting rather thin…

> Ah, you don’t have to install it! That is pretty cool. Now I have no excuse not to try it.

I should mention that it is substantially faster when you run it locally.

In any case, here’s is the same matrix exponential on a better machine with the latest version of sage:

sage: M=matrix([[i+j for i in range(15)] for j in range(15)])
sage: time eM = exp(M)
CPU times: user 5.19 s, sys: 0.09 s, total: 5.28 s
Wall time: 35.08 s

> atrix functions are pretty useful when you have to solve a big system of differential equations: you can rewrite it as one single matrix equation and then solve it with traditional methods as if it were a plain old scalar equation,

Very cool!