MathGroup Archive 2007

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

Search the Archive

Re: piecewise functions from logical relationships (ie. solving with constraints)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81250] Re: piecewise functions from logical relationships (ie. solving with constraints)
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Tue, 18 Sep 2007 00:28:29 -0400 (EDT)
  • References: <fclb12$fdk$1@smc.vnet.net>

On Sep 17, 2:40 am, "Ben Lewis" <benjamin.r.le... at gmail.com> wrote:
> G'day all,
>
> Say I have an equation that defines some arbitrary relationship between
> two variables x and y (or N equations and 2N variables), and furthermore
> that I know a specific region for which the relationship is one-to-one
> and onto. In other words, some function f (such that y=f[x]) and it's
> inverse g (x=g[y]) are mathematically well-defined in that region by my
> equation. Is there then any way to obtain both functions using Mathematica?
>
> I want the specific functions (f and g) so that, for particular points
> in the region, I can change (coordinate) variables in either direction,
> and also to compute various derivatives of these functions (particularly
> the Jacobian matrix).
>
> For example:
>
> eq := y+1/2==Mod[x+0.1,1]
> constr := -1/2<y<1/2 && 0<x<1 && y!=-0.4 && x!=0.9
>
> Reduce produced output in a different form:
> (x==2/5+y && -2/5<y<1/2) || (x==7/5+y && -1/2<y<-2/5)
>
> Something in a form like "g->Mod[#+2/5,1]&" would be ideal, or
> similarly: "x->Piecewise[{{2/5+y,-2/5<y<1/2},{7/5+y,-1/2<y<-2/5}}]".
>
> -Ben

I dunno how you made Reduce give you that answer (I didn't try very
long), but, since you have it:

In[1]:= (x==2/5+y&&-2/5<y<1/2)||(x==7/5+y&&-1/2<y<-2/5)/.{Or-
>List,And[Equal[l_,r_],cond_]:>(l/;cond->r)}
Out[1]= {x/;-(2/5)<y<1/2->2/5+y,x/;-(1/2)<y<-(2/5)->7/5+y}



  • Prev by Date: Re: plotmarkers in Listplot
  • Next by Date: Re: Replace in Modules
  • Previous by thread: piecewise functions from logical relationships (ie. solving with constraints)
  • Next by thread: Re: piecewise functions from logical relationships (ie. solving with constraints)