# Microsoft Mathematics CAS

May 23, 2011 11:35 AM Subscribe

Microsoft Mathematics is a free Computer Algebra System (CAS) available from Microsoft. A CAS is a program that can solve purely symbolic mathematical equations. For example, the program can tell you that the derivative of 6x^2 + 12x is 12x + 12. The program has functions for calculus, statistics, linear algebra, and graphing. One interesting feature of the program is that in some cases it can show and describe the intermediate steps involved in solving an equation. Here’s a 16 page tutorial (in MS Word docx format) showing how to use the program. The program can be downloaded from the Microsoft download page. Thirty-two and sixty-four bit versions are available. The program only works on XP/Vista/Windows 7.

How does it compare to axiom, cadabra, gap, lie, mathomatic, mathpiper, maxima, pari-gp, singular and yacas which are partly or wholly not only available on Windows but also Linux and other OSes due to being both free and Free?

posted by DU at 11:42 AM on May 23, 2011 [7 favorites]

posted by DU at 11:42 AM on May 23, 2011 [7 favorites]

"It looks like you're trying to do math, would you like me miscalculate that for you?"

posted by BigHeartedGuy at 11:43 AM on May 23, 2011 [1 favorite]

posted by BigHeartedGuy at 11:43 AM on May 23, 2011 [1 favorite]

This is version 4.0, so they've been doing this for a while, apparently. We're probably just hearing about it now since it has passed the traditional first two versions of suckage.

posted by charred husk at 11:44 AM on May 23, 2011

posted by charred husk at 11:44 AM on May 23, 2011

[Generating generic snarky Microsoft comment... please wait.]

posted by smackfu at 11:48 AM on May 23, 2011 [4 favorites]

posted by smackfu at 11:48 AM on May 23, 2011 [4 favorites]

Looks pretty neat.

Oh. Wait. I mean, Microsoft? Man, FUCK THOSE GUYS.

posted by bondcliff at 11:50 AM on May 23, 2011 [16 favorites]

Oh. Wait. I mean, Microsoft? Man, FUCK THOSE GUYS.

posted by bondcliff at 11:50 AM on May 23, 2011 [16 favorites]

"... complete with a glowing green LCD screen" too! They've obviously just seen Winamp for the first time. Still, I'm going to enjoy playing with this.

posted by le morte de bea arthur at 11:53 AM on May 23, 2011 [2 favorites]

posted by le morte de bea arthur at 11:53 AM on May 23, 2011 [2 favorites]

Looks cool! Mrs. Deadmessenger and I have been using Wolfram Alpha working with our high school-age daughter this year, with some success - I wonder how this stacks up?

posted by deadmessenger at 11:54 AM on May 23, 2011

posted by deadmessenger at 11:54 AM on May 23, 2011

*For example, the program can tell you that the derivative of 6x^2 + 12x is 12x + 12.*

Or you could just Bing it.

posted by burnmp3s at 11:54 AM on May 23, 2011

My favorite Microsoft Article, describing improvements made to Excel 2003:

McCullough and Wilson point out that Excel appeared to use a "calculator formula" to compute VAR. Their observation was correct and can be extended to many (but curiously, not all) functions that calculate the sum of squared deviations about a mean. The calculator formula can be executed in a single pass through the data.posted by benzenedream at 11:57 AM on May 23, 2011 [4 favorites]

<snip>

With infinitely precise arithmetic, both procedures yield the same results. However, because of the finite precision of Excel, the calculator formula is more prone to round off errors.In texts on statistical computing, the calculator formula is generally presented as an example of how not to compute variance.

I could see this as useful for HS students (and non-technical college students) who have a tablet / notebook and don't want to shell out whatever crazy it is that TI is charging. It looks to do way less than the free competition I've used (axiom, maxima, and yacas) but with a kid-friendly interface.

posted by a robot made out of meat at 11:57 AM on May 23, 2011

posted by a robot made out of meat at 11:57 AM on May 23, 2011

It seems to do a good job with the equations I came up with (it simplified trig expressions automatically, for example) and the option to show its work was neat. You can turn off the phone (?!) on the left if it's freaking you out.

Sorry, I meant I CAN'T WAIT TO TELL YOU HOW MUCH THIS SUCKS AND HOW UNWILLING I AM TO EVEN LOOK AT IT. There we go.

posted by 0xFCAF at 11:58 AM on May 23, 2011 [4 favorites]

