Tag Info

Hot answers tagged

5

Gamma is an extremely quickly increasing function, so you're dealing with the ratio of huge numbers here. Something similar to catastrophic cancellation can happen. Fortunately, Mathematica is very good at dealing with this situation if you let it use arbitrary precision instead of machine precision. Change 0.5 to 1/2 and add something like ...


4

While @Szabolcs has provided the correct work-around, the actual issue has to do with automatic use of Compile for function evaluation. The affected range is such that the value of Gamma[1+n] is still a machine real, but their product is out-of-bound. The issue comes, because the default setting of Compile's RuntimeOptions is to tolerate machine arithmetic ...


4

Also PlotRange[plot] PlotRange /. AbsoluteOptions[plot] Last @@ AbsoluteOptions[plot, PlotRange] PlotRange /. plot[[2]] all give (* {{0.,10.},{-0.999999,1.}} *) Note: Regarding usage of PlotRange as a function, it is undocumented, and the earliest reference I could find on this site is this answer dated Oct 11, 2012: The same range on each plot in a ...


4

rw = Accumulate@RandomChoice[{-1, 1}, 400]; ListLinePlot[rw, AspectRatio -> 1] rw2 = Transpose[{rw[[ ;; 200]], rw[[201 ;; ]]}]; llp2 = ListLinePlot[rw2, AspectRatio -> 1] To rotate llp2: Show[MapAt[GeometricTransformation[#, RotationTransform[-45 Degree]] &, llp2, {1}], PlotRange -> All] Aside: Using InterpolationOrder->0 ...


3

ListLinePlot[Accumulate @ Prepend[RandomChoice[{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}, 1000], {1, 1}], AspectRatio -> Automatic] Starting with some random data rd = RandomChoice[{1, -1}, 2000]; ListLinePlot[Accumulate@rd] Creating a random walk similar to the one shown in your question rw = Accumulate@Transpose[{rd[[;; 1000]], rd[[1001 ...


3

First question answered, here we go with LegendMarkerSize: legend = LineLegend[styles, {"f", "g"}, LegendMarkerSize -> 5]; Second question answered: Customize a Grid for the legend using the Spacing option and use it in LegendLayout. Play around with Spacing values for horizontal and vertical adjustments. Here we go table[pairs_] := Grid[pairs, ...


3

You can add Specularity to the ColorFunction. Here is a Manipulate you can play with to figure out what settings you prefer: Manipulate[ Plot3D[Exp[-x^2 - y^2], {x, -3, 3}, {y, -3, 3}, PlotPoints -> 50, PlotRange -> All, PlotRangePadding -> None, ColorFunction -> (Directive[Specularity[s, 20], Glow@ColorData["DarkRainbow"][#3]] ...


2

No need folding 1D graph to get a 2D Random walk in Mathematica. and the CCW easy in Mathematica. Here we go: Generate data set for the random sequence with 2000 steps. Alternatively, you may use your "own generated" data set. rdata = Accumulate[RandomChoice[{-1, 1}, {2000, 2}]] Now plot it with similar layout as your example ListLinePlot[rdata, ...


2

FilterRules[AbsoluteOptions[plot], PlotRange] does the trick (*{PlotRange -> {{0., 10.}, {-0.999999, 1.}}} *) Not sure if this is an exhaustive answer.


1

Anyway, while I wait for my flight, here's some code that'll give you everything there is to know about a plot. GetGeometry[g_Graphics] := Module[{ q, dim, plotrange=PlotRange/.AbsoluteOptions[g,PlotRange], }, q=Rasterize[Show[g, ...



Only top voted, non community-wiki answers of a minimum length are eligible