2
$\begingroup$

I'm a bit rusty in mathematics so I need your help please :)

I need a function $y$ that satisfies: $\begin{align*} y &= ax\\ y &= \left\{\begin{array}{ll} x &\text{if }x\geq 0;\\ 0 &\text{if }x\lt 0. \end{array}\right. \end{align*}$

Is there a way to do this? What should $a$ be like? I believe I need something that is $1$ for positive value and $0$ for negative.

Thank you

  • 0
    Please spend some effort making your titles informative. "Anybody know$a$way to" is **not** informative.2011-04-12

3 Answers 3

2

You can certainly define a function as $\begin {cases} y=ax \text{ if } x\ge 0 \\ y=0 \text{ if } x \lt 0 \end {cases}$. It follows the negative $x$ axis from the left to the origin, then slopes up at slope $a$ and you can choose $a$ to fit your needs (like $1$). I don't know any simpler way to express it.

  • 0
    Thank you for your answers, a friend just came about with the solution. all I needed is y = max(0,x).2011-04-12
1

What you have written is already a function. A function is anything such that, when given an input, to specifies exactly one output - there is no requirement that a function be given by a "formula" in terms of the input. For example, here is a function that takes in real numbers and outputs real numbers: $f(x)=\begin{cases}2x\text{ if }x>2\\5\text{ if }x=2\\(-1)^{\lfloor x\rfloor}\text{ if }0 It has no nice "formula" in terms of $x$, but it is still a function.

However, if you want something to write in place of $a$ to make the formula $y=a\cdot x$ do what you want, you can use the Iverson bracket, specifically $[x\geq0]=\begin{cases}1\text{ if }x\geq 0\\0\text{ if }x<0\end{cases}$

1

It is not absolutely clear what is asked for. But maybe what is wanted is $y=(x + |x|)/2$

  • 0
    And if one is allergic to $|x|$ it can be replaced by $\sqrt{x^2}$.2011-04-12