Tag Info

New answers tagged

2

If s is produced by something like s = NDSolveValue[sys, x, {t, 0, tf}] producing (*InterpolatingFunction[{{0., 20.}}, <>] *) the raw data used by InterpolatingFunction can be extracted by {s["Grid"], s["ValuesOnGrid"]} and exported. (See 28337 for more data that can be extracted.)


1

Exporting the points used by Plot Export["Asun.mat", InputForm[ Plot[sol[[1, 14]], {t, 19, 20}, PlotPoints -> 2500, PlotRange -> All]][[1, 1, 1, 3, 2, 1]]] should export all the points shown in your first plot. Finding a suitable fixed interval Plot is using an adaptive algorithm to find determine the sample points. You should check ...


0

I think you are working too hard; i.e, using lower-level forms than you need to. Let Mathematica do the heavy lifting. plt = Range @ 10; ListPlot[plt, Frame -> True, FrameLabel -> {Subscript["ξ", "in"], "Inefficiency Δ"}, Joined -> True, PlotLabel -> Row[{Subscript["ξ", "out"], " ", plt}]]


6

I don't understand the "combining" part of your question, but this makes a contour plot: ListContourPlot[Flatten /@ Flatten[Transpose[{Outer[List, x, y], mat}, {3, 2, 1}], 1], Epilog -> {Red, PointSize[Medium], Point /@ Outer[List, x, y]}]] ContourPlot[ Interpolation[Flatten[Transpose[{Outer[List, x, y], mat}, {3, 2, 1}], 1]][u, v], ...


1

I think wha you want is the integral of your expression. f[x_] = Integrate[40500*x^(-0.1), x]; Plot[f[x], {x, 1, 100}]


5

I don't know a way to export a figure with different resolutions for different elements, the term "resolution" normally applies to the whole figure. You have a 350 printer's points wide figure which you seemingly wish to export with resolution 1200 dpi. This means that you wish to export a figure with width Round[1200*(350/72)] 5833 pixels. Not every ...


0

Sadly the undocumented mechanism behind Simon's splitstyle no longer works in Mathematica 10.0 or 10.1. Post-processing(1),(2) remains an option as does use of ListPlot. While pure post-processing is possible, in a bid to make this answer unique I shall instead define styleSplitter as a function that extracts the PlotStyle option from an unevaluated Plot ...


4

Your plot will trace a series of concentric ellipses, with a point when $r=0$. The eigenvalues have imaginary part zero, and are symmetric about the point $(1,0)$. Start by building a table of output values, here we span $0\leq r \leq 1$ in tenths, and $0 \leq t \leq 2 \pi$ in tenths as well (I am replacing your $\theta$ with $t$ for character simplicity). ...


3

Your question is both basic and broad which means it will probably end up closed unless you can edit it to be more specific. Nevertheless as you are new here is a start: expr := 1 + 3*r*Cos[θ] - I*r*Sin[θ]; Table[ DensityPlot[fn @ expr, {r, 0, 1}, {θ, 0, 2 Pi}], {fn, {Re, Im, Abs, Arg}} ] ~Partition~ 2 // GraphicsGrid Note that capitalization is ...


1

