Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Want to 'Solve' a piecewise equation for a common term

View Parsed - Show only message text

Path: g2news2.google.com!news1.google.com!news.glorb.com!indigo.octanews.net!news-out.octanews.net!mauve.octanews.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From: Jean-Marc Gulliet <jeanmarc.gull...@gmail.com>
Newsgroups: comp.soft-sys.math.mathematica
Subject: Re: Want to 'Solve' a piecewise equation for a common term
Date: Sat, 4 Aug 2007 10:17:56 +0000 (UTC)
Organization: The Open University, Milton Keynes, UK
Sender: st...@smc.vnet.net
Approved: Steven M. Christensen <st...@smc.vnet.net>, Moderator
Message-ID: <f91jok$7mt$1@smc.vnet.net>
References: <f8v16h$d96$1@smc.vnet.net>
Lines: 56
NNTP-Posting-Date: 04 Aug 2007 10:17:05 GMT
NNTP-Posting-Host: 61ab30f5.news.twtelecom.net
X-Trace: DXC=2PX:fH9VfmIN>O;:SV[lhFC_A=>8kQj6M14\NmbkV;iM4J9\A\26YaFEFiONJ7[GoFnb=o]VJMNYM
X-Complaints-To: abuse@twtelecom.net

misno...@gmail.com wrote:
> I've been battling to try to get a solution to my equation, but it
> requires solving of a piecewise function, which I cannot work out how
> to do. Say I have a piecewise function of the form
> 
> temp = Piecewise[{
>      { 2*N*x, x < 0},
>      { N*x,    x >= 0}
> }]
> 
> I want to either solve this via
> Solve[1==temp, N]
> and either get, with the inequalities,
> 
> N -> Piecewise[{
>     {1/(2*x), x < 0},
>     {1/x, x >= 0}
> }]
> 
> or just get mathematica to realise that there is a common term - N,
> and factor it out to, say,
> N * Piecewise[{
>      {2*x, x < 0},
>      {x, x >= 0}
> }]
> from where solve can handle it perfectly well.
> 
> Is this type of operation possible, or am I stuck editing them by hand?

Use *Reduce* for it knows how to handle correctly expressions with 
*Piecewise*.

In[1]:= temp = Piecewise[{{2*n*x, x < 0}, {n*x, x >= 0}}];
Reduce[1 == temp, n]

Out[2]= (x > 0 && n == 1/x) || (x < 0 && n == 1/(2 x))

In[3]:= Reduce[1 == n*Piecewise[{{2*x, x < 0}, {x, x >= 0}}], n]

Out[3]= (x > 0 && n == 1/x) || (x < 0 && n == 1/(2 x))

*Solve* does /not/ know what to do with *Piecewise*.

In[4]:= Solve[1 == n*Piecewise[{{2*x, x < 0}, {x, x >= 0}}], n]

Out[4]= {{n -> 1/\[Piecewise] {
      {2 x, x < 0},
      {x, x >= 0}
     }}}

(Also, note that I have replaced capital N by n because N has already a 
built-in meaning.)

Regards,
Jean-Marc


Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google