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} ]


48

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"], ...


34

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[-...


30

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 $$\...


28

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....


26

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

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 ...


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

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[{$...


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

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 -> ...


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 ...


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

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

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

This was supposed to be a comment to Jason's answer, but it got a bit long. But wouldn't it be cool if you could just input a DNA sequence and have a plot? ... take that little snippet and paste it into the form on this site, then you can download a PDB file to import... By looking through the source of the make-na server form, I was able to figure out ...


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 ...


18

The original QRCode is a single piece (I don't dare put it here as it's actually a figure of Chinese pre-president ......) The most interesting phenomenon is that the reference bar has different pixel size as others. So I wrote a brief mathematica code and find out the following: QRCode Reader will only check the color of center points defined by the ...


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

Insetting a magnified part of the original Plot A) by adding a new Plot of the specified range xPos = Pi/6; range = 0.2; f = Sin; xyMinMax = {{xPos - range, xPos + range}, {f[xPos] - range*GoldenRatio^-1, f[xPos] + range*GoldenRatio^-1}}; Plot[f[x], {x, 0, 5}, Epilog -> {Transparent, EdgeForm[Thick], Rectangle[Sequence @@ Transpose[xyMinMax]], ...


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

One important use of Overlay is when two plots are differently scaled but you want to show them together anyway. Here is one example: C1 = RGBColor[0.368, 0.507, 0.710]; C2 = RGBColor[0.881, 0.611, 0.142]; p1 = ListLinePlot[ {1, 7, 2000, 5, 4, 7, 164}, ImagePadding -> 45, Frame -> {True, True, True, False}, FrameLabel -> "Blue Series"...


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