Skip to main content
1-Visitor
September 25, 2018
Solved

Define a multiple symbolic equation, solve it for one of the variables and plug in solve soln..

  • September 25, 2018
  • 1 reply
  • 7717 views

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.

This topic has been closed for replies.
Best answer by Fred_Kohlhepp

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)

1 reply

23-Emerald I
September 25, 2018

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,

     

Adesh1-VisitorAuthor
1-Visitor
September 25, 2018

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...

 

screenshot1.PNG

 

Attached is my update and I also added a screenshot. Thanks so much!

adesh

 

Adesh1-VisitorAuthor
1-Visitor
September 25, 2018

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

 

screenshot2.PNG