Sorry, I meant I CAN'T WAIT TO TELL YOU HOW MUCH THIS SUCKS AND HOW UNWILLING I AM TO EVEN LOOK AT IT. There we go.

posted by 0xFCAF at 11:58 AM on May 23, 2011 [4 favorites]

It's slick, and would have been exceedingly handy in college - especially as both mathmatica and matlab almost require a degree by themselves to use.

However, it's got some weirdnesses :

for y= (x^2 - 9)/(x-3) is equivalent to y=x+3 except for the discontinuity near x=3. However, the graph doesn't show the hole there.

That's sort of a problem.

posted by Pogo_Fuzzybutt at 11:59 AM on May 23, 2011 [2 favorites]

*How does it compare to axiom, cadabra, gap, lie, mathomatic, mathpiper, maxima, pari-gp, singular and yacas which are partly or wholly not only available on Windows but also Linux and other OSes due to being both free and Free?*

From the above list, I only use Mathematica 7 on Windows. Microsoft Mathematics has nowhere near the functionality of Mathematica, but Microsoft Mathematics has an easier to use frontend than Mathematica. I think it’s a great program for anyone who has to do algebra/first year calculus (high school and first year social science majors in university or someone looking to brush up on their math skills). The solution-steps functionality (when available) is great. Mathematica doesn’t have anything similar to that (that I’m aware of).

posted by Jasper Friendly Bear at 11:59 AM on May 23, 2011

*Or you could just Bing it.*

Well, 'mathematica' it. Since it's using wolfram alpha.

posted by empath at 12:02 PM on May 23, 2011 [1 favorite]

And speaking of wolfram alpha, they have a ton of things like this available for iphone and ipad for things like calculus or chemistry.

posted by empath at 12:03 PM on May 23, 2011 [1 favorite]

posted by empath at 12:03 PM on May 23, 2011 [1 favorite]

Random math question -- is there a way to derive the equations of motion of a system given its hamiltonion or lagrangian with a program like this?

posted by empath at 12:04 PM on May 23, 2011

posted by empath at 12:04 PM on May 23, 2011

Probaby gives you the wrong answers then kicks your dog. I'm sure Apple and Google have a better solution.

posted by Ad hominem at 12:06 PM on May 23, 2011

posted by Ad hominem at 12:06 PM on May 23, 2011

*When you first launch Microsoft Calculator 4.0, the part of the application that will probably attract your attention first is the realistic-looking calculator pad.*

A realistic looking calculator pad! Finally, something for the set of people who need a full-fledged computer algebra system but can't find the number keys on their keyboards.

posted by qxntpqbbbqxl at 12:07 PM on May 23, 2011 [4 favorites]

*From the above list, I only use Mathematica 7 on Windows.*

Mathematica wasn't on my list. I tried a copy of that once and found the lack of source code disturbing. It always felt like a black box that I couldn't question when I found something I didn't understand.

posted by DU at 12:09 PM on May 23, 2011 [1 favorite]

*The solution-steps functionality (when available) is great. Mathematica doesn’t have anything similar to that (that I’m aware of).*

Wolfram Alpha does that, I believe, so it's probably in or imminent for Mathematica. Plus Wolfram Alpha uses the keyboard.

While I don't use Mathematica (I use sage), it seems far more useful for a beginning university student to learn Mathematica if they can get free/low cost access from their university. (I say Mathematica because it seems fairly easy to do basic things, like multiply matrices or do some integrals, but you can also do much more serious things.) Or Maple, for that matter.

posted by hoyland at 12:10 PM on May 23, 2011

*How does it compare to axiom*

I can pass the Turing test.

posted by axiom at 12:11 PM on May 23, 2011 [21 favorites]

*Mathematica wasn't on my list. I tried a copy of that once and found the lack of source code disturbing. It always felt like a black box that I couldn't question when I found something I didn't understand.*

Sorry about that. I realized that after I posted, I had misread

*Mathomatic*for

*Mathematica*.

posted by Jasper Friendly Bear at 12:12 PM on May 23, 2011

empath: "

Why would need a program for that? Why not just do it in your head?

posted by double block and bleed at 12:28 PM on May 23, 2011 [4 favorites]

*Random math question -- is there a way to derive the equations of motion of a system given its hamiltonion or lagrangian with a program like this?*"Why would need a program for that? Why not just do it in your head?

posted by double block and bleed at 12:28 PM on May 23, 2011 [4 favorites]

DU: "

Well it's less smug. So it's got that going/ not going for it.

a robot made out of meat: "

