You are not logged in.
Suppose
y = x^3 + 3x^2 for x < 0
and
y = 4x^4 + 4x for x >= 0
~~~~
This can be written as a single equation
y = (x^2 + 3x)(|x|-x)/2 + (4x^3 + 4)(|x|+x)/2
~~~~~~
the piece times (|x|-x)/2x is 1 when x<0 and 0 when x>0
the piece times (|x|+x)/2x is 1 when x>0 and 0 when x<0
The only problem is when x = 0, because both pieces in the sample equation all of at least one x in there term, we just factored this out to avoid the issue. Let's say we don't have this option, can we still avoid the problem?
try
y=5x for x < 0
y = x^2 + 3x for x >= 0
~~~~~~~~
Is it then possible to avoid every possible piecewise defined function by turning it into a single equation. (Granted |x| is piecewise defined, but we ignore that as the only acceptable one)
Offline
|x| is piecewise defined
Here is the point, dude.
Deducting others to this one doesn't necessarily make the case simpler.
X'(y-Xβ)=0
Offline
True, but you can get around that by using something like √(x²) instead.
That doesn't make piecewise definitions unnecessary though.
As neonash says, there's usually a problem when x=0. I think that's probably fixable with a bit of thought, but there are still more complicated functions that wouldn't be covered.
eg. f(x) = {0, if x<1
{1, if x=1
{2, if x>1
Even if you manage to get that working, there are even more functions that still wouldn't work.
I don't think you could possibly define this function without going piecewise:
f(x) = {1, if x is rational
{0, otherwise
Why did the vector cross the road?
It wanted to be normal.
Offline
True, but you can get around that by using something like :sqrt(x²) instead.
Doesn't x=√(x²) have two solutions?
You can shear a sheep many times but skin him only once.
Offline
In fact, heaviside function is more often used.
H(x-t)=1 when x>=t, =0 when x<t
X'(y-Xβ)=0
Offline
I think the √ sign is usually defined to only take the positive square root.
If you want both then you'd use ±√.
Why did the vector cross the road?
It wanted to be normal.
Offline
In fact, heaviside function is more often used.
Right George, the standard name that I normally hear is the "jump", "bump", or "step" function. Given this single function, you can represent any finite piecewise function as a product of functions.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Offline