cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Solving with several unknown variables

SOLVED
Highlighted
Visitor

Solving with several unknown variables

Why can't MathCAD solve this equation? It obviously works after simplifying it manually first as shown in the last step. But how can i get MathCAD to do it in the previous step?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Solving with several unknown variables

Ah, I think I see the problem. You're trying to have the symbolic solver find m.Rd and you are using units. You should be aware that the symbolic solver does not know units, it treats each unit as an undefined variable. Prime's numeric processor knows, and can transform units as required, but the symbolic solver does nothing with/to them  In some cases, depending on the equation, they will cancel out, and then it does not hinder the symbolic processor...

 

Attached is a different approach, using the root function (Prime 4)

Success!
Luc

View solution in original post

16 REPLIES 16
Highlighted

Re: Solving with several unknown variables

The problem might occur because you are using a variable named delta, that is undefined. Mathcad assumes that it's the delta function, which requires an argument...

 

You can change delta to be a variable, by setting its label (see the ribbon) accordingly.

 

Success!
Luc

 

 

Highlighted

Re: Solving with several unknown variables

I have tried changing delta to variable, replacing it with an other letter and even defining it as "1".

But nothing works.

Highlighted

Re: Solving with several unknown variables

What is the error message that you get from the first symbolic 'solve'?

Highlighted

Re: Solving with several unknown variables

This variable is undefined. Check that the label is set correctly. 

Highlighted

Re: Solving with several unknown variables

Ah, I think I see the problem. You're trying to have the symbolic solver find m.Rd and you are using units. You should be aware that the symbolic solver does not know units, it treats each unit as an undefined variable. Prime's numeric processor knows, and can transform units as required, but the symbolic solver does nothing with/to them  In some cases, depending on the equation, they will cancel out, and then it does not hinder the symbolic processor...

 

Attached is a different approach, using the root function (Prime 4)

Success!
Luc

View solution in original post

Highlighted

Re: Solving with several unknown variables

So you are saying that it's pure luck when the solver get units right like in this example?

Highlighted

Re: Solving with several unknown variables


@Rafael1 wrote:

So you are saying that it's pure luck when the solver get units right like in this example?


Absolutely!  The symbolics engine doesn't understand units, so if it comes out right it's a happy accident.  At first look in your example the units look wrong; but you got lucky:

Capture.PNG

 

Highlighted

Re: Solving with several unknown variables

Does the root function always work with units?

Highlighted

Re: Solving with several unknown variables


@Rafael1 wrote:

Does the root function always work with units?


"root" is a numeric function.  Mathcad numerics deal properly with units.  

Highlighted

Re: Solving with several unknown variables

In Mathcad 11 root is not per se a numeric function:

LM_20190103_Root.png

I haven't found examples of Prime (trying) to use root symbolically...

 

Luc

Highlighted

Re: Solving with several unknown variables

Mathcad 15 and also Prime will not accept the 2-argument flavor of "root" but insist on using the 4-argument form. There is no logic in doing so as the symbolic evaluation of "root" does NOT require the function values of the end points of the interval to be of opposite sign and will happily return all roots within that interval.

What hast changed concerning symbolic evaluation are at least two things:

1) We cannot evaluate a solve block sybolically

2) We cannot copy a symbolic evaluation inside a program

 

Mathcad 15:

B2.png

Prime 5:

B1.png

Highlighted

Re: Solving with several unknown variables

That explains why I did not find examples in the help files using the root function symbolically. The preferred method is to use the solve keyword.

What happens if you set the two range parameters wrongly, like 0, 2  (does it find one root...) or -1, 1 (no roots) ?

 

Luc

Highlighted

Re: Solving with several unknown variables


@LucMeekes wrote:

That explains why I did not find examples in the help files using the root function symbolically. The preferred method is to use the solve keyword.

What happens if you set the two range parameters wrongly, like 0, 2  (does it find one root...) or -1, 1 (no roots) ?

 

Luc


In case of interval [0;2] both MC15 and P5 return correctly just the one solution in this interval.

In case of [-1;1] only P5 fails with no solution found. MC15 strangely switches into float mode and returns both solutions. Only when start and end value are the same, MC15 fails, too.

B1.png                     B2.png

The very same behaviour is shown by the symbolic "solve" in conjunction with "assume":

B3.png     B4.png

Highlighted

Re: Solving with several unknown variables

Mathcad 11's symbolics knows the bracketed root function, but:

LM_20190105_Root.png

Luc

Highlighted

Re: Solving with several unknown variables

Other than that, your equation is indeed simple. Here's how Mathcad can solve it fully symbolically:

LM_20181202_Problem.png

Note that delta is not part of the solution, so can be any value that does not lead to (other) problems.

Success!
Luc

 

Highlighted

Re: Solving with several unknown variables

Your problem is basically that you define variables using an unknown, then you solve symbolically for this unknown and then you expect all those defined variables magically have their appropriate value based on the now solved for variable.

Thats not the way Mathcad works. It will never go back to a variable definition and insert a value for a variable which was calculated or assigned later. If you want this to be done, you have to define a function instead of a variable.

Her is a simplified version of your problem as I understand it

B0.png

and her a three possible solutions/work-arounds:

1) Simply assign the solved for value to the appropriate variable and repeat/copy the variable definitions which will happily use the calculated value now.

B1.png

2) Turn your variable definitions into functions as this is the mathematical construct which changes its value depending on one ore more input arguments

B2.png

3) Do without the symbolic solve and use a numeric solve block instead. Note the picture below is erratically missing a guess value for x (we don't get an error because x was already assigned a value before in my sheet)!. Note that you have to "find" all variables which depend on the unknown, even though you might not be interested in all of them

B3.png

 

Announcements