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

Solve equation with/without units

Highlighted
Participant

Solve equation with/without units

Hi All,

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

consider the below equation:

S1_0-1583935726727.png

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

Now I add units to the equation:

 

S1_1-1583935888826.png

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.

S1_2-1583936038212.png

 

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":

 

S1_3-1583936934369.png

 

another example for clarification:

S1_5-1583938015798.png

Thanks.

 

4 REPLIES 4
Highlighted

Re: Solve equation with/without units

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:

LucMeekes_0-1583939118932.png

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

Highlighted

Re: Solve equation with/without units

Hi Luc, thanks for your swift reply.

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

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

Highlighted

Re: Solve equation with/without units

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

 

LucMeekes_0-1583942319318.png

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

Highlighted

Re: Solve equation with/without units

 
 

2.png

Announcements