From: Andrej on
Hi,

this is my first post to this group. Yes, I'm a newbie in Mathematica.
I'm trying to compute the probability of circular disc (in R^2).
Suppose that vertical and horizontal deviations from the center of the
disc follows bivariate normal distribution. I hope that the code below
is self explained. The main issue is the transformation from Cartesian
to polar coordinates as follows:

# First I set up the appropriate bivariate normal distribution:
Needs["MultivariateStatistics`"]
X = {x1, x2};
mu = {0, 0};
Sigma = sigma^2 ({{1,rho}, {rho,1}});
dist = MultinormalDistribution[mu, Sigma];
cond = {sigma > 0, -1 < rho < 1, r > 0, 0 < theta < 2 \[Pi]};
f = Simplify[PDF[dist, X], cond]
domain[f] = {{x1, -\[Infinity], \[Infinity]}, {x2, -\[Infinity], \
[Infinity]}} && cond;

# Transformation to polar coordinates:
Omega = {x1 \[RightArrow] r Cos[theta], x2 \[RightArrow] r
Sin[theta]};
g = Simplify[(f /. Omega) Jacob[X /. Omega, {r, theta}], cond]

And the message I get:

ReplaceAll::reps: {x1\[RightArrow]r Cos[theta],x2\[RightArrow]r
Sin[theta]} is neither a list of replacement rules nor a valid
dispatch table, and so cannot be used for replacing. >>

Thanks in advance for any suggestions or pointers.

Best, Andrej

From: David Park on
You don't want to use \[RightArrow]! The arrow that is used in rules is
entered as "->" (but without the quotes) and Mathematica automatically
converts it to an arrow (but not a \[RightArrow]).

omega = {x1 -> r Cos[theta], x2 -> r Sin[theta]}
% // FullForm

{x1 -> r Cos[theta], x2 -> r Sin[theta]}
List[Rule[x1, Times[r, Cos[theta]]], Rule[x2, Times[r, Sin[theta]]]]


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/


From: Andrej [mailto:andrej.kastrin(a)gmail.com]

Hi,

this is my first post to this group. Yes, I'm a newbie in Mathematica.
I'm trying to compute the probability of circular disc (in R^2).
Suppose that vertical and horizontal deviations from the center of the
disc follows bivariate normal distribution. I hope that the code below
is self explained. The main issue is the transformation from Cartesian
to polar coordinates as follows:

# First I set up the appropriate bivariate normal distribution:
Needs["MultivariateStatistics`"]
X = {x1, x2};
mu = {0, 0};
Sigma = sigma^2 ({{1,rho}, {rho,1}});
dist = MultinormalDistribution[mu, Sigma];
cond = {sigma > 0, -1 < rho < 1, r > 0, 0 < theta < 2 \[Pi]};
f = Simplify[PDF[dist, X], cond]
domain[f] = {{x1, -\[Infinity], \[Infinity]}, {x2, -\[Infinity], \
[Infinity]}} && cond;

# Transformation to polar coordinates:
Omega = {x1 \[RightArrow] r Cos[theta], x2 \[RightArrow] r
Sin[theta]};
g = Simplify[(f /. Omega) Jacob[X /. Omega, {r, theta}], cond]

And the message I get:

ReplaceAll::reps: {x1\[RightArrow]r Cos[theta],x2\[RightArrow]r
Sin[theta]} is neither a list of replacement rules nor a valid
dispatch table, and so cannot be used for replacing. >>

Thanks in advance for any suggestions or pointers.

Best, Andrej



From: Patrick Scheibe on
Hi,

if you want to replace something, then you have to use a Rule or a
RuleDelayed! Paste to following into a notebook

Rule[a, b]
a -> b
RuleDelayed[a, b]
a :> b

and see, that this has *nothing* to do with an \[RightArrow]. Changing
this and your sample is syntactically correct:

Needs["MultivariateStatistics`"]
X = {x1, x2};
mu = {0, 0};
Sigma = sigma^2 ({{1, rho}, {rho, 1}});
dist = MultinormalDistribution[mu, Sigma];
cond = {sigma > 0, -1 < rho < 1, r > 0, 0 < theta < 2 \[Pi]};
f = Simplify[PDF[dist, X], cond]
domain[f] = {{x1, -\[Infinity], \[Infinity]}, {x2, -\[Infinity],
\[Infinity]}} && cond;

Omega = {x1 :> r Cos[theta], x2 :> r Sin[theta]};
g = Simplify[(f /. Omega) Jacob[X /. Omega, {r, theta}], cond]


Cheers
Patrick


