Re: Want to 'Solve' a piecewise equation for a common term

• To: mathgroup at smc.vnet.net
• Subject: [mg79801] Re: Want to 'Solve' a piecewise equation for a common term
• From: Peter Breitfeld <phbrf at t-online.de>
• Date: Sun, 5 Aug 2007 04:48:37 -0400 (EDT)
• References: <f8v16h\$d96\$1@smc.vnet.net>

misnomer at gmail.com schrieb:
> 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?
>
>

You should use Reduce instead of Solve (and don't use N as a
variable, because it's a Mathematica built in function). So

temp = Piecewise[{
{2 n x , x < 0},
{n x, x >= 0}}]

Reduce[temp==1,n]

(x > 0 && n == 1/x) || (x < 0 && n == 1/(2*x))

Gruss Peter
--
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

• Prev by Date: how to collapse a cell in v.6
• Next by Date: Re: Re: Paul Abbott Chebyshev Article
• Previous by thread: Re: Want to 'Solve' a piecewise equation for a common term
• Next by thread: Integration with non-numeric parameters