Eh. I've been using it in my calculus classes, and it's been super helpful so far -- calculating and graphing e.g. surfaces of solids generated by rotation; plane curve lengths; volumes by cylindrical shells; parametrical equations and so on. It produces tidy 2d and 3d graphs which I can save and attach to assignments and so on. It also integrates into onenote, which I use a lot.

posted by boo_radley at 12:29 PM on May 23, 2011 [3 favorites]

*How does it compare to axiom, cadabra, gap, lie, mathomatic, mathpiper, maxima, pari-gp, singular and yacas which are partly or wholly not only available on Windows but also Linux and other OSes due to being both free and Free?*"Well it's less smug. So it's got that going/ not going for it.

a robot made out of meat: "

*I could see this as useful for HS students (and non-technical college students) who have a tablet / notebook and don't want to shell out whatever crazy it is that TI is charging. It looks to do way less than the free competition I've used (axiom, maxima, and yacas) but with a kid-friendly interface.*"Eh. I've been using it in my calculus classes, and it's been super helpful so far -- calculating and graphing e.g. surfaces of solids generated by rotation; plane curve lengths; volumes by cylindrical shells; parametrical equations and so on. It produces tidy 2d and 3d graphs which I can save and attach to assignments and so on. It also integrates into onenote, which I use a lot.

posted by boo_radley at 12:29 PM on May 23, 2011 [3 favorites]

Don't the WA apps just call back to WA itself to get the answers? With this you would get your answers quicker, Wolphram Alpha seems to take several seconds to generate an answer, which is especially annoying when the 'natural language' input only works like half the time.And speaking of wolfram alpha, they have a ton of things like this available for iphone and ipad for things like calculus or chemistry.

One neat feature of is the text input. You can enter a formula by drawing it with a mouse and the program will do an OCR of it. If you have a pen, or are using a tablet computer this could potentially safe a lot of time, and make it much easier to use.

posted by delmoi at 12:30 PM on May 23, 2011

*What does it have to say about 48/2(9+3)?*

It gives 288 as the answer.

posted by Jasper Friendly Bear at 12:37 PM on May 23, 2011 [1 favorite]

There will be almost nobody ever using this M$ program for anything, aside from some poor students who's professors M$ bribes into assigning homework problems using it.

There are two extremely well established commercial CAS systems, namely Mathematica and Maple, and a few dying specialized ones, like Magma.

In addition, there is the free open source Sage project that unifies the best specialized CAS systems under a Python interpreter.

posted by jeffburdges at 12:38 PM on May 23, 2011 [2 favorites]

There are two extremely well established commercial CAS systems, namely Mathematica and Maple, and a few dying specialized ones, like Magma.

^{1}There are a shit ton of, not simply free, but open source CAS systems, like DU's list, SciLab, etc.^{2}In addition, there is the free open source Sage project that unifies the best specialized CAS systems under a Python interpreter.

^{1}There is also Wolfram alpha, which while not open source, does provide an instantly accessible CAS system for everyone.^{2}Virtually all provide a detachable "kernel" or library, meaning you can parallelize your algorithm and run them on a cluster of GPUs or whatever.posted by jeffburdges at 12:38 PM on May 23, 2011 [2 favorites]

*Mathematica wasn't on my list. I tried a copy of that once and found the lack of source code disturbing. It always felt like a black box that I couldn't question when I found something I didn't understand.*

Also, Mathematica isn't free, as far as I know. "As far as I know" being, I just installed 10 copies of it and paid for each license since their corporate licensing is something worth balking at.

posted by Bathtub Bobsled at 12:43 PM on May 23, 2011

But does it have Manipulate[] like Mathematica (stolen from Maple or something I hear?). What ever its origin, Manipulate is bad-ass. It is the Math thing I've always wanted.

posted by Chekhovian at 12:43 PM on May 23, 2011

posted by Chekhovian at 12:43 PM on May 23, 2011

*"Random math question -- is there a way to derive the equations of motion of a system given its hamiltonion or lagrangian with a program like this?"*

I'm sure you've seen this.

posted by klausman at 12:51 PM on May 23, 2011 [2 favorites]

CAS is the nearest thing to magic for me. Sure, I understand what it's doing, but my memory of 1991 and discovering Maple on the networked Suns during my Materials masters ...

