Hot answers tagged

53

Edit: Added the reversal and some refinements ω = 1; posP[t_, φ_] := Sin[ω t + φ] {Cos[φ], Sin[φ]} posL[φ_] := {-#, #} &@{Cos[φ], Sin[φ]} Animate[ Graphics[{PointSize[0.02], Table[{Black, Line[posL[π i]], Hue[i], Point[posP[t, π i]]}, {i, 0, 1, 1/(3π-Abs[9.43-t])}] }, PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}} ], {t, 0, 6π, 0.2} ]


47

I'd like to expand on Quantum_Oli's answer to give an intuitive explanation for what's happening, because there's a neat geometric interpretation. At one point in the animation it looks like there is a circle of colored dots moving about the center, this is a special case of so called hypocycloids known as Cardano circles. A hypocyloid is a curve generated ...


34

Scientific progress! In v10.3 with all the goodies in AnatomyData we can now use the simple code: Entity["AnatomicalStructure", "Skin"]["Graphics3D"] Zoom in on the appropriate part and you're done. pelvisLoc = AnatomyData[Entity["AnatomicalStructure", "Pelvis"], "RegionBounds"]; Show[ Entity["AnatomicalStructure", "Skin"]["Graphics3D"], ...


32

I feel that once you start with Moire patterns, there's no ending. The way I would replicate these is by making a grid into a function (like @JasonB) but also parametrise the angle of rotation into it: lines[t_, n_] := Line /@ ({RotationMatrix[t].# & /@ {{-1, #}, {1, #}}, RotationMatrix[t].# & /@ {{#, -1}, {#, 1}}} & /@ Range[-...


29

A manual way of doing it is: Plot3D[With[{ϕ = ArcTan[x, y], r = Sqrt[x^2 + y^2]}, 0.3 Sin[2 π r + ϕ]] , {x, -5, 5}, {y, -5, 5} , BoxRatios -> Automatic, Mesh -> None, PlotPoints -> 25, MaxRecursion -> 4 ] The reasoning behind the code is as follows: We know we want to start with some ripples radiating outwards, something like $$\...


27

The easiest way to do this is if you have a PDB file, then it's as easy as using Import. Here are a few examples from the RCSB's Protein Data Bank. To get the URLs, find a page for a given sequence or protein and right-click on the link next to "DOI:" and copy the link. Import[#, "PDB"] & /@ {"http://files.rcsb.org/download/5ET9.pdb", "http://files....


25

Illuminated by @Mr.Wizard's answer, here I provide a complete example of a self-made plot theme, called "Academic". It can be used as a base theme. The axes feature theme is based on the theme "AxesFrame" of "Scientific" with Black, AbsloteThicknees[1], FrontSize->12 axes/frames. The color feature theme is based on "VibrantColor" with modifications of ...


25

Normally Plot uses machine precision numbers; your $x^x$ expression is hitting the limit of the numbers that can be represented in machine precision right about $x>143$. Note: Solve[$MaxMachineNumber == x^x, x] (* Out: {{x -> 143.016}} *) You can increase the WorkingPrecision setting for Plot adequately, and the plot will be complete: f[x_] = ...


24

Source of the problem (possibly) Here is a clear indication that your Fortran library and the Mathematica function are behaving in fundamentally different ways. I noticed the apparent high frequency oscillations in the difference functional, so I decided to see exactly how quickly they oscillate, Plot[funcfortran[w, 0.06, -1.0, 1.0, 1.0, N[π/2], 2.0, 3., ...


23

This package provides couple of functions for plotting commits data from GiHub: Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/Misc/GitHubPlots.m"] GitHubDateListPlot["hadley", "plyr"] GitHubBarChart["hadley", "plyr"] I think these plots are similar enough to the image in the question. There are number of ...


23

What you need to do here is to generate a ParametricPlot to give the 2D goat/silo problem, and then we can rotate it with RevolutionPlot3D. From reading the page on MathWorld, we can see that we need to make a circle involute to describe the portion of the area where the goat's circle is limited by the presence of the silo. In Cartesian coordinates, this ...


23

Something like this: nlines = 30; Table[ Overlay[ Rotate[ Graphics[{ Table[{ Line[{{0, n}, {nlines, n}}], Line[{{n, 0}, {n, nlines}}]}, {n, 0, nlines}], Text[Style[#1, 18], {0, 0}, {-1, -1}, Background -> White] }, AspectRatio -> 1, PlotRangePadding -> None, ImageSize -> ...


22

Update: I have realized since writing this that the below algorithm is not exactly what Plot uses anymore. Given the reference in my reference, a book written by someone who knew Mathematica very well, I guess that the algorithm has been changed in more recent versions of Mathematica. The algorithm that Plot uses is explained in the link provided by ...


21

If you are serious about using this extensively, consider making a function based on CreateDocument... Here is one way to pursue Szabolcs's line of thought. What follows is a function based on CreateDocument[] that can be used in conjunction with the (now somewhat neglected) option DisplayFunction, which handles where the output of graphics functions ...


21

If I'm not mistaken, a complement is defined as the set of elements in one set that are not contained in a given other set. In your case, you have specified the 'other' set (the union of S1, S2 and S3), but not the 'one' set. As you phrased it, I guess that set must be $\mathbb R^3$. So, the complement is the difference between an infinite space and a finite ...


21

There are built-in magnifying glasses. However, spontaneously I don't know how to invoke one directly for a Plot. Therefore I'm going to demonstrate one way that converts the Plot Graphics object into an Image: Image@Plot[Sin[x], {x, 0, 4}] FrontEndExecute[FrontEnd`Select2DTool["GetRectangleImageSelection"]] The image ribbon itself is FileNameJoin[{$...


20

Equation taken form the wiki page x[u_, v_] := (1 + (v/2) Cos[u/2]) Cos[u] y[u_, v_] := (1 + (v/2) Cos[u/2]) Sin[u] z[u_, v_] := (v/2) Sin[u/2] plot = ParametricPlot3D[{x[u, v], y[u, v], z[u, v]}, {u, 0, 2 Pi}, {v, -1, 1}, Boxed -> False, Axes -> False]


19

In the version 10.2, there is a builtin DensityPlot3D function, which can be used to visualize orbitals. a0=1; ψ[{n_, l_, m_}, {r_, θ_, ϕ_}] :=With[{ρ = 2 r/(n a0)}, Sqrt[(2/(n a0))^3 (n - l - 1)!/(2 n (n + l)!)] Exp[-ρ/2] ρ^ l LaguerreL[n - l - 1, 2 l + 1, ρ] SphericalHarmonicY[l, m, θ, ϕ]] DensityPlot3D[(Abs@ψ[{3, 2, 0}, {Sqrt[x^2 + y^2 + z^2], ...


19

Wanna listen to a story? :) It was around 2002 when I finally became fed up with ParametricPlot3D[] and its inability to adaptively plot space curves. Recall that this was the old Graphics[] system where all the pictures were effectively done in PostScript. Thus, I set out to look for a way to adaptively plot curves in general. I was at the time very ...


19

It definitely has something to do with the Interpolation function. Evaluating tempdata = Import["http://www.inrim.it/~magni/cm.dat.gz", "Table"]; cmfunc = Interpolation[tempdata] we get the warning Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will ...


19

Here is a simple modification of the original code in the question that seems to do what's desired: curve[t_] := {Cos[2 Pi*t]/Cosh[Cot[Pi/4]*t], Sin[2 Pi*t]/Cosh[Cot[Pi/4]*t], Tanh[Cot[Pi/4]*t]}; lineSegment[t_] := ParametricPlot3D[curve[t1], {t1, -0.001, t}, PlotRange -> {-1, 1}, PlotStyle -> {Thick, Red}]; sphere = With[{w = 1.2}, Show[...


18

After some spelunking it appears I have an answer and solution: the behavior is as intended, and it is controlled by a Method option "AllowMicroRanges". ListLinePlot[dat, PlotRange -> Full, Method -> {"AllowMicroRanges" -> #} ] & /@ {True, False} It seems this option may also be given directly, outside of Method, but if you wish to ...


18

Since version 10 you can also specify the plotting domain using a geometric region. In your case, for instance, you could use: Plot3D[3 x^2 + y^2, {x, y} ∈ Disk[]] This allows for interesting constructions using the full power of geometric regions: Plot3D[x^2 + y^2, {x, y} ∈ RegionDifference[ Polygon[CirclePoints[6]], Polygon[0.5 CirclePoints[...


18

You seem to be re-evaluating the eigenvalues at every point. Just use this definition: Clear[Eval,kx, ky, kz]; Eval[kx_, ky_, kz_] = FullSimplify[ Eigenvalues[H[kx, ky, kz] + Subscript[H, 1][kx, ky, kz]]]; Then the plots will be faster. This will symbolically evaluate the eigenvalues once, and the variables kx, ky, kz get substituted into the ...


18

There are several important things about the way computer systems represent real numbers, which most of the time can be blithely ignored, just like the safety of bridges in the United States. One important thing is that numbers are discrete. With regular machine precision (double precision), the mantissa has 53 bits, which provides a lot of resolution. ...


18

Below is an animation that tips a proton precessing in the presence of a static B0 magnetic field from the z direction into the x-y plane with a 90 degree B1 pulse and attempts to explain the rotating frame. Unfortunately it is way too long to put into an answer but I have uploaded the notebook using Halirutan's SE Uploader tool. The notebook was built for ...


17

Good way: use a higher setting of WorkingPrecision. Plot[{Exp[x]^(-2 I π) Hypergeometric2F1[-2 I π (Sqrt[2] + 1), 2 I π (Sqrt[2] - 1), 1 - 4 I π, -Exp[x]] + Exp[x]^(2 I π) Hypergeometric2F1[-2 I π (Sqrt[2] - 1), 2 I π (Sqrt[2] + 1), 1 + 4 I π, -Exp[x]]}, {x, -10, 10}, ...


17

You can always create a new notebook and put things in it. If you are serious about using this extensively, consider making a function based on CreateDocument that sets the appropriate options for the notebook to look good. Check what CreateDocument@Plot[Sin[x],{x,0,10}] does. Or use a quick-and-dirty hack based on CreatePalette: fig = CreatePalette[#, ...


17

a = .2; base = Polygon[{{-a, -a, 0}, {-a, a, 0}, {a, a, 0}, {a, -a, 0}}/2]; r = 2 a; Graphics3D[{ GeometricTransformation[ base, Flatten[ Table[ TranslationTransform[{x, y, 0}] @* RotationTransform[ {{0, 0, 1}, Cross[{1, 0, .5 y}, {0, 1, -.5 x}]}], {x, - r, r, a}, {y, - r, r, a} ], 1] ], { Thick , ...


17

Download and learn Package for Radar Charts. Import["http://tinyurl.com/ntmhkca"] Load package: Needs["RadarChart`"] Consider this year on monthly period (you can do any period): month = DateRange[DateObject[{2016}], DateObject[{2017}], Quantity[1, "Months"]] and a function f[l_] := N[l[[1]] + l[[2]]/60] Get the data set = f[...



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