Hello everyone
I apologize if this has been posted earlier (or if this is the wrong section), but I need help with Mathcad.
Having started college as an EE major last year, and restarting next year as a math major next year, math is obviously important for me to use. Mathcad is my preferred math software due to the simplicity of the program, and because it's not a programming language. I'm a horrible programmer, and I would go to great lengths to avoid programming. Originally, I thought that Mathcad couldn't solve differential equations, but after looking through the help files, I found Odesolve and other functions. The thing is, I can't see what the function is. The only "solution" I get is a graph, which won't be accepted as a proper answer to any problem here.
So how do I get Mathcad to return a function when solving ODE's ?
PS: I'm using Mathcad 14, but will upgrade if it's the only way to make this work.
Firstly welcome to the forum.
Would you be able to upload the worksheet you are working on?
Mike
I don't think you can solve ODE's symbolically, only numerically.
Mike
For this sort of ODE you can use Mathcad's symbolic Laplace transform functions to help get an analytical solution - see attached.
Alan
Alan;
Can you please post "Example 1b" as an RTF or pdf file? My 14.0 is choking on Step 1.
Thanks!!
Fred Kohlhepp wrote:
Alan;
Can you please post "Example 1b" as an RTF or pdf file? My 14.0 is choking on Step 1.
Thanks!!
Fred,
Here it is as a pdf. Because one expression on page 1 took up more than a page width, you'll need to put page 3 alongside page 1 for it to make sense!
Alan
I have (at work) an original, un-patched Version 14. (Yes, print preview still crashes the program.)
In THAT Mathcad, your step 1 is red, with no solution. I'll open it in 15 at home tonight, but thanks for the pdf, now I think I know what to look for.
Fred Kohlhepp wrote:
My 14.0 is choking on Step 1.
Strange! I actually used 15.0 to do the calcs, but I didn't think there was any difference between the symbolics in 14 and 15.
Alan
That looks good. I've downloaded both this and the .PDF . Thanks.
Good tutorial for you here.
http://learningexchange.ptc.com/tutorial/96/solving-an-ordinary-differential-equation-using-mathcad
Mike
You have solved for a function, you just don't realize it. (Need more practice with Mathcad!)
If you want the function that is the solution, that's another matter.
Hi Fred,
I haven't really used the UnitsOf() so I messed around a little with your example.
"Help" suggests you change to SIUnitsOf(), but does not seem to matter.
You can refer to the units of a variable to make the function independent of the units used, it's also more concise.
Also, you don't need to use in a graph.
Thanks for the example
Wayne;
I don't think there's any difference between UnitsOf() and SIUnitsOf() in the way they work in the solve block--they both force a "consistent" set of units by converting whatever units you have specified things in (inches, feet, furlongs) into a standard length unit (meters?) so that the equation is scaled properly. The reason the graph works (without multiplying by the SIUnitsOf() or UnitsOf() is illustrated by the place where you evaluate Z(2)/in = and get 1.438 (1/m) for an answer: Mathcad has applied the unit conversion to the answer. Graphs of values with units plot in default units without noting what the units should be; Z(2) evaluates to 0.037 (which we know to be meters by our superior intellect). When you plot Z(t)/in, Mathcad converted the numbers by the unit conversion, then ignored (on the graph) the 1/m implied units. That's why (when the plots look really strange) I want to type F(x)/(Units I expect the answer to be in) =, and hope to see (value I expected with no units beside it) for a result. When I see "Z(2)/in = 1.438/m" it indicates to me that the Z function isn't yielding a properly identified length.
Most of the time (when it isn't midnight and I'm not taking shortcuts) I'll create another function from Z:
defl(t) := Z(t/UnitsOf(sec)) * UnitsOf(in)
When I then define a time variable in minutes, hours, or fortnights, I can plot defl() against that variable and get inches, feet, or furlongs. Further, I can differentiate: defl(t)/dt and plot that result in in/sec, ft/min, or even furlong/fortnight (I've always wanted to squeeze that in!) and get the correct numeric value.
I tend to take a lot of time and effort to keep units straight--it keeps me honest and out of trouble.
I'll climb down off the soapbox now!
Fred
Thanks Fred,
I'll climb down off the soapbox now!
I don't get on top of soap boxes any more, because someone always kicks it out from under me.
However, I will stand on a corner in San Francisco, because everything goes and nobody cares.
I don't think there's any difference between UnitsOf() and SIUnitsOf()
I was just repeating what Mathcad said, but I like the old function better because its shorter. If I was going to use it a lot I might redefine it to even shorter.
I tend to take a lot of time and effort to keep units straight--it keeps me honest and out of trouble.
For consistent units though, If you use the UnitsOf(M), rather than UnitsOf(Mass Unit), it does not matter, lb or kip/g or slugs (popular one) or kN/g or some other user defined unit. Then you can get the same units used for the input variable back, y in miles, result z in miles. And, if you always want the result is a particular unit, then do as you suggest for the result.
But I usually use assumed units of kips and feet and always divide by those units to make unitless and multiply by same to get units back. But metric users probably don't like that. I will be looking at using this function more.
Wayne
Wayne Reid wrote:
For consistent units though, If you use the UnitsOf(M), rather than UnitsOf(Mass Unit), it does not matter, lb or kip/g or slugs (popular one) or kN/g or some other user defined unit. Then you can get the same units used for the input variable back, y in miles, result z in miles. And, if you always want the result is a particular unit, then do as you suggest for the result.
But I usually use assumed units of kips and feet and always divide by those units to make unitless and multiply by same to get units back. But metric users probably don't like that. I will be looking at using this function more.
Wayne
Open a new sheet and type "UnitsOf(in) ="
My Mathcad (with SI as default units) returns "1 m". And that's what it returns as long as I type a unit label into the brackets of the function; So when I divide by UnitsOf(in) I'm asking Mathcad to convert whatever is on top (hopefully a length) into meters and then divide the answer by 1 meter. If I happen to have a speed, the result will still have units, but whatever length unit was involved will have been converted to meters. Note that if I divide an area by UnitsOf(in), Mathcad converts to square meters, then divides by 1 meter, and the result is truly strange.
I have two points to belabor:
Maybe I'm missing something but the UnitsOf(x) function in your worksheet seems pointless.
To a none Mathcad user it could become very confusing.
Mike
Fred,
OK,
If you want to use an implicit set of units, just use them, don't need the function: If you expect k*ft for moment, divide by that and multiply the result by that.
After plying with the function a little, it takes substantially more effort than just using implicit units (either SI or US or user defined (like fps), and does not offer any more protection for a given class of problem.
FYI the UnitsOF() no longer works in the US system, must us SIUnitsOf.
The only advantage of the function that I can see is, for example, you want a function that can be used to operate on different problems wherein the variables can have different dimensions. (just like the solvers)
For example solving a system of equations can be used for mixed variables, (ex. axial-flexural stiffness or all length ) so if you were to make a program or set of calculations that can handle different classes of problems, you could use the SIUnitsOF() to strip the units.
If you use SI, and you know the variable must be length, just divide by m, why divide by SIUnitsOf(m), its the same, exactly the same.?
The only reason for using the function is if you don't always know the dimensions of the variable,
At least that's my take to date.
Wayne
Wayne Reid wrote:
Fred,
OK,
If you want to use an implicit set of units, just use them, don't need the function: If you expect k*ft for moment, divide by that and multiply the result by that.
After plying with the function a little, it takes substantially more effort than just using implicit units (either SI or US or user defined (like fps), and does not offer any more protection for a given class of problem.
FYI the UnitsOF() no longer works in the US system, must us SIUnitsOf.
The only advantage of the function that I can see is, for example, you want a function that can be used to operate on different problems wherein the variables can have different dimensions. (just like the solvers)
For example solving a system of equations can be used for mixed variables, (ex. axial-flexural stiffness or all length ) so if you were to make a program or set of calculations that can handle different classes of problems, you could use the SIUnitsOF() to strip the units.
If you use SI, and you know the variable must be length, just divide by m, why divide by SIUnitsOf(m), its the same, exactly the same.?
The only reason for using the function is if you don't always know the dimensions of the variable,
At least that's my take to date.Wayne
I just had an issue; one of my co-workers sent an EXCEL spreadsheet that was a performance map of a propeller. Since he was a "performance" guy, he put everything in coefficient form. People in the business know that coefficients are unitless. He listed the units in his spreadsheet, "speed in ft per second, torque in ft lb," etc. Since I needed actual loads I took the coefficients, put in values for the flight conditions, and solved for the loads; the answers were rediculous!
The Problem? His units were not consistent. When I typed his values with his units into MathCad I got a different value for coefficient than he had. When I divided velocity by "ft per sec" and used that number (those numbers!) I got the same coefficient values that he had. In order to back out thrust, torque, and power, I had to reverse engineer his coefficient computations.
The built-in variable "g" in Mathcad isn't 32.2 or 9.8. It comes with a set of units attached that allows us to have the correct numeric value for whatever units we want. That is the use of the function--to develop a consistent set of values when we need to put dimensions through a numeric solver that doesn't recognize them. By using this function we strip the units, AND put them back with consistency.
Fred,
I think we are talking past each other a little.
I don't take units lightly either. I am just noting that I don't need the SIUnitsOf() function to do that, I only need that function if I were to write a routing to solve a general problem which could be used to solve different classes of problems in which I need to allow for different dimensions, and so need the function to find what the dimensions of the particular variables are.
I am fine with using the function, just that for most applications, its easier just to divide by the expected or desired units, and multiply by the same. For the solvers, I do this also.
Wayne Reid wrote:
I am fine with using the function, just that for most applications, its easier just to divide by the expected or desired units, and multiply by the same. For the solvers, I do this also.
I often get problems with units in different flavors.Eliminating units by diviiding by the units supplied may make the values sent to the solvers wrong, leading to errors in the solution. My only point was that by using UnitsOf() I can use mathcad to keep the units consistent, and stop worrying about it.
I have attached a sheet that shows this problem. (Remember, one of my favorite things about mathcad is the free, automatic unit conversion.)
If you can work in consistent units then great, more power to you. I'm too old to start now!
It was the function i was looking for.
EDIT: About the symbolic evaluation, and the lack of a value of t, it was to show what I had tried to get the function I was looking for. The other example you sent to me was good though.
Hello!
I think following link will also be useful ("Inside Mathcad Series: Programming, Solving, and ODE Solvers"):
I'll have a look at it. Thanks.