Skip to main content
1-Visitor
January 29, 2018
Solved

Absolute Value

  • January 29, 2018
  • 2 replies
  • 8594 views

I am having an issue with finding the max value of positive and negative values.  I want it to always pick the highest integer but to have it's sign remain the same.  

 

For instance,

x=10, y=15, z=-20 are my numbers calculated that 

 

t:=550*[max(x,y,z)] -p is depended on.

 

 if I do r:= max(x,y,z) it will state that r=15 when I need it to pick the worse case for an equation it will be integrated in later on. 

 

if I do r:= max(IxI,IyI,IzI) it will state r=20 but not -20 cause of the absolute value.

 

Is there a different approach I can do where I wouldn't have to use solve for t for each single case and pick the max absolute value of all three?

Best answer by LucMeekes

Define your own function maxabs:

LM_20180130_MaxAbs.png

Success!
Luc

2 replies

21-Topaz II
January 30, 2018

max(|x|,|y|,|z|)=max(x,y,z)

This is fallible but works most of the time

if test is true you have a positive number
if test is false you have a negative number

LucMeekes23-Emerald IVAnswer
23-Emerald IV
January 30, 2018

Define your own function maxabs:

LM_20180130_MaxAbs.png

Success!
Luc

12-Amethyst
January 30, 2018

Hi Luc. I guess that your solution is correct, just a margin note: If x = max(A) then -x = min(-A). 

Best regards.

 

Alvaro.