This content has been marked as final.
Show 18 replies

Mathcad, Mathematica, Matlab, and maple
superres May 16, 2006 12:00 AM (in response to Wavedisabled)On 5/16/2006 4:05:54 PM, Wave wrote:
>which one are you guys using?
>
>
>�Tell me and I�ll forget;
>�Show me and I�ll remember;
>�Involve me and I�ll
>understand
>�Ancient Chinese Proverb
It depends on the situation. I've got Mathcad, Matlab, and Excel. Small tabular things are often easiest to manipulate in Excel. Mathcad is usually my tool of choice, mainly because most of the problems I work on fit well in Mathcad.
I've also got Mathematica 4.0, but have yet to really need to get it installed.
TTFN,
Eden
Mathcad, Mathematica, Matlab, and maple
Wavedisabled May 19, 2006 12:00 AM (in response to superres)For a Aeronautical Engineering major (and maybe double in Mechanical Engineering), which one is best to play around with it now?
___________________________
�Tell me and I�ll forget;
�Show me and I�ll remember;
�Involve me and I�ll understand
�Ancient Chinese Proverb
Mathcad, Mathematica, Matlab, and maple
superres May 19, 2006 12:00 AM (in response to Wavedisabled)On 5/19/2006 2:22:52 AM, Wave wrote:
>For a Aeronautical Engineering
>major (and maybe double in
>Mechanical Engineering), which
>one is best to play around
>with it now?
>___________________________
>�Tell me and I�ll forget;
>�Show me and I�ll remember;
>�Involve me and I�ll
>understand
>�Ancient Chinese Proverb
Still very broad strokes here
Mathcad has a Roark and Young formulas module; works really well with units.
Matlab has Simulink and modules for control systems, etc.
TTFN,
Eden



Mathcad, Mathematica, Matlab, and maple
Wavedisabled May 16, 2006 12:00 AM (in response to superres)which one are you guys using?
�Tell me and I�ll forget;
�Show me and I�ll remember;
�Involve me and I�ll understand
�Ancient Chinese Proverb 
Mathcad, Mathematica, Matlab, and maple
superres May 16, 2006 12:00 AM (in response to superres)Mathcad > most like a Swiss Army knife or a Weatherman combo tool. Does everything equally well, or bad, depending on your perspective.
Matlab > matrix manipulations are its forte.
Neither of the above are particularly strong at symbolic math
Mathematica and Maple > symbolic math
TKSolver > parametric numerical problems; table oriented
CalcCenter > a scaled down version of Mathematica
Almost all of the programs have student pricing for fullcapability versions of the software.
TTFN,
Eden 
Mathcad, Mathematica, Matlab, and maple
superres May 16, 2006 12:00 AM (in response to Wavedisabled)On 5/16/2006 5:06:46 AM, Wave wrote:
>what are the differences in
>those softwares? which one is
>more powerful? is it better to
>stick with one
>software?
�Tell me and I�ll
>forget;
�Show me and I�ll
>remember;
�Involve me and I�ll
>understand
�Ancient Chinese
>Proverb
A simple answer: would you only have a single screwdriver?
"Power" like most other things in life is relative. Love and Anger are both "powerful" emotions, but should you only stick with one or the other?
You might also add Mathematica's CalcCenter and UTS' TKSolver as other potential tools.
TTFN,
Eden 
Mathcad, Mathematica, Matlab, and maple
Wavedisabled May 19, 2006 12:00 AM (in response to superres)when is it not broad?
___________________________
�Tell me and I�ll forget;
�Show me and I�ll remember;
�Involve me and I�ll understand
�Ancient Chinese Proverb
Mathcad, Mathematica, Matlab, and maple
superres May 19, 2006 12:00 AM (in response to Wavedisabled)On 5/19/2006 2:49:27 AM, Wave wrote:
>when is it not broad?
>___________________________
>�Tell me and I�ll forget;
>�Show me and I�ll remember;
>�Involve me and I�ll
>understand
>�Ancient Chinese Proverb
If you're talking a specific problem in a specific field.
It's equivalent to asking what's the best tool for building a house. You'd need a full toolbox for that.
If you ask about what's the best tool(s) for installing a stove, you could probably get an answer in reasonable detail.
TTFN,
Eden
Mathcad, Mathematica, Matlab, and maple
TKHunny May 27, 2006 12:00 AM (in response to superres)Your real answer, I think, is the one that makes the most sense to you and does what you want it to do. If there are similar capabilities, familiarity may be the deciding factor. You can talk an research forever. If you don't get your hands on something and try it out, you'll never really know.
My 2�
Mathcad, Mathematica, Matlab, and maple
Wavedisabled May 28, 2006 12:00 AM (in response to TKHunny)so tk is back. I haven't seen him in ages...too busy?
but actually I need a dollar. 2 cent isn't satisfactory...
_____________________________
�Tell me and I�ll forget;
�Show me and I�ll remember;
�Involve me and I�ll understand
�Ancient Chinese Proverb
Mathcad, Mathematica, Matlab, and maple
Wavedisabled Oct 13, 2007 12:00 AM (in response to Wavedisabled)Can someone demonstrate part (b) and (c) using mathcad to me? maybe Tom can help me with this. can mathcad do row operations if one program it to?
This should be easy if I use those black boxes in matlab but unfortunately I have to do it the long way. I got 95 lines just to finish part (a)!! About 10 lines if I use those neat commands in matlab.
I think I need to find a matlab forum.
problem_pr2.doc 20.0 K

