Re: Jagged Spine (MultinormalDistribution)
- To: mathgroup at smc.vnet.net
- Subject: [mg82972] Re: Jagged Spine (MultinormalDistribution)
- From: m.r at inbox.ru
- Date: Mon, 5 Nov 2007 05:04:38 -0500 (EST)
- References: <fgk9or$pl6$1@smc.vnet.net>
On Nov 4, 5:17 am, Bruce Colletti <vze26... at verizon.net> wrote: > Re 6.0.1 under WinXP. > > The spine of the bivariate normal distribution below is jagged, even when PlotPoints is set to 50 (took awhile to build). Altering MaxRecursions is likewise no help. > > Is there a way to get a quickly-plotted smooth spine without resorting to high values of PlotPoints? Thankx. > > Bruce > > Needs@"MultivariateStatistics`"; > > Plot3D[PDF[MultinormalDistribution[{0, 0}, {{5, -3},{-3, 2}},{x, y}], {x, -4, 4}, {y, -4, 4}, PlotRange -> All, > PlotPoints -> 50] Without Evaluate you're calling PDF for every function evaluation inside Plot. Also, you can reduce the quadratic form in the exponential to the principal axes and then you will need to refine the sampling only along one dimension: <<MultivariateStatistics` phi = ArcTan @@ First@ Eigenvectors[ {{-1, -3/2}, {-3/2, -5/2}}, 1] // Simplify; f[x_, y_] = PDF[ MultinormalDistribution[{0, 0}, {{5, -3}, {-3, 2}}], {x, y}] /. Thread[{x, y} -> RotationMatrix[phi].{x, y}] // Simplify Show[MapAt[Rotate[#, phi, {0, 0, 1}]&, Plot3D[f[x, y], {x, -6, 6}, {y, -6, 6}, PlotPoints -> {100, 25}, PlotRange -> All], 1], PlotRange -> {{-4, 4}, {-4, 4}, All}] Maxim Rytin m.r at inbox.ru