Jump to content

Recommended Posts

Posted

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

Posted (edited)

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
Posted

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...
Posted
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]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

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.