Mathcad, Mathematica, Matlab, and maple
TomGutman Oct 13, 2007 12:00 AM (in response to Wavedisabled)Hi. Long time no sea.
I don't know how long a long way you have to use, but 95 lines seems a bit much for part a. Perhaps you need to spend a bit more time in the Mathcad documentation and the collaboratory.
Here's my take on part a. It's done mostly for MC11 (I don't remember what version you have) although one example is for MC13.
Solving the tridiagonal system in Mathcad is a cinch, if you just ignore the tridiagonal structure and apply lsolve. I don't know the Thomas algorithm, but I do have an efficient solver embedded in my cubic spline routines. I don't have time to extract it right now (other things to do  I'll probably have some time a bit later).
Part c is underspecified (as written  there may be more context that makes it clearer). What sort of fit? How many knots, and where located? There are many ways to use a spline, of whatever order, to fit points. Mathcad has built in facilities for linear and cubic interpolations, with the knots at the data points, but not quadratic. jmG has plastered the forum with Bsplines, using the given points as control points (which attract the curve, but are not usually on it). With a bit of work you can do least squares fit, once you specify the desired constraints. With the knots at the data points and continuity of one less than the spline order you get an interpolation (you have enough degrees of freedom to fit the points exactly).
� � � � Tom Gutman
xx(1073).mcd 24.7 K







Mathcad, Mathematica, Matlab, and maple
Wavedisabled Oct 13, 2007 12:00 AM (in response to TomGutman)I think if I use loops then part (a) would be done faster. I'm restricted to write all the codes out without using most of the built in functions. It really makes me appreciate all of those built in functions. Thanks.
Mathcad, Mathematica, Matlab, and maple
TomGutman Oct 14, 2007 12:00 AM (in response to Wavedisabled)I've had a bit of time, and here are solutions to part b. I have three solutions: An explicit solution based on inspection of the system, a direct solution based on Mathcad's matrix algebra capabilities, and an efficient solution based on a general tridiagonal solver (but tailored to this system, just as the model was tailored to the system for cubic spline interpolation). I don't know the Thomas algorithm (at least not by name) so don't know how close this solution is to what is asked for.
The comparison of single precision and double precision is not possible in Mathcad  Mathcad in designed to maximize the chances of a correct answer and is not interested in how to get an incorrect answer.
The spline part remains ambiguous. And I don't have the equations for a parabolic spline interpolation (I expect that is something that would have been covered either in class or in your textbook).
How much of advanced language facilities are you allowed to use? If it turns out that the restrictions are essentially to what is included in a basic C compiler (without added libraries) then you might as well use C. Mathcad is a great math tool, but a poor C.
� � � � Tom Gutman
xx(1077).mcd 24.6 K

Mathcad, Mathematica, Matlab, and maple
Wavedisabled Oct 15, 2007 12:00 AM (in response to TomGutman)I can use fortran, C, C++, matlab, etc. to do these projects. But the thing is my knowledge of the first 3 languages is poor. I tried self learning it, but it wasn't easy. So I use matlab. Regardless of any languages being used, I would still have to put it in matlab. The professor wants everyone to do these types of problems the primitive way.
So far I finished part a and b and only linear spline of part c. Sigh my sweet weekend is taken away by this homework.
I actually don't know the Thomas Algorithm too. The stuff was covered in class but the TA or professor never mentioned anything about that.
Anyway for the splines. Quadratic spline is defined by
y(i)=a(i)+b(i)*(xx(i))+c(i)*(xx(i))^2
where the parenthesis is meant y_{i} and same for a,b,c and x.
so at x(i), y(i)=a(i)
which satisfies the first condition.
at x(i+1),
y(i+1)=a(i)+b(i)*(x(i+1)x(i))+c(i)*(x(i+1)x(i))^2
and the derivative of y(i+1) is
y'(i+1)=a(i)+b(i)+2*c(i)*(x(i+1)x(i)
for y' to be continuous, y'(i+1)=b(i+1)
now I have no idea how to find b(i+1),b(i) and c(i). I think dx=(x(i+1)x(i)) and dy=y(i+1)+y(i) are given so there are 3 unknowns to find.
There is another method to do this. Using the forward difference and backward difference and then average the two. Again I have no idea how to do that either. At least not in matlab.
Is it possible to transfer your work in mathcad to matlab?



Mathcad, Mathematica, Matlab, and maple
TomGutman Oct 15, 2007 12:00 AM (in response to Wavedisabled)>>Is it possible to transfer your work in mathcad to matlab?<<
Most likely. Although I don't know Matlab and so don't know what would be involved. The program structures should transfer fairly directly. Just about all programming languages have a for loop (or equivalent) and array subscripts. Range variable loops might have to be converted to explicit for loops  depends what sort if iterators are provided for. I would expect Matlab to have the equivalent of lsolve. But would you be allowed to use it? What about matrix inverses? Mathematically lsolve(M,V)=M^{1}·V (although lsolve is generally faster and more accurate). Can you use a built in matrix inversion function?
I gather that the splines you are looking for are interpolating splines. Some thoughts on the quadratic:
Quadratics require three parameters. But they can be parameterized in many ways. The coefficients of the power expansion is one way, but often not the simplest one.
One parameterization that might be useful here is the values at the two end points and the derivative at the starting point. You should be able to work out an equation for the value at any point given these values (you can see something similar in my cubic splines worksheet, where I work out the derivations, over in the Mathcad collaboratory). And you should be able to work out the derivative at the end point, again given these three values. For the spline, you can assign an arbitrary value for the derivative at the first point. That will establish the value of the derivative at the second point and, by C^{1} continuity the derivative at the first point of the second quadratic. Thus the quadratic for the second interval is determined. You can continue this to get the quadratics for all the intervals. You are thus left with one degree of freedom, the initial derivative, and have to choose some criterion for deciding what it should be.
Tom Gutman
Mathcad, Mathematica, Matlab, and maple
Wavedisabled Oct 16, 2007 12:00 AM (in response to TomGutman)>What about matrix
>inverses? Mathematically
>lsolve(M,V)=M1�V
>(although lsolve is generally
>faster and more accurate).
>Can you use a built in matrix
>inversion function?
Nope can't use inverse function, inv(A). The first project was done by handsolving 2v2 system and 3x3 systemand then use it to get the generalized method to solve for any 2x2 or 3x3 system. Finding inverse using cofactor, using gausejordan, and solving using elimination, and solving using Cramer's rule. It was painful to type out the determinant for 3v3 matrix. The solution process was quite primitive. We used single(x) and double(x) to measure the error. In C/C++ float and double were used.
>I gather that the splines you
>are looking for are
>interpolating splines. Some
>thoughts on the quadratic:
Yep. What is so great about cubic spline? in matlab there are linear spline function and cubic spline function, but there is no quadratic spline function.
>You should be
>able to work out an equation
>for the value at any point
>given these values (you can
>see something similar in my
>cubic splines worksheet, where
>I work out the derivations,
>over in the Mathcad
>collaboratory). And you
>should be able to work out the
>derivative at the end point,
>again given these three
>values. For the spline, you
>can assign an arbitrary value
>for the derivative at the
>first point.
It would be nice if you can direct me to the specific files that you are referring to. thanks.


Mathcad, Mathematica, Matlab, and maple
TomGutman Oct 16, 2007 12:00 AM (in response to Wavedisabled)>>Yep. What is so great about cubic spline? in matlab there are linear spline function and cubic spline function, but there is no quadratic spline function.<<
Not really much point to quadratic splines. You'll notice that Mathcad has the same  a linear spline (linterp) and three cubic splines (and I have a further two of those). Most theoretical algorithms require C^{2} continuity, provided by cubic splines, whereas quadratic splines only provide C^{1} continuity. And because the equations involved turn out to be a tridiagonal system, it's almost as fast to do the cubic splines as the quadratic splines  both will have a linear time for the precalculation. And since cubic splines have two spare degrees of freedom the arbitrary condition to resolve them can be symmetric on both ends  much more elegant. Oh, and the cubic spline has a particularly elegant parameterization, where two values stored at each node (y and y'') provide the four parameters for each interval.
>>It would be nice if you can direct me to the specific files that you are referring to. thanks.<<
Just search the Mathcad collaboratory for cubic splines and my name. You should find the post. The base file name is "cubic splines.mcd", but there have been several versions so there will be a parenthesized version number (added by the collaboratory), and I don't remember how high that went. Or post in the collaboratory and I can try to find the relevant post. Links to posts don't work well across collaboratories.
Tom Gutman