       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:=        pts={{1,2},{3,4},{1,5}}; In:=
>F=(Abs[#[]]<Pi/2)&&(Abs[#[]]<Pi)&; In:=        F[{1,3}]
>Out=    True
>In:=        F/@pts
>Out=    {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[];
fi=x[];
{theta^2,fi+theta}
];

We have then for example:
In:=F[{1,1}]
Out={1,2}
In:=F[{10,0}]
Out=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