Tag Info

Hot answers tagged

9

I agree with beli that an answer is desriable, with mfvonh that closing of questions is a bit out of control, and with m_goldberg that Prolog should be used. I'd happily wait for m_goldberg to post an answer but, since there's 4 close votes already, here's a simple example of the difference between Epilog and Prolog. The difference, of course, is that ...


7

The problem is your range is too large for the plot. But as suggested by @kguler you can increase PlotPoints Plot[x && 0 <= x <= (1/8), {x, -9, 9}, PlotPoints -> 100]


6

Make rotate transform like this. And change some options of ListPolarPlot. I modified the PolarTicks option. rotatePolar[a_List] := Module[{l = Length[a]}, Table[{2 Pi*(i - 1)/l + Pi/2, a[[i]]}, {i, l}] ] ListPolarPlot[rotatePolar[Reverse[Range[20]]], PolarAxes -> True, PolarAxesOrigin -> {Pi/2, 20}, PolarTicks -> {Drop[ Table[{i, Mod[i ...


6

Another alternative is to use ConditionalExpression using the second-order condition for a local maximum as the second argument: f = Sin; Plot[f[x], {x, 0, 20 Pi}, Mesh -> {{0}}, MeshFunctions -> {ConditionalExpression[f'[#], f''[#] < 0] &}, MeshStyle -> {PointSize[Large], Red}] f = Sin[#] - 1/2 Cos[Pi #] &; ...


6

MeshFunctions, according to the documentation, "should normally be chosen to be continuous monotonic functions." Failing that, the mesh functions should be transverse to the mesh levels (i.e., cross them, not have a local extremum); in this case, however, one might have trouble with sampling missing a small region where the mesh function very briefly ...


5

Usage is like this. RevolutionPlot3D[2 - x/2, {x, 1, 2}, RevolutionAxis -> "X", Boxed -> False, PlotRange -> {{0, 3}, All, All}, AxesOrigin -> {0, 0, 0}, Mesh -> {5, 0}, PlotStyle -> Opacity[0.7] ] And you can use Manipulate. Manipulate[RevolutionPlot3D[2 - x/2, {x, a, b}, RevolutionAxis -> "X", Boxed -> False, ...


5

Update: From your intuitive code Step 1 I deleted color of polygon in your code like this. triang1 = {{0, 0, 1}, {1, 0, 1 + Sqrt[3]}, {-1, 0, 1 + Sqrt[3]}}; triang2 = RotationTransform[2 Pi/3, {1, 0, 0}, {0, 0, 0}][triang1]; triang3 = RotationTransform[4 Pi/3, {1, 0, 0}, {0, 0, 0}][triang1]; pic1 = Graphics3D[{Polygon[triang1]}]; pic2 = ...


4

geo = GeoGraphics[GeoRange -> "World", GeoBackground -> Automatic, GeoProjection -> {"Orthographic", "Centering" -> GeoPosition[{90, 0}]}, Axes->True, AspectRatio -> 1/2]; plo = ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi}, PlotStyle -> Red, AspectRatio -> 1/2]; Show[Graphics @@ geo, plo, PlotRange -> All]


4

You can use Epilog to add the thick line: f[x_] := 1 - x^2 g[x_] := 1 - 0.5 x^2 RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2}, PlotPoints -> 50, Epilog -> (Plot[g[x], {x, 0, 2}, PlotStyle -> {Black, Thick}][[1]]), PlotStyle -> {Directive[Yellow, Opacity[0.4]], ...


4

You have a numerical accuracy problem more than anything else. The mesh points are not computed all that accurately, and you have to allow for it in your code. For example, Plot[Sin[x], {x, 0, N[8 Pi]}, Mesh -> {{1}}, MeshFunctions -> (Boole[Chop[Cos[#1], .005] == 0 && #2 > 0] &), MeshStyle -> {PointSize[Large], Red}] works ...


4

In version 10, you can use MeshCoordinates[ConvexHullMesh[...]] as in RunnyKine's answer, but you need to re-order them using MeshCells: pentagon=N@Table[{Cos[2 Pi k /5], Sin[2 Pi k /5]}, {k, 5}] points = N@RandomSample[Join[pentagon, {{0, 0}}]] chm=ConvexHullMesh[points]; ordering=MeshCells[chm,2][[1,1]] out=MeshCoordinates[chm][[ordering]] ...


4

Here's a different approach to consider. Ordering[fns, 1] returns the index of the function whose value is least for given numeric values for x adn y. (Should there be a tie, it will return the first index only). We can use this in ContourPlot to plot the regions. fns = {x + y, 2 x - y, 1 - x^2 - y^2, (x - 1)^2 + (y - 1)^2 - 2, 2 Sin[x y] - 1/2}; ...


3

My answer is based upon Öska's answer here. Credits go to him. A simple example: legend = {"a", "b", "c"}; values = Range@3; MatrixPlot[List /@ values, ColorFunction -> "DarkRainbow", FrameTicks -> {{True , Thread[{values, legend}]}, {False , False }}] MatrixPlot[{values}, FrameTicks -> {{False , False}, {True , Thread[{values, legend}]}}] ...


3

Sort the data ListPlot[Sort /@ {{{1, 0}, {0, 0.5}}, {{1, 1}, {0, 1}}}, Filling -> {1 -> {2}}, FillingStyle -> LightGray, Joined -> True, Frame -> True]


3

If you have Version 10, you could use ConvexHullMesh. pts = RandomReal[{-10, 10}, {6, 2}]; You can then order them by doing: chull = ConvexHullMesh[pts]; And here are the points: MeshCoordinates[chull] Note: This does not always order the points but one can use MeshCells which will give the ordering correctly. See @kguler's answer.


3

You can also use the MeshFunctions option to get the intercepts as follows: Plot[{4 - 2 y, (5 + y)/3}, {y, -10, 10}, MeshFunctions -> {#2 &}, Mesh -> {{0.}}, MeshStyle -> PointSize[Large]] Plot[{4 - 2 y, (5 + y)/3}, {y, -10, 10}, MeshFunctions -> {#1 &}, Mesh -> {{0.}}, MeshStyle -> PointSize[Large]]


3

Let me shorten your example a little bit par = ParametricPlot3D[{1 + Cos[t], Sin[t], 2 Sin[t/2]}, {t, 0, 4 \[Pi]}, PlotStyle -> Red, Boxed -> False, AxesOrigin -> {0, 0, 0}, AspectRatio -> 1]; arr = Graphics3D[ { Arrowheads[0.02], {Red, Arrow[{a[0], a[0] + tf[0]}]}, {Green, Arrow[{a[1], a[1] + tf[1]}]}, {Blue, ...


2

The problem is, given the large domain specified for the expression you want to plot, Plot is not sampling the function with a fine enough mesh in the interval 0 <= x <= 1/8 to see that the expression has some numerical values in that interval. Looking at the plot mesh is a useful debugging tool for this kind of plot problem. Even asking for an ...


2

Show[ RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2}], RegionPlot[y > g[x], {x, -0.1, 2.1}, {y, -0.1, 2.1}, BoundaryStyle -> Directive[Thick, Black]], PlotRangePadding -> None]


2

Summarizing all of the comments: Clear[T] T[e_?NumericQ] := (1/Pi)*NIntegrate[ 1/Sqrt[Sin[ArcCos[-e]/2]^2 - Sin[\[Phi]/2]^2], {\[Phi], 0, ArcCos[e]/2}] Plot[ {Re[T[e]], Im[T[e]], Abs[T[e]]}, {e, -2, 2}, PlotRange -> All, WorkingPrecision -> 25, PlotLegends -> "Expressions", Frame -> True, Axes -> False] EDIT: With the ...


2

Could use ConvexHull in the ComputationalGeometry standard add-on package. Needs["ComputationalGeometry`"] We'll create a simple example. pts = RandomReal[{-10, 10}, {6, 2}]; ListPlot[Append[pts, First[pts]], Joined -> True] Now find and plot the (ordered) outer points. hullindices = ConvexHull[pts]; hullpts = pts[[hullindices]]; ...


2

This is my second answer. I was encouraged to post this separately. There is some sense to that, as it lets the community sort out the best solution, instead of tying two solutions together. From my answer to How to do a region plot with many functions When m and v have Ordering[fns, 1] returns the index of the function whose value is least. By setting ...


2

The reason that AbsoluteOptions[p, InterpolationOrder] doesn't work is that p is a Graphics object and InterpolationOrder is an option for (e.g.) ListPlot3D, not Graphics. InterpolationOrder guides the creation of the graphic but it does not remain a mutable part of it. I addressed this topic here: Is it possible to change the color of plot in Show? As ...


1

Apply the sum-to-product identity and discover the envelope is ±2 Cos[t /2]: Cos[50 t] + Cos[51 t] /. Cos[u_] + Cos[v_] :> 2 Cos[(u + v)/2] Cos[(u - v)/2] (* 2 Cos[t/2] Cos[(101 t)/2] *) Plot: Plot[{Cos[50 t] + Cos[51 t], 2 Cos[t/2], -2 Cos[t/2]}, {t, 0, 10}]


1

With a list of your functions functions = {P1[d, V, A], P2[d, V, A], P3[d, V, A], P4[d, V, A], P5[d, V, A], P6[d, V, A]}; you can create a list of all combinations using And @@ # & /@ MapIndexed[Drop, Partition[#[[1]] < #[[2]] & /@ Tuples[functions, 2], Length @ functions]]


1

A quick look at a Table of the outcomes of your code shows pretty much what the problem is. If FuncThomae[x_] := If[ ExactNumberQ[Rationalize[x]], If[x == 0, 1, L = #^-1 & /@ Divisors[Numerator[Rationalize[x]]] ] , 0] then Table[FuncThomae[x], {x, 0, 1, 0.1}] produces {1, {1}, {1}, {1, 1/3}, {1, 1/2}, {1}, {1, 1/3}, {1, 1/7}, {1, ...


1

This is a verbose epilog to the nice answers given: fun = Sin[x]; lim = 4 Pi; max = Round @ First @ FindMaximum[fun, {x, 0}]; min = Round @ First @ FindMinimum[fun, {x, 0}]; xp = FindInstance[(fun == max || fun == min) && 0 <= x < lim, x, Reals, 15]//Values//Flatten; yp = Table[fun, {x, xp}] plo = Plot[fun, {x, 0, lim}, ...


1

The following works in your special case but can't be generalized. l = {"+", "m", "π", "[]", "2"}; SeedRandom@0; rl = RandomSample[l, 5]; g = With[{cg = CycleGraph[5]}, Graph[UndirectedEdge @@@ Thread@{rl, RotateLeft@rl}, VertexCoordinates -> (Rule @@@ Thread@{rl, VertexCoordinates /. AbsoluteOptions[cg, VertexCoordinates]}), ...


1

I think Michael E2 is exactly true. "should normally be chosen to be continuous monotonic functions." I have tried draw like this. Because it is not continuous monotonic function it is drawed lines along with the polygon meshs. I think MeshFunction seems improbable for your purpose. f[x_, y_] := (x^2 + 3 y^2)*E^(1 - x^2 - y^2) f1 = Plot3D[f[x, y], {x, -2, ...


1

fun = {4 - 2 y, (5 + y) / 3}; p = Flatten @ Map[Solve[# == 0, y] &, fun] /. Rule[_, a_] :> a {2, -5} Plot[fun, {y, -10, 10}, Epilog -> {PointSize@0.02, Point[{#, 0}] & /@ p}, FrameTicks -> {p, Automatic}, FrameTicksStyle -> 12, GridLines -> {p, {0}}, ImageSize -> 500, PlotTheme -> "Detailed"]



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