Re: Any body can help me solve the equation with piecewise function
- To: mathgroup at smc.vnet.net
- Subject: [mg87110] Re: Any body can help me solve the equation with piecewise function
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 1 Apr 2008 03:21:06 -0500 (EST)
On 3/31/08 at 2:04 AM, loveinla at gmail.com wrote: >I have a problem to solve, but it seems not easy because of the >piecewise function involved. I am wondering how we should deal with >piecewise function when solving an equation or doing optimization. >To give you an simple example, the piecewise function is f(x)= 3x if >x<0; f(x)= 0 if x>=0. And I want to solve the equation f(x)+6=0. >I actually define the piecewise function at first using "Which" and >then try to use "NSolve" to solve it. However, NSolve doesn't work >through. >Anybody know how should I solve this kind of problem generally in >Mathematica? How about using Reduce? For example, In[1]:= f[x_] = Piecewise[{{3 x, x < 0}, {0, x >= 0}}]; In[2]:= Reduce[f[x] + 6 == 0, x] Out[2]= x == -2