Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hello.
I'm sorry if this question is asked before, but I am having a hard time finding examples for something I expect to be basic function of Mathcad. (using Mathcad Prime 5).
I see many basic examples of defining, solving for symbols, but the examples are just one-line,one-variable solutions that just write a equation, solve in one line and stop there.
I'm trying to setup some equations with symbols only (variables not previously defined), then solve for one of the variables, then plug in this solved variable into other equations to solve.
Example, I'm trying to use the slope-deflection method to solve for reactions on a beam. If I predefine almost all the variables, then no problem... if I try to do this symbolically, it doesn't work.
For examples, let's say I do
a2(x) := 50mm + 450mm - x
Now I want to say b2 = 1000mm - a2 << a2 having the symbolic x & Mathcad does not like this.
...
Another example, I have defined
Mba (E, I, L1, Thetab) := 2 * E * I /L1 * (bla bla bla)
Mbc (E, I, L2, Thetab) := 2 * E * I /L2 * (bla bla bla)
Now I want to define Mba + Mbc = 0 and solve for Thethab... and I want to save this result as Thethab so I can plug it back into equations above... having trouble doing this.
However, if instead of doing Mba + Mbc = 0, I do
[2 * E * I /L1 * (bla bla bla)] + [2 * E * I /L2 * (bla bla bla)] = 0 ----> Solve Thethab, then Mathcad gives the solution solved for Thethab.... but I don't know how to plug this solution back into other equations without copy pasting the result Mathcad spit out.
Attached is a file of examples of what I am trying to accomplish. Thanks very much in advance.
Solved! Go to Solution.
First, let me say that Mathcad is primarily a numeric program; it has a very old, cantankerous, limited symbolic engine attached. Trying to get a symbolic solution will be challenging and frustrating!
Second, the second in-line evaluation (the equals sign at the end of a definition) has been shown to have problems in previous editions. It will only work at the end of a function definition if all of the arguments of the function have a defined value.
Third, while I don't like it, Prime with labels will allow the same name for a function and a variable. See attached. (Prime 4.0 express)
a2(x) := 50mm + 450mm - x
Now I want to say b2 = 1000mm - a2 << a2 having the symbolic x & Mathcad does not like this..
Let's start here. a2(x) = 50mm+450mm -x is a FUNCTION. a2 by itself could be a variable but you probably get a "not defined" error message. So your second line doesn't make sense to Mathcad.
You could evaluate: a2(10mm) = and you would get .49m, or 490 mm. A function takes whatever value is in the parenthesis, plugs it in wherever the x appears and returns a numeric result. So b2(x) := 1000mm-a2(x) would work to create a second function, or b2:1000mm-a2(10mm) would return 510mm,
Hi Mr. Fred. Thank you so much for your response. Very helpful explanation ... it makes sense, though I still got an error on the creating a new function using a previously defined function part...
I understand if I define a function if I put parenthesis before ':=' and evaluating a2(100mm) does work - good!
I can solve for a value and set the solution equal to a variable - good!
However, I tried the b2(x) := 1000mm - a2(x) and is tells me 'x' in the parenthesis of a2 is undefined.
If I do b2(x):=1000mm - a2, it does not work either...
Attached is my update and I also added a screenshot. Thanks so much!
adesh
Sorry... I see now why I was getting the error... I can define:
b2(x) = 1000mm - a2(x), but I'm not allowed to put an '=' after that and expect Mathcad to simplify it to
1000mm - (50mm + 450mm - x). Maybe I can if I use the simplify function it might work...
I will see if I can get the rest of my worksheet working with what you taught me. It helps a lot. Thanks! adesh
What you want is totally possible with Mathcad (and Prime):
Success!
Luc
First, let me say that Mathcad is primarily a numeric program; it has a very old, cantankerous, limited symbolic engine attached. Trying to get a symbolic solution will be challenging and frustrating!
Second, the second in-line evaluation (the equals sign at the end of a definition) has been shown to have problems in previous editions. It will only work at the end of a function definition if all of the arguments of the function have a defined value.
Third, while I don't like it, Prime with labels will allow the same name for a function and a variable. See attached. (Prime 4.0 express)
Hi Mr. Fred.
Yes thank you. I see what you mean.
I got the worksheet to work sort of... the symbolic solutions are very ugly prior to plugging in any numbers if I attach any units to the variables. No units works better. Note that my equations are relatively simple and if I do by hand, the symbolic solutions are very clean.
I am a bit disappointed MathCad is unable to do this well given how pricey it is, but I guess I will try to keep everything numeric as possible in the future. Maple is much better for solving symbolic I guess.
thanks for all your help! adesh
with units - looks like MathCad can't combine units properly when solving
no units
> with units - looks like MathCad can't combine units properly when solving
The reason for this is that Mathcads symbolics does not know anything about units.
There is a switch in Prime to add unit support in symbolics - maybe it helps (most of the time it doesn't).
Furthermore you would have to tell the symbolics the relationship between mm and m and between N and kN by adding some "assume" statements to the symbolic evaluation like "assume,mm=10^-3m".
Thank you very much! I will give the 'assume' function a try.
adesh