# Does line by line scientific calculations software exist?

November 17, 2009 9:26 AM Subscribe

Is there any computer based replacement for doing numerical engineering problems by hand?

As a Chemical Engineering undergraduate, I frequently have to hand up hard, long assignments.

A common problem for me is, having reached the end of calculations, realising a minor mistake at the start and having to write out everything again (since it's important to hand up a neat, clear report in general). It'd be nice to do the calculations on computer, before writing it out.

I've tried using Excel, but it's just not relationally smart enough. Here's what I'd like:

As a Chemical Engineering undergraduate, I frequently have to hand up hard, long assignments.

A common problem for me is, having reached the end of calculations, realising a minor mistake at the start and having to write out everything again (since it's important to hand up a neat, clear report in general). It'd be nice to do the calculations on computer, before writing it out.

I've tried using Excel, but it's just not relationally smart enough. Here's what I'd like:

- A linear workflow, just as you have on paper. Unknowns become knowns slowly and equations are repeated.
- For everything to be related, i.e. should a constant change, all calculations follow suit.

what digividal said

posted by kenbennedy at 9:36 AM on November 17, 2009

posted by kenbennedy at 9:36 AM on November 17, 2009

What do you mean by "numerical engineering"? Are you looking for a software platform in which to implement numerical algorithms? MATLAB is probably the easiest-to-use package for that kind of thing. Octave is a pretty good free MATLAB-alike. You should be able to do it in C or Fortran, though.

What do you mean by "line by line scientific calculations"? Generally on undergraduate homework assignments, there's a bunch of symbolic manipulation, and you plug in numbers at the last step to get a result. Are you looking for software that does the symbolic manipulation? There's Mathematica, and SAGE is an open-source computer algebra system that I've heard good things about, though I've never used it.

The way you've phrased this question, however, it seems like you're evaluating numerical quantities at every step of your solution. This isn't a great way to do things, as it invites rounding errors. But I don't see why you can't use a spreadsheet. What do you mean by "relationally smart enough"? You can do some pretty sophisticated stuff with Excel.

posted by mr_roboto at 9:37 AM on November 17, 2009

What do you mean by "line by line scientific calculations"? Generally on undergraduate homework assignments, there's a bunch of symbolic manipulation, and you plug in numbers at the last step to get a result. Are you looking for software that does the symbolic manipulation? There's Mathematica, and SAGE is an open-source computer algebra system that I've heard good things about, though I've never used it.

The way you've phrased this question, however, it seems like you're evaluating numerical quantities at every step of your solution. This isn't a great way to do things, as it invites rounding errors. But I don't see why you can't use a spreadsheet. What do you mean by "relationally smart enough"? You can do some pretty sophisticated stuff with Excel.

posted by mr_roboto at 9:37 AM on November 17, 2009

Excel can be used to model changes in constants and have updated calculations cascade through the model quite easily.

If you really want to explore using Excel I would post specific questions to an Excel discussion group, such as this one. It is populated by a lot of people who have a very deep knowledge of Excel.

That said, it would seem to me that something like Matlab or Mathematic would be the optimal solution.

posted by dfriedman at 9:37 AM on November 17, 2009

If you really want to explore using Excel I would post specific questions to an Excel discussion group, such as this one. It is populated by a lot of people who have a very deep knowledge of Excel.

That said, it would seem to me that something like Matlab or Mathematic would be the optimal solution.

posted by dfriedman at 9:37 AM on November 17, 2009

Been years since I have used it, but MathCad should do exactly what you want. Basically a live calculation word processor-like interface.

posted by crenquis at 9:38 AM on November 17, 2009

posted by crenquis at 9:38 AM on November 17, 2009

Yeah, the three big ones we used were Matlab, MathCad, or Mathematica. They each have slightly different purposes (Matlab being mostly-numerical, Mathematica being mostly-symbolic but very expensive).

Scilab is an open-source MatLab clone that you can try out if you don't want to spring for a commercial package. It's definitely got a learning curve if you're doing anything more complicated than arithmetic.

posted by muddgirl at 9:42 AM on November 17, 2009 [1 favorite]

Scilab is an open-source MatLab clone that you can try out if you don't want to spring for a commercial package. It's definitely got a learning curve if you're doing anything more complicated than arithmetic.

posted by muddgirl at 9:42 AM on November 17, 2009 [1 favorite]

Forgot to say that most Chemists and chemical engineers I know found MathCad to be the most useful, but also the hardest to learn how to use.

posted by muddgirl at 9:44 AM on November 17, 2009

posted by muddgirl at 9:44 AM on November 17, 2009

Mathematica is what you want.

posted by jeffamaphone at 9:48 AM on November 17, 2009

posted by jeffamaphone at 9:48 AM on November 17, 2009

Thanks for all the responses.

The main problem with using Matlab or similar (I assume—I've only used Matlab) is that I can't just do all the equation rearranging first and then plug in values. Often, for example, I'd need to something along the lines of the following:

I'm thinking of ways that I could use Excel/Matlab/Mathematica—MathCad in particular looks even more suitable—but I was hoping there might be something that worked in a real line by line way, with visual equations containing dynamic data.

posted by stepheno at 10:00 AM on November 17, 2009

The main problem with using Matlab or similar (I assume—I've only used Matlab) is that I can't just do all the equation rearranging first and then plug in values. Often, for example, I'd need to something along the lines of the following:

- Compute a dimensionless number based on a guessed quantity
- Plug this into a chart and read off a new variable
- Compute a new quantity which will tell me if I'm correct overall
- If not, back to 1.

I'm thinking of ways that I could use Excel/Matlab/Mathematica—MathCad in particular looks even more suitable—but I was hoping there might be something that worked in a real line by line way, with visual equations containing dynamic data.

posted by stepheno at 10:00 AM on November 17, 2009

Can you give a more concrete example? I would have set up a program in Matlab or scilab to do this exact thing using iterative calculations and a look-up table, but perhaps there's a step that I'm missing.

posted by muddgirl at 10:04 AM on November 17, 2009

posted by muddgirl at 10:04 AM on November 17, 2009

That's how Mathematica works. It's really, really different from MATLAB or Excel. It's a symbolic math doer, not a numerical calculation engine. It's also line-oriented. Also, your school probably has licenses to it you can use for free, or at least try it out (although, if its like my school, not enough, so you might need to try to use it at odd hours, like the middle of the day. Ahh, college.)

FWIW, your example might be pretty easy to do with MATLAB, depending on exactly what happens in Step 3. The other thing with matlab is its sort of a toolbox for numeric engineering, you may just need to learn the tools better. But its not a system for solving math problems. mathematica is.

posted by jeb at 10:07 AM on November 17, 2009

FWIW, your example might be pretty easy to do with MATLAB, depending on exactly what happens in Step 3. The other thing with matlab is its sort of a toolbox for numeric engineering, you may just need to learn the tools better. But its not a system for solving math problems. mathematica is.

posted by jeb at 10:07 AM on November 17, 2009

*The main problem with using Matlab or similar (I assume—I've only used Matlab) is that I can't just do all the equation rearranging first and then plug in values. Often, for example, I'd need to something along the lines of the following:*

1. Compute a dimensionless number based on a guessed quantity

2. Plug this into a chart and read off a new variable

3. Compute a new quantity which will tell me if I'm correct overall

4. If not, back to 1.

1. Compute a dimensionless number based on a guessed quantity

2. Plug this into a chart and read off a new variable

3. Compute a new quantity which will tell me if I'm correct overall

4. If not, back to 1.

**stepheno**, you're asking for symbolic calculation and manipulation. Mathematica was expressly designed to be good at that; undoubtedly it's the best tool in the world (possibly discounting the human brain) for that job.

Matlab can do it as well, however; the keyword "syms" is a variable type that does not expect real-world numbers. Thus:

*syms x*

x_squared = x*x

{OUTPUT}

x_squared = x*x

*x_squared = x^2*

Tutorial

Documentation

posted by IAmBroom at 10:12 AM on November 17, 2009

*stepheno, you're asking for symbolic calculation and manipulation.*

I don't see that. In the example he gave, he has the equations "rearranged" before he does any computation.

*The main problem with using Matlab or similar (I assume—I've only used Matlab) is that I can't just do all the equation rearranging first and then plug in values.*

Why isn't a spreadsheet appropriate for this? If you already have the equations in the form you're going to use, you enter them in the spreadsheet, and you get a new result each time you change the value of a variable. You then look up this result in a chart and enter the looked-up value in another cell to get a new final result.

Also, you can do this in MATLAB. You need to define your equation as a function with the variables as arguments. I think it would be easier with a spreadsheet, though.

posted by mr_roboto at 10:21 AM on November 17, 2009

EES is really convenient for doing quick calculations, especially those involving iteration to find a true value. It has simple ways of defining units and making sure they are correct, and has an equation view mode which shows it in a more convenient manner to check long equations.

That being said, MATLAB is also very capable, but ideal under different circumstances.

posted by JauntyFedora at 10:48 AM on November 17, 2009 [1 favorite]

That being said, MATLAB is also very capable, but ideal under different circumstances.

posted by JauntyFedora at 10:48 AM on November 17, 2009 [1 favorite]

I've never seen EES before - thanks JauntyFedora!

posted by muddgirl at 11:14 AM on November 17, 2009

posted by muddgirl at 11:14 AM on November 17, 2009

Emacs calc-mode has a paper trail on the right hand side. calc-mode is RPN and probably slightly more powerful than a high end HP calculator. It doesn't have any real graphing support though.

posted by chairface at 11:21 AM on November 17, 2009

posted by chairface at 11:21 AM on November 17, 2009

Nthing Mathcad.

It's perfect for this sort of thing.

It is definitely "linear", almost frustratingly so. Perfect for what you described. I used it extensively in my MechE undergrad (Matlab for real heavy lifting) and still use it occasionally now.

Printouts are pretty too, not as nice as, but definitely less work than LaTeX.

posted by KevCed at 12:04 PM on November 17, 2009

It's perfect for this sort of thing.

It is definitely "linear", almost frustratingly so. Perfect for what you described. I used it extensively in my MechE undergrad (Matlab for real heavy lifting) and still use it occasionally now.

Printouts are pretty too, not as nice as, but definitely less work than LaTeX.

posted by KevCed at 12:04 PM on November 17, 2009

Mathcad is exactly what you want. I assign engineering problems similar to the one you described, and I write my solutions using Mathcad, as do most of my students.

If by "chart" you mean some sort of functional relationship (which can be defined piecewise on different intervals, or even involve iterative approximation), Mathcad has a built-in equation solver which finds roots based on an initial guess or by inputting an interval where the root is known to be.

posted by Wet Spot at 1:04 PM on November 17, 2009

If by "chart" you mean some sort of functional relationship (which can be defined piecewise on different intervals, or even involve iterative approximation), Mathcad has a built-in equation solver which finds roots based on an initial guess or by inputting an interval where the root is known to be.

posted by Wet Spot at 1:04 PM on November 17, 2009

Also, Maple. Symbolic math manipulation and such. Save your worksheets and allows for notations and such. It is similar to Mathcad I am told.

posted by Feantari at 2:20 PM on November 17, 2009

posted by Feantari at 2:20 PM on November 17, 2009

Thanks so much everyone, really appreciate the help. I'll get down to trying some of these approaches now. Cheers!

posted by stepheno at 4:14 PM on November 17, 2009

posted by stepheno at 4:14 PM on November 17, 2009

You might also want to check out Maxima, which is an open-source (free) software package along the same lines as Mathematica.

You should be able to get a fairly inexpensive academic license for Mathematica (or any of the other packages).

posted by kenliu at 4:21 PM on November 17, 2009

You should be able to get a fairly inexpensive academic license for Mathematica (or any of the other packages).

posted by kenliu at 4:21 PM on November 17, 2009

This thread is closed to new comments.

posted by digividal at 9:29 AM on November 17, 2009 [2 favorites]