## 10 Reputation

7 years, 260 days

## How to change range on Contour Plot?...

Maple

Hi,
I don't understand how contourplot chooses it's view range. I would like a contour plot to go from r=0..10 and display axes from [-10..10, -10..10].

plots:-contourplot(r*sin(phi), r = 0 .. 10, phi = 0 .. Pi, coords = spherical, grid = [80, 80]);

doesn't produce a plot with range [-10..10]. Adding view doesnt compute anything differeently, just makes the axes bigger.plots:-

contourplot(r*sin(phi), r = 0 .. 10, phi = 0 .. Pi, coords = spherical, grid = [80, 80], view=[-10..10,-10..10]);

I want more contour lines near the endpoints of the range. why is it focused in the middle?

any help is appreciated,

Thanks!

## Sampling from multivariate probability d...

Maple

Hi All,

I have a fucntion f(x,y,z) = exp(-x^2 -y^2 - z^4) and would like to plot the probabity density in real space. One method would be to randomly sample points in a grid based on f(x,y,z). The function f(x,y,z) is clearly peaked around x=y=z=0, so you would expect many points to lie around there. So the plot would look like a clump near (0,0,0) which gets less dense away from (0,0,0).

In the worksheet below, I sampled points from the Uniform distribution to file in the 3d-plot. I would like these points to be sampled from f instead, but am not sure how to do this.

Any help is appreciated,

 > restart;
 > with(Statistics):
 > R := 10; # x-axis size N := 100; # Number f points to sample
 (1)
 > # Unnormalized Probability distrubution f := (x,y,z) -> exp(-x^2 -y^2 - z^2);
 (2)
 > # Clearly f is peaked at (0,0,0) and decays. Therefore I want a plot a lot of points near (0,0,0), and fewer points away from (0,0,0) plot3d(f(x,y,0), x = -1..1, y = -1..1);
 > X := Sample(Uniform(-R, R), N):
 > Y := Sample(Uniform(-R, R), N): Z := Sample(Uniform(-R, R), N): XYZ := Matrix([[X], [Y], [Z]])^%T;
 (3)
 > ScatterPlot3D(XYZ, color = blue, symbolsize = 20);
 >
 >
 >
 >