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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Positive and Negative result

agarson
1-Newbie

Positive and Negative result

Hi

I get positive and negative result for my answer  which is understandable but I only want the positive result to display.

d.png

5 REPLIES 5

Don't use the symbolic solver (not because it gave you the wrong answer--because it gave you BOTH right answers.  Use your high school math to realize that V is the square root of P*r.  The square root function will only give you a positive value (or an imaginary number.)

ViktorKorobov
13-Aquamarine
(To:agarson)

Use keyword assume:

positive only.png

Viktor
StuartBruff
23-Emerald II
(To:agarson)

Aaron Garson wrote:

Hi

I get positive and negative result for my answer  which is understandable but I only want the positive result to display.

An alternative is to try a Solve Block instead of the symbolic processor.

The Solve Block (SB) on the left is a straight forward, one-off SB that returns the value of V for the pre-defined values of P and r.

The SB on the right uses a function definition to both pass P and r into the SB as arguments, and to return the value.

Stuart

Symbolic evaluation will always first try to solve the problem symbolically. In some cases it will also try to solve it numerically if solving symbolically was not possible or applicable to specific problem.

Solve blocks always use some numeric method to solve the problem.

Hope that helps to choose the right tool.

-MFra-
21-Topaz II
(To:agarson)

allpositive.jpg

Top Tags