I'll leave the creation of a suitable Manipulate[] interface for somebody else; I'll just share a few ideas in this answer. First, here is a routine that generates a parabola through three points, represented as a B-spline: parabolicArc[pts_?MatrixQ] /; Dimensions[pts] == {3, 2} := BSplineCurve[ReplacePart[pts, 2 -> Mean[Delete[pts, 2]] + ...


3

With ListPointPlot3D[] the points can't be joined. A better solution is to use the low level graphics primitives Line[] and Point[] directly : Graphics3D[ { PointSize[0.03], Thickness[0.01], {Line[#], Point[#]} & /@ GatherBy[exampledata, #[[2]] &] }, BoxRatios -> {1, 1, 1}, FaceGrids -> {{-1, 0, 0}, {0, ...


5

Or, almost directly from the documentation LineIntegralConvolutionPlot[{{(y - 2 Cos[x/4]) Cos[x/4], -Sin[x/4]}, , {"noise", 500, 500}}, {x, -4, 12}, {y, -6, 6}, StreamColorFunction -> "BeachColors", AspectRatio -> Automatic, LightingAngle -> 0, LineIntegralConvolutionScale -> 3, Frame -> False]


6

...and now, the answer I promised to write. As I noted in the comments there is in fact an explicit formula for the RRCF in terms of built-in Mathematica functions, thanks to the deep theory of modular forms: $$\mathcal{R}(q)=\sqrt[5]{q}\frac{\left(q;q^5\right)_\infty \left(q^4;q^5\right)_\infty}{\left(q^2;q^5\right)_\infty \left(q^3;q^5\right)_\infty}$$ ...


8

Did you have something in mind like StreamPlot[{(y - 2 Cos[x/4]) Cos[x/4], -Sin[x/4]}, {x, -4, 12}, {y, -6, 6}, StreamColorFunction -> "Rainbow", AspectRatio -> Automatic] Another plot, this one with net flow. dy = 3; flow = 1; sv = 6; StreamPlot[{(y - dy Cos[x/4]) Exp[-(y - dy Cos[x/4])^2/sv] Cos[x/4] + flow (1 - Exp[-(y - dy ...


0

Here is a method to compute a density function of a large number of arbitrary positive real functions. Create a list of the functions required: fs = Function[{s, t}, (1 + Cos[t - #]) (1 + Sin[s - #])] & /@ RandomReal[{0, 2 \[Pi]}, {1000}]; Compute the density plot by mapping the arguments over the functions and then summing them: ...


5

You could also add a UnitBox and expand the plot range just a little to catch the zeros: With[{p = 20}, Plot[ UnitBox[x/2]*{(1 - x^(2 p))^(1/(2 p)), -(1 - x^(2 p))^(1/(2 p))}, {x, -1.0001, 1.0001}, AspectRatio -> Automatic, Frame -> True, GridLines -> Automatic, PlotStyle -> {{Thickness[.005], Darker@Red}}, PlotRange -> ...


0

If you're willing to use a text file instead of XLS, here's the code I use to upload & plot two columns from a text file: CloudDeploy[FormFunction[ "x" -> "Text", ListPlot[ImportString[#x, "Data"]] &, "PNG" ], Permissions -> "Public"]


7

If you express your equation in polar coordinates, vertical lines won't be an issue: x^(2 p) + y^(2 p) == 1 /. {x -> r Cos[θ], y -> r Sin[θ]} // PowerExpand r^(2 p) Cos[θ]^(2 p) + r^(2 p) Sin[θ]^(2 p) == 1 With[{p = 20}, PolarPlot[(1/(Cos[θ]^(2 p) + Sin[θ]^(2 p)))^(1/(2 p)), {θ, 0, 2π}] ]


11

To get a function value of 10^-1 you need to evaluate the function at x = 1 - 10^-40 . That's a pretty fine grained step Here is a cheap alternative: f[x_, _] := {0, 0} /; (! -1 < x < 1.) f[x_, p_] := (1 - x^p)^(1/p) {1, -1} Plot[f[x, 40], {x, -1.5, 1.5}, AspectRatio -> Automatic] (Plot[f[x, #], {x, -1.5, 1.5}, AspectRatio -> Automatic] ...


0

For a finite range of interest, NSolve works well f[x_] = BesselJ[1, x]^2 + BesselK[1, x]^2 - Sin[Sin[x]]; Manipulate[ Module[{sol}, Column[{ sol = NSolve[{f[x] == 0, 0 <= x <= xmax}, x], Plot[f[x], {x, 0, xmax}, Epilog -> {Red, AbsolutePointSize[6], Point[{x, f[x]} /. sol]}, ImageSize -> 360]}]], {{xmax, 16}, 1, ...


1

SquareOne's second example is inefficient as the data must be scanned repeatedly, once for each value in allLam2. A more efficient approach is to use GatherBy or GroupBy, or occasionally a Sow/Reap pairing. mydata = Import["data.txt", "Table"]; selection = GroupBy[mydata, Extract[2] -> Extract[{{1}, {3}}]]; ListLinePlot[Values @ selection, PlotLegends ...


1

You are running afoul of the (beneficial) scoping that is applied inside Manipulate constructs by way of DynamicModule (or the low-level equivalent). If you "inject" the expression containing g[1] etc. into the Manipulate before it is evaluated it should work correctly I believe: With[{body = gplot[1] == 0}, Manipulate[ ContourPlot3D[body, {x, -1, 1}, ...


4

You can also approach this using images (rather than graphics). The command ColorCombine places image a in the red channel, b in the green channel, and c in the blue channel: Nx = 10; Ny = 10; a = Table[RandomReal[], {i, 1, Nx}, {j, 1, Ny}]; b = Table[RandomReal[], {i, 1, Nx}, {j, 1, Ny}]; c = Table[RandomReal[], {i, 1, Nx}, {j, 1, Ny}]; ...


4

Or, if you want to produce a Graphics directly, these produce identical results: Graphics@Raster@Transpose[{a, b, c}, {3, 1, 2}] Graphics@Raster[MapThread[List, {a, b, c}, 2]]


3

It is as simple as Nx = 10; Ny = 10; a = Table[RandomReal[], {i, 1, Nx}, {j, 1, Ny}]; b = Table[RandomReal[], {i, 1, Nx}, {j, 1, Ny}]; c = Table[RandomReal[], {i, 1, Nx}, {j, 1, Ny}]; ArrayPlot[Transpose[{a, b, c}, {3, 1, 2}], ColorFunction -> RGBColor] Now you can set ColorFunction -> RGBColor and you probably want to look into ...


2

1. This is a quick start and concerns your request : b1[lam2] such that Mod[lam2,6]==0 mydata = Import["/yourPathTo/data.txt", "Table"] myXY = Cases[mydata, {lam1_, lam2_, b1_, b2_} /; Mod[lam2, 6] == 0 :> {lam2, b1}] ListPlot[myXY] 2. Edit Here is a way to plot your beta1[lambda1] grouped by identical lambda2. Here are all the lambda2 values: ...


9

Flatten your tables: ContourPlot[ Evaluate@Flatten@{Table[Re@Sin[x + I y] == 1/2 k, {k, -25, 25}], Table[Im@Sin[x + I y] == 1/2 k, {k, -25, 25}]}, {x, -Pi, Pi}, {y, -Pi, Pi}, PlotPoints -> 100, MaxRecursion -> 5] I do not know why there has been a change.


1

If you're actually looking for the pairwise intersections of the spheres, here's some code that does the trick. First, let's define the set of equations: eqns = {(-9.2877 - x)^2 + (9.3049 - y)^2 + (5436354.04 - z)^2 == 21496269.296^2, (20.40241 - x)^2 + (204.918 - y)^2 + (23272267.679 - z)^2 == 20095995.0541^2, (-39.29329 - x)^2 + ...


2

Considering your GPS-inspired goal, here's an approach which visualizes a least-squares solution to distances from sphere shells, and the corrected standard deviation as size of the red sphere: Module[{spheres, sol}, spheres = { Sphere[{-9.2877, 9.3049, 5436354.04}, 21496269.296], Sphere[{20.40241, 204.918, 23272267.679}, 20095995.0541], ...


2

Do you mean the intersection of the regions enclosed by the spheres? RegionPlot3D[And @@ { (-9.2877 - x)^2 + (9.3049 - y)^2 + (5436354.04 - z)^2 <= 21496269.296^2, (20.40241 - x)^2 + (204.918 - y)^2 + (23272267.679 - z)^2 <= 20095995.0541^2, (-39.29329 - x)^2 + (282.248 - y)^2 + (20240909.994 - z)^2 <= 22488938.185^2, (8.341136 - x)^2 + (48.1826 - ...


2

I have upvoted the self answer. Just to illustrate another approach: f[z_] := 1 + z + z^2/2 + z^3/6 + z^4/24; g[z_] := z + 1 RegionPlot[{Abs[f[x + I y]] < 1, Abs[g[x + I y]] < 1}, {x, -3, 1}, {y, -3, 3}, PlotStyle -> {Red, Blue}, AspectRatio -> Automatic]


4

The code below solved my problem. z = a + I*b; f[z_] = 1 + z + z^2/2 + z^3/6 + z^4/24 ; g[z_] = z + 1; P1 := ParametricPlot[{a, b}, {a, -3, 1}, {b, -3, 3}, RegionFunction -> Function[{a, b}, Abs[f[z]] < 1], MaxRecursion -> 4]; P2 := ParametricPlot[{a, b}, {a, -3, 1}, {b, -3, 3}, RegionFunction -> Function[{a, b}, Abs[g[z]] < 1], ...


1

You may do as follows. The function below shows a single trajectory: traj1[eq1_, eq2_, point_, col_, tmax_, n_] := Module[{p0, p1, p2, p3, tau, s}, eq3 = x[0] == point[[1]]; eq4 = y[0] == point[[2]]; s = NDSolve[{eq1, eq2, eq3, eq4}, {x, y}, {t, tmax}, Method -> "StiffnessSwitching"]; tau = ...


1

I am not quite sure that understood you. Your data, for example, only contains the figures 32 and 38 taken in a random order. Here are 10 of them: data = RandomChoice[{32, 38}, 10] (* {32, 32, 32, 38, 32, 32, 38, 38, 32, 38} *) According to the description your microscopic data should be more close to the following (again there are only 25 figures ...


1

This should give you a start: VectorPlot[{y, -x}, {x, -3, 3}, {y, -3, 3}, VectorScale -> {Medium, 1/2, Automatic}, VectorStyle -> {{Thick, Red}} ] For changing the position of vector arrows please see: Unexpected behavior from VectorPlot


0

I propose using ListAnimate: plots = Table[Plot[Sin[n x], {x, 0, 10}], {n, 12}]; ListAnimate[plots, AnimationRunning -> False] This also lets you "play" the sequence and control the speed at which it is displayed. The option AnimationRunning -> False may be left out if you would like the plots to cycle automatically. You may also find use in ...


0

p = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99}; Manipulate[Plot[Sin[x + a x], {x, -2 Pi, 2 Pi}], {{a, p[[1]]}, p, LabeledSlider}] Manipulate[Plot[Sin[x + a x], {x, -2 Pi, 2 Pi}], {{a, p[[1]]}, p, Slider, Appearance -> "Labeled"}] gives the same result.


2

Here are 12: Manipulate[ myplotlist = {Plot[Sin[x], {x, 0, 5}], Plot3D[Cos[x y], {x, -1, 1}, {y, -2, 2}], ParametricPlot[{t, Cos[t^2]}, {t, 0, 4}], ListPlot[Table[RandomReal[], {20}]], ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}], StreamDensityPlot[{{-1 - x^2 + y, 1 + x - y^2}, Log[Norm[{-1 - x^2 + y, 1 + x - y^2}] + 1]}, ...


1

There are many ways to accomplish this. Here's one with three plots: plot = {Plot[Sin[x], {x, 0, 1}], Plot[Cos[x], {x, 0, 1}], Plot[Tan[x], {x, 0, 1}]}; Manipulate[plot[[t]], {t, 1, 3, 1}]


0

To place the label "(a)" below plot PB you can use: Labeled[PB, "(a)", Bottom] You can wrap "(a)" in a Style to control the size and face of the font, you can also wrap it in a Row to fine tune the position. For example: Labeled[PB, Row[{Spacer[5], Style["(a)", 18, Bold],Spacer[80]}], Bottom]


2

Works fine for me under Linux and Windows. Make sure you specified the right Kernel and FrontEnd in MSPConfiguration.xml. I.e., in Windows add this before </MSPConfiguration> in MSPConfiguration.xml <KernelExecutable> C:\Program Files\Wolfram Research\Mathematica\10.1\MathKernel.exe </KernelExecutable> <FrontEndExecutable> ...


14

This is not a bug, the tick specification used in the documentation is incorrect. The tick specification in these examples is {bottom, left} which is the short form of {bottom, left, top, right} which was an older tick specification that was deprecated in v7 (according to the docs). But, it was allowed to continue to work until v10. The form you are ...


6

I can confirm this bug under Win 7 Mathematica 10.1.0.0. A workaround for the moment is to specify all FrameTicks, e.g. Plot[Sin[x], {x, 0, 10}, Frame -> True, FrameTicks -> {ConstantArray[{-1/2, 1/2}, 2], {#, #} &@{{0, 0 °}, {Pi, 180 °}, {2 Pi, 360 °}, {3 Pi, 540 °}}}] Three more workarounds that narrow down the ...


2

There is just one pair of {} missing DateListPlot[Transpose@{dates, values}, Joined -> True, FrameTicks -> {{{#, #, {0, 0.05}} & /@ Range[-30, 30, 2], None}, {{{#}, #, {0, 0.05}} & /@ Range[2002, 2012, 1], None}}] By adding the extra {} a shortened date list is created, which is one of the possible date forms needed for the ...


4

$PlotTheme is exactly the included mechanism for setting a global Plot Theme: $PlotTheme gives the default setting for the option PlotTheme for graphics functions. To declare this "dodgey" without further explanation is rather peculiar. Many System parameters are configured the same way: $Pre, $Post, $PreRead, $PrePrint, $MessagePrePrint, ...


5

Just to illustrate the point I made in the comment, let's take a data set where the points stack up vertically, and verify what it looks like if we visualize their density by means of a color gradient as in the question One-dimensional heatmap. You first have to copy the definition of heatMap from the second code block in my answer, and then execute this: ...


5

Here is a possible implementation of rug representation using ListPlot. Maybe implementation from @MarcoB is more efficient. jitter function Here is a implementation of jitter function: jitter[x_] := Module[{r, z, xx, d}, r = {Min[x], Max[x]}; z = First@Differences[r]; z = If[z == 0, Abs[r], z]; z = If[z == 0, 1, z]; xx = ...


7

Let's generate some data to play with: SeedRandom[5] Round@RandomVariate[UniformDistribution[{0, 20}], 35]; data = {#, 50 - 3 # + RandomReal[{-10, 10}]} & /@ %; ListPlot[data, PlotRange -> All] Here is a function that calculates the size and position of the plot "piles" and constructs the plot explicitly from graphics primitives: Clear[rugplot] ...


1

I'm not quite following your question, but are you possibly looking for this? Pp = TransformedProcess[{g[t] E^(j[t]), j[t]}, {g \[Distributed] GeometricBrownianMotionProcess[v, \[Sigma], 1], j \[Distributed] CompoundPoissonProcess[\[Lambda], NormalDistribution[0, 0.85]]}, t]; data = RandomFunction[Pp /. {v -> 0.5, ...


1

After contacting the developer of the LevelScheme package, there is an easy fix to this problem. I just need to add Layer->-1 in the RawGraphics of LevelScheme. So: RawGraphics[SmoothDensityHistogram[...], Layer->-1], This places the raw graphics below the frames.



Top 50 recent answers are included