We were routinely set huge problems like analyzing the stresses in irregular pressure vessels. Hours and hours of calculus, most of which were summing terms and reducing for the solution. Vile tedious hours, too. I hung out with some Maths postgrads, and they couldn't believe we weren't using CAS for this. A quick five-minute intro to Maple from one of them, borrowing the Maple V manual from the library - an hour after that, I was finished my assignment which was supposed to take the whole weekend. I even typeset the damn thing in LaTeX.

The prof couldn't believe it. He'd never heard of CAS. I showed him how to call up Maple on the terminal. He spent the next while typing equations and cackling.

posted by scruss at 12:52 PM on May 23, 2011 [14 favorites]

*that*was magic.We were routinely set huge problems like analyzing the stresses in irregular pressure vessels. Hours and hours of calculus, most of which were summing terms and reducing for the solution. Vile tedious hours, too. I hung out with some Maths postgrads, and they couldn't believe we weren't using CAS for this. A quick five-minute intro to Maple from one of them, borrowing the Maple V manual from the library - an hour after that, I was finished my assignment which was supposed to take the whole weekend. I even typeset the damn thing in LaTeX.

The prof couldn't believe it. He'd never heard of CAS. I showed him how to call up Maple on the terminal. He spent the next while typing equations and cackling.

posted by scruss at 12:52 PM on May 23, 2011 [14 favorites]

*M$*

Wow, a use of that non-ironically. Did I stumble on Slashdot or the 90s?

posted by kmz at 12:53 PM on May 23, 2011 [7 favorites]

SpaceTime is worth a look - it's free on Windows but costs on other platforms. Having a CAS on my phone is just flat out awesome.

posted by edd at 12:55 PM on May 23, 2011 [2 favorites]

posted by edd at 12:55 PM on May 23, 2011 [2 favorites]

for y= (x^2 - 9)/(x-3) is equivalent to y=x+3 except for the discontinuity near x=3. However, the graph doesn't show the hole there.

That's sort of a problem.

for y= (x^2 - 9)/(x-3) is equivalent to y=x+3 except for the discontinuity near x=3. However, the graph doesn't show the hole there.

That's sort of a problem.

So, after playing around a bit, I think I know what is going on.

The function y=(x^2 -8)/(x-3) graphs correctly with the appropriate asymptotic behavior near x-3.

But the function above, y=(x^2-9)/(x-3) evaluates to y=x+3. This is what gets graphed. This is a big problem, because y=x+3 is not the same; between 2 and 4 the discontinuity blows up.

The worst part is that it gives no sign that that it is not graphing what you told it to graph, but rather what it has simplified the equation to.

posted by Pogo_Fuzzybutt at 1:05 PM on May 23, 2011 [4 favorites]

Does anyone here have much experience with the open source CAS options? A coworker of mine could use something that can handle symbolic differentiation (and simplification - otherwise we end up with individual multi-megabyte equations), with a decent batch mode. My project is currently instead working around the quirks of a commercial CAS with a "suck up 128GB of RAM and crash" mode.

posted by roystgnr at 1:17 PM on May 23, 2011

posted by roystgnr at 1:17 PM on May 23, 2011

*for y= (x^2 - 9)/(x-3) is equivalent to y=x+3 except for the discontinuity near x=3*

I'm being pedantic, I know, but that should read

**at**x=3, not near it.

The two-sided limit as x->0 of (x^2 - 9)/(x-3) is exactly x+3. Only at x=3 is there an undefined value. The graph this thing generates is clearly wrong, but it's worth noting that this sort of thing is difficult to convey on a graph, anyway. You'd have exactly y=x+3 with some sort of note at x=3 saying "undefined at this tiny visual point."

posted by introp at 1:23 PM on May 23, 2011

*for y= (x^2 - 9)/(x-3) is equivalent to y=x+3 except for the discontinuity near x=3. However, the graph doesn't show the hole there.*

That's sort of a problem.

That's sort of a problem.

Well, for any finite number of points plotted, you could just have not plotted the single point where it's not defined. That kind of exactitude is why I have to add a half-dozen asserts to anything I want reduce[] to work well on.

posted by a robot made out of meat at 1:25 PM on May 23, 2011

*for y= (x^2 - 9)/(x-3) is equivalent to y=x+3 except for the discontinuity near x=3. However, the graph doesn't show the hole there.*

That's sort of a problem.

So, after playing around a bit, I think I know what is going on.

The function y=(x^2 -8)/(x-3) graphs correctly with the appropriate asymptotic behavior near x-3.

But the function above, y=(x^2-9)/(x-3) evaluates to y=x+3. This is what gets graphed. This is a big problem, because y=x+3 is not the same; between 2 and 4 the discontinuity blows up.

