Skip to main content
1-Visitor
December 10, 2015
Question

Positive and Negative result

  • December 10, 2015
  • 4 replies
  • 5511 views

Hi

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

d.png

4 replies

23-Emerald I
December 10, 2015

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

1-Visitor
December 11, 2015

Use keyword assume:

positive only.png

23-Emerald V
December 13, 2015

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

5-Regular Member
October 12, 2021

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.

21-Topaz II
July 22, 2016

allpositive.jpg