Ask Your Question

sage for aerospace engineering

asked 2011-01-05 04:14:24 -0500

mchamran gravatar image


I'm a aerospace engineering graduate student and a heavy matlab user. In aerospace engineering (controls, dynamics, navigation...) Matlab/Simulink is fairly standard both in academia and industry. I've been doing extensive looking searching for open-source alternatives, for reasons beyond this discussion.

I've come across multiple alternatives like Octave, Scilab, and Enthought's Python distrubution. After much reading, I been fascinated by Sage, but am wondering to what extent Sage is used for engineering applications. I get the feeling that Sage is primarily used by mathematicians and scientists, but haven't seen much discussion on usage by engineers for engineering applications.

Any insight in this regard would be appreciated, -Hamid

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2011-01-05 12:20:11 -0500

Felix Lawrence gravatar image

I'm a physicist running numerical simulations using Sage. Probably the biggest attractions of Sage for me is that you write in Python, a real programming language that's object oriented and has a nice syntax. I had no experience with Python before picking up Sage - I just couldn't handle programming in Mathematica any longer. Python has lots of code examples, snippets and libraries available.

The second biggest attraction of Sage is that it can call Mathematica/Matlab/octave/whatever functions, so if you don't want to port all your existing code over to Sage/Python immediately, then you can still get things done.

If you want parts of your code to run fast, then you can write them in Fortran and use f2py, or write them in C using Cython. Then the high level logic of your code can be written in a nice language, while the guts of your code still runs at full speed. Sadly, the guts of the code I use still lives in Fortran run by C MathLink driven by Mathematica, and I don't understand this inherited code well enough to port it.

I've actually mostly been using numpy/scipy/matplotlib over Sage's matrices and plotting - they do seem mostly geared towards mathematicians and the numpy/scipy/matplotlib alternatives are often more flexible. But Sage offers a very nice environment to use these tools, and occasionally native Sage functions prove invaluable to me.

edit flag offensive delete link more


Concerning that last paragraph, I've seen many people use Sage for the same reason: it's a good Python interface. In fact, the Python-based finite element software, femhub ( uses a "standalone" version of the Sage notebook for its interface!

cswiercz gravatar imagecswiercz ( 2011-01-05 12:26:51 -0500 )edit

answered 2011-01-05 06:18:22 -0500

If you'd like a personal account of Sage being used in engineering, my fiance is a mechanical engineer at the University of Washington who is currently using Sage in her work. She does research in modeling chemical combustion reactors. (Or something like that.)

One of her main projects is to develop a reduced mechanism model of the reactions taking place. An approach she's looking into is a graph-theoretic approach: construct a digraph where the vertices are all of the major elements and molecules present in the reactor and the directed edges represent chemical dependencies / reaction directions. (E.g. formation of H20 requires the presence of hydrogen and oxygen.) The goal is to find a subgraph that models the reactor to a "close enough" accuracy from the full model.

Her work requires a substantial amount of numerics as well. Since Sage includes Numpy/Scipy (a powerful numerics package similar to Matlab) as well as powerful graph theoretic algorithms and interface, Sage has become her primary software fo choice for her research.

In general, I've found that many of my engineering colleagues use Matlab in their work. Numpy/Scipy is a free, open-source alternative. (You can use Numpy/Scipy/matplotlib independent of the Enthought Python Distribution via Sage.) They've all been more or less pleased when I showed them this Python-based alternative to Matlab. Also, I believe that Boeing has invited William Stein to give a talk or two about Sage at one of the Seattle/Everett plants so there exists some industrial interest in Sage as well.

edit flag offensive delete link more

answered 2011-01-08 06:50:34 -0500

mchamran gravatar image

Thanks for the input - I found the notes for the Boeing lecture here. I've read from others as well that they chose python/sage over programs like Matlab because it is an actual programming language. From my experience, many engineers (aerospace, mechanical, others...) have minimal backgrounds in programming and therefore the simplicity of languages like those offered by Matlab are very attractive. It allows them to focus more on the actual problem and less on the programming techniques.

After using Matlab, I admittedly find python/sage languages to be more complicated. Even the side-by-side code comparisons show Matlab code being generally shorter in length. Those that have a programming background can better appreciate and take advantage of the richness of the Python language. But for others without that background, the same 'richness' can prove to be a hurdle. Nevertheless, I'm still optimistic about integrating sage/python into my work.

edit flag offensive delete link more


If your background is primarily Matlab then I highly suggest looking at Numpy/Scipy for performing similar computations (i.e. numerics) instead of pure Python or, in some instances, Sage. The Numpy/Scipy developers try to match the functionality and syntax of Matlab while keeping everything "Pythonic". Even though Python is considered to be a "rich" language it's much easier to learn than a low-level language like C/C++ or FORTRAN. Give it a shot! :)

cswiercz gravatar imagecswiercz ( 2011-01-11 23:28:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-01-05 04:14:24 -0500

Seen: 1,235 times

Last updated: Jan 08 '11