Jump to content

abs(x) ??

Featured Replies

hello,

so i'm currently working on a linear programme optimisation, and i was wondering if someone could help me with a bit of maths.

and i need to represent abs(x) in terms of a linear equation (so no root(x^2) allowed)

everyone knows what absolute(x) or |x| represents and it's pretty simple to do in your head, but I was wondering if there were any computational methods or equations for evaluating this?

also i'm looking specifically for a linear method so i cant have if statements and such

 

 

also are there any functions that result in

 

x = x if x>=0,

x = 0 if x<0

 

if so what is it called?

 

any help is appreciated, thanks

There is a function giving 1 for x>=0 (or x>0, I am not sure if there is a standard definition because for the usual applications it doesn't matter) and 0 else. It's called "step function", I think and usually denoted by [math] \theta(x) [/math]. The function you are looking for would simply be [math] x \cdot \theta(x)[/math], then.

 

Neither the absolute value nor the step function are linear functions, so I'd go as far as to say that they cannot be rewritten in terms of linear functions. Beyond that, I don't fully understand what you mean. It's obviously trivial to write a subroutine that serves as the functions you look for so it's probably not what you are looking for.

Edited by timo

If you want a function that gives 0 for x < 0 and x for x> 0:

 

[math]x (\frac{x}{2*|x|} + \frac{1}{2})[/math]

 

Careful though, it's undefined for x=0.

  • 2 weeks later...
also are there any functions that result in

 

x = x if x>=0' date='

x = 0 if x<0[/quote']

[math]f(x)=\dfrac{|x|+x}2[/math]

Okay, I consider myself owned :)

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.