Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hi
I get positive and negative result for my answer which is understandable but I only want the positive result to display.
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.)
Use keyword assume:
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.