That's sort of a problem.

So, after playing around a bit, I think I know what is going on.

The function y=(x^2 -8)/(x-3) graphs correctly with the appropriate asymptotic behavior near x-3.

But the function above, y=(x^2-9)/(x-3) evaluates to y=x+3. This is what gets graphed. This is a big problem, because y=x+3 is not the same; between 2 and 4 the discontinuity blows up.

Wolfram Alpha exhibits the same behaviour:

Plot of y=(x^2 -8)/(x-3)

Plot of y=(x^2-9)/(x-3)

posted by Jasper Friendly Bear at 1:28 PM on May 23, 2011 [2 favorites]

*I'm being pedantic, I know, but that should read at x=3, not near it.*

*You'd have exactly y=x+3 with some sort of note at x=3 saying "undefined at this tiny visual point."*

No, I meant near. Between 2 and 2.99... the function becomes increasingly asymptotic, headed towards + infinity and becoming less accurate the closer you get to 3 where it is wholly discontinuous. The inverse happens on the other side as it approaches 4 from 3.

So, the hole really exists from 2 to 4, and not merely at 3.

My larger point being that there is a danger inherent in using these systems where they try to be smarter than you about providing numeric solutions to algebraic systems. If you aren't very careful about what you tell the computer to do, you might not get back what you were expecting.

It would be better on the whole if these tools made it more clear what assumptions they went on to make in the course of doing the analysis.

posted by Pogo_Fuzzybutt at 1:42 PM on May 23, 2011 [1 favorite]

*No, I meant near. Between 2 and 2.99... the function becomes increasingly asymptotic, headed towards + infinity and becoming less accurate the closer you get to 3 where it is wholly discontinuous. The inverse happens on the other side as it approaches 4 from 3.*

Your statement is clearly wrong. (x^2 - 9)/(x-3) has no asymptotic behavior. It is precisely equal to x+3 for all points save for the single value x=3. What makes you think the function is asymptotic?

posted by introp at 1:57 PM on May 23, 2011 [2 favorites]

*Your statement is clearly wrong. (x^2 - 9)/(x-3) has no asymptotic behavior. It is precisely equal to x+3 for all points save for the single value x=3. What makes you think the function is asymptotic?*

I think he means that the graph of the function should exhibit an increasingly sharp incline around the singularity at x=3, but it does not.

posted by qxntpqbbbqxl at 2:02 PM on May 23, 2011

The statement is still wrong, then.

(x^2 - 9) / (x-3) = (x+3)(x-3) / (x-3)

For all values of x which are not x=3, that is simply x+3. No asymptotic behavior. There is a single undefined value. One value in the domain, which corresponds to a single missing point in the graph. For x = "the smallest real number bigger than 3", the whole function above will yield a value absolutely identical to x+3. The same is true for the largest real number smaller than 3.

posted by introp at 2:12 PM on May 23, 2011 [3 favorites]

(x^2 - 9) / (x-3) = (x+3)(x-3) / (x-3)

For all values of x which are not x=3, that is simply x+3. No asymptotic behavior. There is a single undefined value. One value in the domain, which corresponds to a single missing point in the graph. For x = "the smallest real number bigger than 3", the whole function above will yield a value absolutely identical to x+3. The same is true for the largest real number smaller than 3.

posted by introp at 2:12 PM on May 23, 2011 [3 favorites]

No, you're right. I was being stupid. Something something, surfing metafilter during boring conference call, something.

Sorry, carry on.

posted by Pogo_Fuzzybutt at 2:13 PM on May 23, 2011 [2 favorites]

Voila, Sage's manual page on differentiation and several simplify routines, roystgnr.

posted by jeffburdges at 2:19 PM on May 23, 2011 [1 favorite]

posted by jeffburdges at 2:19 PM on May 23, 2011 [1 favorite]

*They've obviously just seen Winamp for the first time*

Or basing the design on an old terminal UI - like winamp did

posted by the noob at 2:21 PM on May 23, 2011

axiom: "

Cannot. That is SOOOOOOO what a fake AI would say first. Weak sauce.

Oh, wait this is MeFi. Ummmmmm, let me guess, you were taking the Turing Test back before it got all sell out and commercial, right?

posted by Samizdata at 3:36 PM on May 23, 2011 [1 favorite]

*"*

I can pass the Turing test.*How does it compare to axiom*I can pass the Turing test.

Cannot. That is SOOOOOOO what a fake AI would say first. Weak sauce.

