Go to Google Groups Home    comp.soft-sys.math.mathematica
Want to 'Solve' a piecewise equation for a common term

misnomer@gmail.com <misno...@gmail.com>

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?