# Mathcad vs MATLAB vs Maple vs Mathematica

• Mathematica
plot streamline for this equation y=(ψ-ax3 –cx)/b

hi

Please I need your help to plot in wolfram mathematica to plot streamline for this equation

To plot streamlines, we solve the given equation for either y as a function of x and c, or x as a function of y and c. In this case, the former is easier and we have

Equation for a streamline:
y=(ψ-ax3 –cx)/b
A=0.5
B=-2
C=-1.5

Thanks

Khashishi
I've used all of these. Different tools for different purposes.
Matlab is for number crunching. It's better for efficiently loading, analyzing, and plotting real data sets. By efficiently, I mean in terms of time spent writing code. Everything is a matrix, so it gets more clumsy when working with things which aren't matrices.
Mathematica is better for symbolic math, and for plotting continuous functions (as opposed to tabulated functions).
Mathcad seems to have a weird purpose, when demonstrating the calculation to someone else is important. It is kind of interesting since it has the appearance of working on a piece of paper, which perhaps makes it better for presenting the calculation and results to an audience. The audience doesn't have to read code to appreciate and understand what you have done. Since you can arrange expressions anywhere on the paper, you have artistic freedom in making it presentable.

• FactChecker and (deleted member)
Eh, I prefer Mathematica now after using it so much at UCLA. It's got a sort of Python/C++ feel to it. Here, it's the program that the physics department uses.

But I'm intrigued. Would it be easy to simulate, say, a number of particles bumping around in a box?
I haven't tried a project like that yet. One may have to develop a way to tell the particles to reverse the normal component of the velocity when it collides or hits a wall, and in the algorithm I have in mind, would involve continuously comparing the locations of the particles, and performing the reversal if the appropriate conditions are met. This may be a little tricky to implement with the conditional functions available in Mathematica. For instance, but correct me if I'm wrong, Mathematica doesn't have conditional "blocks" of code which execute together, something you'd commonly see in C++/Python.

On the other hand, you could easily set up equations of motion through Hamiltonian mechanics and solve them numerically, but that would limit you to conservative potentials. It seems like a stretch, but maybe you could use delta functions as potentials? Prof. Corbin taught us how to simulate N-bodies which interact via gravity during one of his workshops. It is definitely good for certain simulations.

For instance, but correct me if I'm wrong, Mathematica doesn't have conditional "blocks" of code which execute together, something you'd commonly see in C++/Python.
Do you mean like so?
C:
if (condition) {
//Do some stuff that needs multiple functions
}else{
//Do other stuff with multiple functions
}
You can do that with Mathematica using semi-colons

Code:
If[ condition,
(* Condition evaluates as true *)
temp = Table[ i, {i,1,100}];
tempSquared = Table[i^2, {i,1,100}];
tempSum=Sum[temp,{i,1,100}];
tempSumSquared = Sum[ tempSquared, {i,1,100}];
difference = tempSumSquared-tempSum; ,
(* Else block *)
temp = Table[ i, {i,1,100}];
tempCubed = Table[i^3, {i,1,100}];
tempSum=Sum[temp,{i,1,100}];
tempSumCubed = Sum[ tempCubed, {i,1,100}];
difference = tempSumCubed-tempSum;
]
It is harder to read in a notebook though.

Do you mean like so?
C:
if (condition) {
//Do some stuff that needs multiple functions
}else{
//Do other stuff with multiple functions
}
You can do that with Mathematica using semi-colons

Code:
If[ condition,
(* Condition evaluates as true *)
temp = Table[ i, {i,1,100}];
tempSquared = Table[i^2, {i,1,100}];
tempSum=Sum[temp,{i,1,100}];
tempSumSquared = Sum[ tempSquared, {i,1,100}];
difference = tempSumSquared-tempSum; ,
(* Else block *)
temp = Table[ i, {i,1,100}];
tempCubed = Table[i^3, {i,1,100}];
tempSum=Sum[temp,{i,1,100}];
tempSumCubed = Sum[ tempCubed, {i,1,100}];
difference = tempSumCubed-tempSum;
]
It is harder to read in a notebook though.
Yes, thanks for the correction. I didn't know you could do that. Does Mathematica have a simple way to implement more than two cases (in other words an equivalent to C++ "else if")?

As far as I know it doesn't exist. You should read the docs to make sure I didn't forget something.
You could define a similar function yourself though.

Thinking about it for a while you could hack something together using the Which-function from the docs.
This discussion should be a separate topic.

DrClaude
Mentor
Yes, thanks for the correction. I didn't know you could do that. Does Mathematica have a simple way to implement more than two cases (in other words an equivalent to C++ "else if")?
Since Mathematica executes different code depending on whether the condition is true or false,
the functionality of "else if" can be implemented by nested if's:
Code:
If [ , , If [ , , ] ]

I have been using octave instead of matlab. For the user, they seem almost the same, but octave is free software and matlab is proprietary.

• arcedia
I use Matlab for numerical calculations. The language is very easy. It is on the other side very expensive. I use Maple for symbolic calculations.

FactChecker