Oh, wait this is MeFi. Ummmmmm, let me guess, you were taking the Turing Test back before it got all sell out and commercial, right?

posted by Samizdata at 3:36 PM on May 23, 2011 [1 favorite]

Not surprisingly, emacs also has a very nice symbolic mathematics environment, one of the capabilities of 'calc'. (it's also an arbitrary-precision RPN calculator). Here's one way to solve the derivative problem in the OP:

It also makes the same arguable mistake Simplifying:

Thanks for the pointer to 'sage'; I'm about to check it out with the download from sagemath.org; hopefully the Ubuntu download will run on Debian. Apparently the effort of maintaining a package was too great for the Debian maintainers, sadly.

posted by jepler at 3:42 PM on May 23, 2011 [1 favorite]

(I only rarely use calc, so I'll cop to having to consult the online documentation to find that the key sequence for derivative was 'ad')M-x calc RET

'6x^2+12x RET

adx RET

It also makes the same arguable mistake Simplifying:

results in'(x^2-9)/(x-3) RET

an RET

`x+3`.Thanks for the pointer to 'sage'; I'm about to check it out with the download from sagemath.org; hopefully the Ubuntu download will run on Debian. Apparently the effort of maintaining a package was too great for the Debian maintainers, sadly.

posted by jepler at 3:42 PM on May 23, 2011 [1 favorite]

Hey, all;

I do a bit of development for Sage. It is indeed free, and works by pulling together a pile of existing free math software (eg, maxima, gap, piles more), gluing them together with Cython, and then throwing a good pile of extra functionality on top for good measure.

You can try out Sage's notebook at sagenb.org, though it seems to be slow to respond or just down today... there's another notebook server here. (I've met the maintainer of it, so I'll vouch for the bad security certificate that it pops out...)

One really neat thing about Sage is that it uses python-like syntax for everything. So you get a free useful skill while you learn the system...

The Debian package is a bit of a sore spot. (Florent Hivert, who wrote that bug report that jepler linked, is a co-author of mine!) Basically, Sage uses customized and tweaked versions of a lot of its software, which doesn't play well with package management systems. When you install Sage, you install a little self-contained distro that runs inside your existing distro. Unless you're on a Mac or Windows, in which case it installs a little distro inside of your non-distro. Essentially, the Debian folks tried to write down all the dependencies and run sage with off-the-shelf versions of everything, and it failed miserably. This didn't stop the .deb package from being in the package manager for two years, though, and pissed off a lot of people. A 'good' .deb would just install the monolith and leave the internals alone, which _feels_ like it shouldn't be too tough. (especially because the install process is pretty brain-dead easy.) They got the bad package out eventually, though, so I'm happy.

One of my favourite things about Sage is that it re-worked the object orientation system in Python to revolve around 'categories,' which are, indeed, a computer-science model of mathematical categories. The short synopsis is that you should not just keep track of objects, but also describe functions between them. You shouldn't have to worry about that, though, unless you're developing the Sage code base...

posted by kaibutsu at 4:11 PM on May 23, 2011 [5 favorites]

I do a bit of development for Sage. It is indeed free, and works by pulling together a pile of existing free math software (eg, maxima, gap, piles more), gluing them together with Cython, and then throwing a good pile of extra functionality on top for good measure.

You can try out Sage's notebook at sagenb.org, though it seems to be slow to respond or just down today... there's another notebook server here. (I've met the maintainer of it, so I'll vouch for the bad security certificate that it pops out...)

One really neat thing about Sage is that it uses python-like syntax for everything. So you get a free useful skill while you learn the system...

The Debian package is a bit of a sore spot. (Florent Hivert, who wrote that bug report that jepler linked, is a co-author of mine!) Basically, Sage uses customized and tweaked versions of a lot of its software, which doesn't play well with package management systems. When you install Sage, you install a little self-contained distro that runs inside your existing distro. Unless you're on a Mac or Windows, in which case it installs a little distro inside of your non-distro. Essentially, the Debian folks tried to write down all the dependencies and run sage with off-the-shelf versions of everything, and it failed miserably. This didn't stop the .deb package from being in the package manager for two years, though, and pissed off a lot of people. A 'good' .deb would just install the monolith and leave the internals alone, which _feels_ like it shouldn't be too tough. (especially because the install process is pretty brain-dead easy.) They got the bad package out eventually, though, so I'm happy.

One of my favourite things about Sage is that it re-worked the object orientation system in Python to revolve around 'categories,' which are, indeed, a computer-science model of mathematical categories. The short synopsis is that you should not just keep track of objects, but also describe functions between them. You shouldn't have to worry about that, though, unless you're developing the Sage code base...

posted by kaibutsu at 4:11 PM on May 23, 2011 [5 favorites]

kaibutsu, I feel your pain. Shipping your software with tweaked-until-known-compatible versions of all its dependencies is really a pretty effective way to package an application. Unfortunately, that runs counter to Debian's goals, which include having a less bloated system by making sure that every package isn't a "self-contained distro".

I am coming around to the viewpoint that in cases like this it is better for Debian to have no package than to have an old package (in users' eyes, old is the same as broken), but it does still hurt that I'm only now finishing the download of something that is 2/3 the size of a full-fledged ubuntu live cd.

In any case, thanks for your work (no matter how small) maintaining sage. Download's done, time to kick the tires.

posted by jepler at 4:26 PM on May 23, 2011

I am coming around to the viewpoint that in cases like this it is better for Debian to have no package than to have an old package (in users' eyes, old is the same as broken), but it does still hurt that I'm only now finishing the download of something that is 2/3 the size of a full-fledged ubuntu live cd.

In any case, thanks for your work (no matter how small) maintaining sage. Download's done, time to kick the tires.

posted by jepler at 4:26 PM on May 23, 2011

I've never understood why Sage chose Python honestly. There are functional languages, like Haskell and the MLs, that seem far more amenable to mathematical notation.

There are obviously challenges using Hindley–Milner type inference in an interactive environment because casting more closely mirrors human thought than type inference, especially in mathematics. Yet, we routinely create so many tricky errors through casting that surely type inference is worth the trouble.

posted by jeffburdges at 4:57 PM on May 23, 2011 [1 favorite]

There are obviously challenges using Hindley–Milner type inference in an interactive environment because casting more closely mirrors human thought than type inference, especially in mathematics. Yet, we routinely create so many tricky errors through casting that surely type inference is worth the trouble.

posted by jeffburdges at 4:57 PM on May 23, 2011 [1 favorite]

Yeah, I absolutely get the argument for using off-the-shelf software. I'm not a big fan of bloat, either. Ultimately, though, Sage is a research tool, and the decision for the bloat came down to noticing places where small tweaks would shave hours or days off the kinds of big computations that some of the primary developers do.

Why Python? This is from an epic post by Bill Stein on how Sage got started.

posted by kaibutsu at 10:29 PM on May 23, 2011 [1 favorite]

Why Python? This is from an epic post by Bill Stein on how Sage got started.

I started talking a lot with Thomas Barnet-Lamb about a crazy idea to create a new open source math software system with readable implementations of algorithms, and nothing hidden in some stupid proprietary layer. Thomas was then a first year Harvard grad student who had won some international computer programming competition, so I figured he would enjoy talking about software. I also talked a lot with Dylan Thurston about this crazy idea; Dylan had started gradShort version: Python is ridiculously human-readable, and with Pyrex can be fast.

school at the same time as me at Berkeley, graduated the same time, and had the same first two jobs as me, was also an Assistant Professor. Both Thomas and Dylan gave me many ideas for programming languages to consider, including OCaml (which Thomas liked), Haskell (which Dylan was a huge fan of), etc. After having used Magma for years, with its highly optimized algorithms, I desperately needed a fast language. But I also wanted a language that was easy to read, and that mathematicians could pick up without too much trouble, since I wanted people like Manjul to someday use this system and not have their research cut off. And I knew from experience that unreadable source code is no better than closed source.

I'm not going to go into negatives of any languages. Though I used Python a lot, for a long time I didn't consider it seriously at all for this crazy project, since I tried implementing some basic

arithmetic algorithms in Python and found that they were vastly too slow to compete with Magma (or C). I had also tried quite hard to use SWIG to make C++ available in Python, but SWIG is extremely frustring, and has horrible performance (due to multiple layers of wrapping), at least compared to what Magma could do.

In October 2004, I was flying back from Europe (the Paris Magma conference) and started reading the Python/C API reference manual straight through. I realized that Python is far, far more than just an interpreter. It is a C library that implements everything you need, and has a well defined and well documented API. I did some sample benchmarks on the plane, and found not surprisingly that I could write code as extensions to Python that was just as fast as

anything one could write for Magma by modifying the Magma kernel, since under the hood, both were written in C. Also, on the flight, I realized that because the Python/C interface uses reference counting, it would be vastly easier to write the C extensions I would need using

some sort of language I would design. I got home and somehow stumbled onto Pyrex, which was exactly what I was planning to write. I tried it out, did benchmarks, and realized that I had a winner.

With Pyrex and Python, I could implement algorithms and make them as fast as anything in Magma, assuming I could figure out the right algorithm. Moreover, the dozens of issues I had with Magma, many of which were simply a function of them not having the resources to do

language development, were already solved in Python. And Python would continue to move forward with no work from me. It was mid-2004 and because of Python, the overall software ecosystem was much better than in 1999, despite open source number theory software having not moved forward much.

I started going to (and sometimes hosting) the Boston Python user group meetings, which was quite large, and gave me much useful feedback. And I decided it was time to move past my test and prototype stage and get to work. My plan, as I had explained it to Thomas, was to create a complete new system from the ground up using Python + Pyrex. All the code would have an easy to read Python implementation that was well documented, in some cases there would be

a much faster Pyrex implementation of the same code, etc. With my naive plan in hand, I sat down with the main elliptic curves file of the PARI source code, and started to translate.

I think I made it through one function. Where some might have doggedly persisted for years with such an approach, I quickly ran out of patience. In fact, when it comes to software and programming I can be extremely impatient. I realized that my entire plan was insane,

and would take too long. I had discussions with Thomas, Dylan, and others, and everybody I knew who was seriously into number theory computation was using Magma, so I realized that I was going to have to do this entire project myself. So I realized translating was doomed.

Somehow, even with all my experience, I had massively underestimated the complexity of the algorithmic edifice that is any serious mathematical software system.

I read the PARI C API reference, and used Pyrex to write a wrapper so that I could call some basic PARI functions from Python. I implemented basic rational and integer types using Pyrex and GMP, and the performance was reasonable. One day, I was using Matplotlib (a Python library) to draw some plots for Barry Mazur that involved explicit computation with the incomplete Gamma function, and was frustrated because neither PARI nor Magma had an implementation of this special function at the time. Harvard had a Mathematica site license, so I had a copy of Mathematica, and I wrote code using the pexpect Python library to hold open a single Mathematica session and use it to compute the incomplete Gamma function. Problem solved. This was when the interfaces between Sage and other mathematics software systems was

born.

posted by kaibutsu at 10:29 PM on May 23, 2011 [1 favorite]

There are hoards of computer scientists that'll swear up & down that Haskell and the MLs are more readable than Python, although maybe Bill Stein disagrees.

In fact, your quote suggests that Pyrex contributed enormously to the selection of Python, and the success of the project. Fair enough, Cython (Pyrex) is a very cool foreign function interface.

There is a very good foreign function interface builder for Haskell called greencard that expands upon Haskell's already sound foreign function interface. OCaml, SML, etc. are all far more messy.

posted by jeffburdges at 1:56 AM on May 24, 2011

In fact, your quote suggests that Pyrex contributed enormously to the selection of Python, and the success of the project. Fair enough, Cython (Pyrex) is a very cool foreign function interface.

There is a very good foreign function interface builder for Haskell called greencard that expands upon Haskell's already sound foreign function interface. OCaml, SML, etc. are all far more messy.

posted by jeffburdges at 1:56 AM on May 24, 2011

*There are hoards of computer scientists that'll swear up & down that Haskell and the MLs are more readable than Python, although maybe Bill Stein disagrees.*

Count me as a member of at least one of these hoards.

It's also worth mentioning that this sort of thing is what ML was designed for to begin with: ML stands for "Meta Language," and was originally used for writing tactics in a theorem prover (this helps explain why both SML and OCaml have top-level interactive loops, despite being compiled). Although from reading the post that kaibutsu quotes, it sounds like reason Haskell and OCaml were discarded had less to do with readability than with (IMO misguided) concerns about performance.

posted by Dr. Eigenvariable at 3:17 AM on May 24, 2011

THIS SOFTWARE IS VERY GOOD AND GREAT. WHEN I DOWNLOAD THIS SOFTWARE, THEN I FEEL BETTER BECAUSE THIS ALSO HELP ME

posted by iotic at 5:01 AM on May 24, 2011

posted by iotic at 5:01 AM on May 24, 2011

« Older "Meticulous and ambitious"--Horace Rumpole. | I can't believe we had that in the budget Newer »

This thread has been archived and is closed to new comments

posted by hellslinger at 11:39 AM on May 23, 2011