On Sun, 2010-02-14 at 05:58 -0500, Andrej wrote:
> Hi,
>
> this is my first post to this group. Yes, I'm a newbie in Mathematica.
> I'm trying to compute the probability of circular disc (in R^2).
> Suppose that vertical and horizontal deviations from the center of the
> disc follows bivariate normal distribution. I hope that the code below
> is self explained. The main issue is the transformation from Cartesian
> to polar coordinates as follows:
>
> # First I set up the appropriate bivariate normal distribution:
> Needs["MultivariateStatistics`"]
> X = {x1, x2};
> mu = {0, 0};
> Sigma = sigma^2 ({{1,rho}, {rho,1}});
> dist = MultinormalDistribution[mu, Sigma];
> cond = {sigma > 0, -1 < rho < 1, r > 0, 0 < theta < 2 \[Pi]};
> f = Simplify[PDF[dist, X], cond]
> domain[f] = {{x1, -\[Infinity], \[Infinity]}, {x2, -\[Infinity], \
> [Infinity]}} && cond;
>
> # Transformation to polar coordinates:
> Omega = {x1 \[RightArrow] r Cos[theta], x2 \[RightArrow] r
> Sin[theta]};
> g = Simplify[(f /. Omega) Jacob[X /. Omega, {r, theta}], cond]
>
> And the message I get:
>
> ReplaceAll::reps: {x1\[RightArrow]r Cos[theta],x2\[RightArrow]r
> Sin[theta]} is neither a list of replacement rules nor a valid
> dispatch table, and so cannot be used for replacing. >>
>
> Thanks in advance for any suggestions or pointers.
>
> Best, Andrej
>


From: bsyehuda on
\[Rule] and \[RightArrow] appear identically on screen. Replace the the
\[RightArrow] with \[Rule] (shortcut is ESC -> ESC, but better always is ->
only )

after this change it would work.

yehuda

On Sun, Feb 14, 2010 at 12:58 PM, Andrej <andrej.kastrin(a)gmail.com> wrote:

> Hi,
>
> this is my first post to this group. Yes, I'm a newbie in Mathematica.
> I'm trying to compute the probability of circular disc (in R^2).
> Suppose that vertical and horizontal deviations from the center of the
> disc follows bivariate normal distribution. I hope that the code below
> is self explained. The main issue is the transformation from Cartesian
> to polar coordinates as follows:
>
> # First I set up the appropriate bivariate normal distribution:
> Needs["MultivariateStatistics`"]
> X = {x1, x2};
> mu = {0, 0};
> Sigma = sigma^2 ({{1,rho}, {rho,1}});
> dist = MultinormalDistribution[mu, Sigma];
> cond = {sigma > 0, -1 < rho < 1, r > 0, 0 < theta < 2 \[Pi]};
> f = Simplify[PDF[dist, X], cond]
> domain[f] = {{x1, -\[Infinity], \[Infinity]}, {x2, -\[Infinity], \
> [Infinity]}} && cond;
>
> # Transformation to polar coordinates:
> Omega = {x1 \[RightArrow] r Cos[theta], x2 \[RightArrow] r
> Sin[theta]};
> g = Simplify[(f /. Omega) Jacob[X /. Omega, {r, theta}], cond]
>
> And the message I get:
>
> ReplaceAll::reps: {x1\[RightArrow]r Cos[theta],x2\[RightArrow]r
> Sin[theta]} is neither a list of replacement rules nor a valid
> dispatch table, and so cannot be used for replacing. >>
>
> Thanks in advance for any suggestions or pointers.
>
> Best, Andrej
>
>


From: Bob Hanlon on

The symbol for Rule that looks like a RightArrow is not entered as RightArrow.
It is the infix form of Rule and is entered as -> (minus sign followed by greater than) and will display as a RightArrow in TraditionalForm.

Look at the documentation for Rule.


Bob Hanlon

---- Andrej <andrej.kastrin(a)gmail.com> wrote:

=============
Hi,

this is my first post to this group. Yes, I'm a newbie in Mathematica.
I'm trying to compute the probability of circular disc (in R^2).
Suppose that vertical and horizontal deviations from the center of the
disc follows bivariate normal distribution. I hope that the code below
is self explained. The main issue is the transformation from Cartesian
to polar coordinates as follows:

# First I set up the appropriate bivariate normal distribution:
Needs["MultivariateStatistics`"]
X = {x1, x2};
mu = {0, 0};
Sigma = sigma^2 ({{1,rho}, {rho,1}});
dist = MultinormalDistribution[mu, Sigma];
cond = {sigma > 0, -1 < rho < 1, r > 0, 0 < theta < 2 \[Pi]};
f = Simplify[PDF[dist, X], cond]
domain[f] = {{x1, -\[Infinity], \[Infinity]}, {x2, -\[Infinity], \
[Infinity]}} && cond;

# Transformation to polar coordinates:
Omega = {x1 \[RightArrow] r Cos[theta], x2 \[RightArrow] r
Sin[theta]};
g = Simplify[(f /. Omega) Jacob[X /. Omega, {r, theta}], cond]

And the message I get:

ReplaceAll::reps: {x1\[RightArrow]r Cos[theta],x2\[RightArrow]r
Sin[theta]} is neither a list of replacement rules nor a valid
dispatch table, and so cannot be used for replacing. >>

Thanks in advance for any suggestions or pointers.

Best, Andrej


--

Bob Hanlon