Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Solve and Piecewise Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76435] Re: Solve and Piecewise Functions
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Tue, 22 May 2007 02:49:44 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f2rqtl$9u1$1@smc.vnet.net>

Michael Madrid wrote:
> I was hoping something like this: 
>    
>    
>   Clear["*"]
>   g=Piecewise[{{0,x<0},{2 x-x^2,0<=x<4},{16 x-x^2,x³4}}]
>   h=x-2;
>   Solve[gÅ h,x]
>    
>    
>   would give me a meaningful answer.  But all I get is this:
>    
>    
>   Solve[\[Piecewise]{
>   {0, x<0},
>   {2 x-x2, 0£x<4},
>   {16 x-x2, x³4}
>   }Å -2+x,x]
>    
>   Any thoughts on how to do this?
> 

Use Reduce rather than Solve.

In[1]:=
Clear["Global`*"]
g[x_] = Piecewise[{{0, x < 0}, {2*x - x^2,
       Inequality[0, LessEqual, x, Less, 4]}},
     16*x - x^2];
h[x_] = x - 2;
Reduce[g[x] == h[x], x]

Out[4]=
x == 2 || x == (1/2)*(15 + Sqrt[233])

Regards,
Jean-Marc


  • Prev by Date: Re: Weird result in Mathematica 6
  • Next by Date: Re: Weird result in Mathematica 6
  • Previous by thread: Re: Solve and Piecewise Functions
  • Next by thread: Re: Solve and Piecewise Functions