New Reply

Case function in Mathematica

 
Share Thread Thread Tools
Dec24-11, 05:38 AM   #1
 

Case function in Mathematica


Does anyone familiar with a convenient way in Mathematica to define a case function such as:

[itex] y(x)=\left\{\begin{array}{c} x \\ -x\end{array}\begin{array}{c} x>0 \\ x<0\end{array}
\right. [/itex]
?

Thankes,
Omri
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Bird's playlist could signal mental strengths and weaknesses
>> Minus environment, patterns still emerge: Computational study tracks E. coli cells' regulatory mechanisms
>> Bacterium uses natural 'thermometer' to trigger diarrheal disease, scientists find
Dec24-11, 05:56 AM   #2
 
You want to use 'Piecewise':

y[x_]:=Piecewise[{{x,x>0},{-x,x<0}}]
Dec24-11, 08:47 AM   #3
 
Thankes,
It's very helpful :)
New Reply
Thread Tools


Similar Threads for: Case function in Mathematica
Thread Forum Replies
Mathematica play function fun Fun, Photos & Games 0
sum function in mathematica Math & Science Software 2
Give to an interpolation function an analitic function with mathematica Math & Science Software 1
how to use solve function in matlab in this case Math & Science Software 0
Special case of four variable logic function (k-maps) Engineering, Comp Sci, & Technology Homework 1