Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Want to 'Solve' a piecewise equation for a common term
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
misnomer@gmail.com  
View profile   Translate to Translated (View Original)
 More options 3 Aug 2007, 11:48
Newsgroups: comp.soft-sys.math.mathematica
From: "misno...@gmail.com" <misno...@gmail.com>
Date: Fri, 3 Aug 2007 10:48:49 +0000 (UTC)
Local: Fri 3 Aug 2007 11:48
Subject: Want to 'Solve' a piecewise equation for a common term
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dimitris  
View profile   Translate to Translated (View Original)
 More options 4 Aug 2007, 10:59
Newsgroups: comp.soft-sys.math.mathematica
From: dimitris <dimmec...@yahoo.com>
Date: Sat, 4 Aug 2007 09:59:32 +0000 (UTC)
Local: Sat 4 Aug 2007 10:59
Subject: Re: Want to 'Solve' a piecewise equation for a common term
On 3    , 13:48, "misno...@gmail.com" <misno...@gmail.com> wrote:

Do not use symbols that already are used as built in symbols.

In[55]:=
Information[N]

>From In[55]:=

"N[expr] gives the numerical value of expr. N[expr, n] attempts to
give a result with n-digit precision."

>From In[55]:=

Attributes[N] = {Protected}

N /: Default[N, 2] := {MachinePrecision, Infinity}

So, how about

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

Out[57]=
Piecewise[{{2*n*x, x < 0}, {n*x, x >= 0}}]

In[59]:=
Reduce[temp == 1, n]

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

Cheers
Dimitris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jean-Marc Gulliet  
View profile   Translate to Translated (View Original)
 More options 4 Aug 2007, 11:17
Newsgroups: comp.soft-sys.math.mathematica
From: Jean-Marc Gulliet <jeanmarc.gull...@gmail.com>
Date: Sat, 4 Aug 2007 10:17:56 +0000 (UTC)
Local: Sat 4 Aug 2007 11:17
Subject: Re: Want to 'Solve' a piecewise equation for a common term

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Breitfeld  
View profile   Translate to Translated (View Original)
 More options 5 Aug 2007, 09:48
Newsgroups: comp.soft-sys.math.mathematica
From: Peter Breitfeld <ph...@t-online.de>
Date: Sun, 5 Aug 2007 08:48:24 +0000 (UTC)
Local: Sun 5 Aug 2007 09:48
Subject: Re: Want to 'Solve' a piecewise equation for a common term
misno...@gmail.com schrieb:

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

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