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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

5-Regular Member

## Solve equation with/without units

Hi All,

I am very new in Mathcad, have a very basic question.

consider the below equation:

Mathcad solves the equation and finds the "v" as is expected.

Now I add units to the equation:

I don't know why I don't get the same value here directly after "solve,v"?

In the following, I can return the value of "v" and get the values which are correct.

Is there any way to skip the part shows first within the [ ] and get the final answer?

In addition, Is it possible to rewrite the equation symbolically and get an expression for "v":

another example for clarification:

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald III
(To:S1)

Welcome to the forum.

The symbolic solver does not 'know units'. It will allow them, but treat them as unknown variables, at best.

In general you are better off first solving whatever problem you have symbolically, WITHOUT entering any values. Symbolically, means: using only symbols (as much as possible).

The symbolic solution will give you an expression, if you're smart you make it result in a function.

Now in that function, you can enter your numbers, including units, if you want.

Example:

Note that I entered the 1.4 as 14/10, that is to prevent the symbolic solver to go into floating mode, at which it will give numbers with ridiculously many digits.

(Where I said, you shouldn't use numbers, you can use integer values. But 'real' numbers, those with a point, should be avoided/replaced by symbols, pi and e are also known values to the symbolic solver.)

I guess the factor 1.4 is a parameter of some kind, then there should be a symbol for it. If by chance it is your approximation of the square root of two, it should be entered as the square root of two. Think of it this way: the symbolic solver knows mathematics, but not physics. And of course, mathematic rules state that the square root of 4 is 2, ... or -2 !)

Since your expression is quadratic, you get two (possible) solutions for every input. You may be able to bring that down to one, by adding assumptions. Maybe an "assume, v=positive" added to the solve command does the trick for you. Look up 'assume' in the help to see how to use it.

Success!
Luc

4 REPLIES 4
23-Emerald III
(To:S1)

Welcome to the forum.

The symbolic solver does not 'know units'. It will allow them, but treat them as unknown variables, at best.

In general you are better off first solving whatever problem you have symbolically, WITHOUT entering any values. Symbolically, means: using only symbols (as much as possible).

The symbolic solution will give you an expression, if you're smart you make it result in a function.

Now in that function, you can enter your numbers, including units, if you want.

Example:

Note that I entered the 1.4 as 14/10, that is to prevent the symbolic solver to go into floating mode, at which it will give numbers with ridiculously many digits.

(Where I said, you shouldn't use numbers, you can use integer values. But 'real' numbers, those with a point, should be avoided/replaced by symbols, pi and e are also known values to the symbolic solver.)

I guess the factor 1.4 is a parameter of some kind, then there should be a symbol for it. If by chance it is your approximation of the square root of two, it should be entered as the square root of two. Think of it this way: the symbolic solver knows mathematics, but not physics. And of course, mathematic rules state that the square root of 4 is 2, ... or -2 !)

Since your expression is quadratic, you get two (possible) solutions for every input. You may be able to bring that down to one, by adding assumptions. Maybe an "assume, v=positive" added to the solve command does the trick for you. Look up 'assume' in the help to see how to use it.

Success!
Luc

5-Regular Member
(To:LucMeekes)

Would you kindly answer the 2nd part of my question:

Is it possible to rewrite the equation symbolically and get an expression for "v"?

23-Emerald III
(To:S1)

Isn't that what my first function v(p,a) does?

As said, using/adding assumptions may result in getting you the first or second solution only. Be warned that in general it is hard to control the output of the symbolic solver.

As you can see from my pictures, I am using another version of Mathcad (Mathcad 11). I don't have a license for Prime, and am limited to the free Prime Express. This means I cannot use Prime symbolics and some other complicated stuff, such as the mean() function. But I can read whatever Prime file.

In general, when you post questions on this forum, you're advised to attach your sheet file. In case of problems that helps tremendously to debug, and prevents retyping.

Success!
Luc

20-Turquoise
(To:S1)

Announcements
Top Tags