MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Any body can help me solve the equation with piecewise function

  • To: mathgroup at
  • Subject: [mg87082] Any body can help me solve the equation with piecewise function
  • From: "loveinla at" <loveinla at>
  • Date: Mon, 31 Mar 2008 02:04:52 -0500 (EST)


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? Of course, for this simple example, we can divide it into two cases and then compare the solutions after solving the two cases. Yet my problem is more general and involves more than 3 piecewise functions, thus a lot of possible cases to deal with. So any command or function to deal with this kind of general problem?

Thanks in advance.

  • Prev by Date: Re: Fast way to select those elements from a list that are in another
  • Next by Date: Re: Global setting of Graphics options for plot, listplot, listlogplot...
  • Previous by thread: FW: Minimum width of Button[.] on different platforms
  • Next by thread: Separate input/output files