MathGroup Archive 1998

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

Search the Archive

Re: defining "regions"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14838] Re: defining "regions"
  • From: "rod" <unforgettable20 at hotmail.com>
  • Date: Fri, 20 Nov 1998 02:14:23 -0500
  • Organization: [posted via] Easynet UK
  • References: <72588n$8an@smc.vnet.net> <72l699$hfn$2@dragonfly.wolfram.com>
  • Sender: owner-wri-mathgroup at wolfram.com

M. Rommel wrote in message <72l699$hfn$2 at dragonfly.wolfram.com>...
>I am sure it is not the most beautiful solution (it reflects my current
>level of expertise):
>
>In[18]:=        pts={{1,2},{3,4},{1,5}}; In[19]:=
>F=(Abs[#[[1]]]<Pi/2)&&(Abs[#[[2]]]<Pi)&; In[20]:=        F[{1,3}]
>Out[20]=    True
>In[17]:=        F/@pts
>Out[17]=    {True,False,False}
>
>Let me know when you find a more elegant solution! Cheers, Martin

Here's a more general solution that uses a function "inset" which checks
if a set of points in Rn belong piecewise to coresponding convex sets
in R1.

inset[xy_,field_]:=Module[{order,cond},
  order=Range[Length[field]];
  cond=Map[field[[#,1]]<xy[[#]]<field[[#,2]]&,order];
  Apply[And,cond]
 ];

For a specific example, consider the regions given by Naum (points in
R2), with a very simple function F:

test[x_]:=infield2[x,{{-Pi/2,Pi/2},{-Pi,Pi}}] (* determines a more
specific tests infield2 *)

F[x_?test]:=Module[{theta,fi},
  theta=x[[1]];
  fi=x[[2]];
  {theta^2,fi+theta}
 ];

We have then for example:
In[12]:=F[{1,1}]
Out[12]={1,2}
In[13]:=F[{10,0}]
Out[13]=F[{10,0}]

cheers, rod

---------------------------------------- ma re bes da re. as ba re!
----------------------------------------



  • Prev by Date: Re: Looking for Packages
  • Next by Date: Re: Making a large matrix
  • Previous by thread: Re: defining "regions"
  • Next by thread: creating distributions