Tag Info

Hot answers tagged

19

Taking the cube root on both sides fixes the problem, and then you don't need lots of PlotPoints any more. ContourPlot3D[(x^2 + 9/4 y^2 + z^2 - 1) == CubeRoot[x^2 z^3 + 9/80 y^2 z^3], {x, -6/5, 6/5}, {y, -6/5, 6/5}, {z, -6/5, 3/2}, Mesh -> None, Boxed -> False, AxesLabel -> {"x", "y", "z"}, Axes -> False, ContourStyle -> Directive[Red, ...


14

In Version 10 you can use the PlotTheme "OpenMarkersThick": data = Table[{x, x^k}, {k, 1, 4}, {x, 0, 1, 0.1}] ListLinePlot[data, PlotTheme -> {"OpenMarkersThick", "LargeLabels"}, PlotLegends -> {x, x^2, x^3, x^4}]


12

The separation-of-variables solution you quoted has two indices appearing in it: n and j (the subscripts of the coefficient $A_{nj}$). Here, n is azimuthal mode order, i.e. it counts the number of nodes along the direction in which the polar-angle $\theta$ varies (divided by 2). The index j is needed because the wave is supposed to satisfy the boundary ...


12

I had the same problem after switching to Mathematica 10. The issue here is the following: Export uses Rasterize to create the png image. The StyleEnvironement, which is used in Rasterized, cannot be specified as an option but is given by the $FrontEnd object (not by the EvaluatingNotebook[]!). You can change the StyleEnvironement by SetOptions[$FrontEnd, ...


11

This is an intentional change to make PlotLegends -> "Expressions" more consistent with PlotLegends -> Automatic. Both now do not produce legends when only one line is present. What you are looking for is PlotLegends -> "AllExpressions" which has the old behavior, e.g. Plot[x, {x, 0, 1}, PlotLegends -> "AllExpressions"] More generally, ...


11

\[FilledSquare] is a font glyph and you cannot color parts of it. I believe you need to draw your markers with Graphics primitives. For example: square[in_, out_: Black, size_: 12] := Graphics[{in, EdgeForm[{AbsoluteThickness[2], out}], Rectangle[]}, PlotRangePadding -> 0, ImageSize -> size] data = {{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}, {4, ...


10

NB I think there's a problem with this code, please see this answer by ubpdqn for more information. I'll update these snippets when I get the chance. Yours is a question with many possible interpretations. I've chosen the interpretation that was most fun for me to play with, so... ang = 20; (* divide the world into chunks of this size *) pts = ...


9

General approach If {x0, y0} is a root of a polynomial system {p1, p2} such that there is no other root of the form {x0, y1}, the multiplicity is given by the multiplicity of the zero x0 of the resultant Resultant[p1, p2, y] We can compute the multiplicity of this zero with SparseArray[ CoefficientList[Resultant[p1, p2, y] /. x -> x0 + u, u] ...


9

Count[Solve[y^4 + 6 x^3*y + x^8 == 0 /. {y -> x^3}], {x -> 0}] (* 6 *)


8

Download the data (csv file) from U.S. Energy Information Administration; http://www.eia.gov/countries/country-data.cfm?fips=uk data = Import[ "/Users/hanlonr/Downloads/United_Kingdom_proved_Reserves_(1980-2014).csv"];\ ListLinePlot[data[[5 ;; -6]], Frame -> True, Axes -> False, PlotRange -> All, PlotLabel -> StringReplace[data[[1, ...


8

data = Reverse@Table[{2^n, 1}, {n, 1, 6}]; Graph[Table[DirectedEdge[i, i + 1], {i, Length@data - 1}], VertexLabels -> "Name", VertexCoordinates -> ({#2 Cos[#1], #2 Sin[#1]} & @@@ data), Axes -> True, ImageSize -> 300]


8

I heard from technical support. The problem should be fixed in an upcoming release, but for now there is a temporary fix by inserting Method -> {"OptimizePlotMarkers" -> False} into the ErrorListPlot options.


8

You can explicitly see that the degree of intersection at (0,0) is 6 using: p1 = y - x^3; p2 = y^4 + 6 x^3 y + x^8; Factor[p2 /. y -> x^3] Also revealing is: Factor@GroebnerBasis[{p1, p2}, {y, x}] Giving {x^6 (x^6+x^2+6), y-x^3} This result is connected to Bezout's Theorem (covered in your textbook).


8

I could not get it to work with $FrontEnd, but setting the ScreenStyleEnvironment on $FrontEndSession worked for me. Here text cells get two different backgrounds and font sizes, depending on the environment. ("Printout" is pink and large.) sseOpt = Options[$FrontEndSession, ScreenStyleEnvironment]; SetOptions[$FrontEndSession, ScreenStyleEnvironment ...


8

Update Almost ten times faster again, or about 90 times faster than the OP's way (0.069 sec v. 5.46 sec): For the second integral, we can find its derivative with respect to x and then integrate with NDSolve. The derivative of the integral has two components, one from differentiating under the integral sign dxdz1 and one from plugging in the limit of ...


8

Update 2: A function to generate tori: toroidalF[n_, h_: (1/4), w_: (1/2), opts : OptionsPattern[]] := Module[{top, bottom, verts, outer = {Cos[#], Sin[#], 0} & /@ Range[0, 2 Pi, 2 Pi/n], faceverts = Flatten[#[[{1, 2, 4, 3}]] & /@ # & /@ (Join @@@ Subsets[#, {2}] & /@ ...


7

Not sure how robust it is, but the following seems to work for PlotRange: ClearAll[plt]; plt = Plot[Sin[x], {x, 0, 3 Pi}, PlotRange -> Automatic, PlotLabel -> Dynamic@("PlotRange is " <> ToString@PlotRange[plt])] and ClearAll[plt1]; plt1 = Plot[Sin[x], {x, 0, 3 Pi}, PlotRange -> Automatic, PlotLabel -> ...


7

An alternative syntax for Contours that combine contours and styles: cntrplt[expr_, arg1_, arg2_, contours : {{_, _} ..}, opts : OptionsPattern[]] := ContourPlot[expr, arg1, arg2, Contours -> Join @@ Thread /@ contours, opts]; Using @rhermans' example: cntrplt[1 - Exp[-x - y], {x, 0, 2}, {y, 0, 2}, {{Range[0, .9, 1/10], Thick}, ...


7

Something like this? ContourPlot[ 1 - Exp[-x - y] , {x, 0, 2} , {y, 0, 2} , PlotRange -> {0, 1} , Contours -> Join[Range[0, 0.9, 0.1], Range[0.9, 1, 1/100]] , ContourStyle -> Join[Table[Thick, {10}], Table[Thin, {9}]] ] EDIT: About the follow-up question, the function should look like this: ContourPlot[ ueislexpl[0.1, 5, n1, n2] ...


7

Here is an example with some random data: SeedRandom@0; dat = Sort /@ RandomInteger[{200, 700}, {3, 25}]; Graphics[{Hue@.5, Opacity@.7, MapIndexed[Line@Outer[List, #, 40 #2[[1]] + {20, -20}] &, dat]}, Axes -> {True, True}, Ticks -> {Automatic, Thread@{Range[40, 3*40, 40], Range@3}}] With your data, it's a different story and it looks ...


7

Tube is helpful in this regard, for example: tube[r_, l_, rt_] := Graphics3D[{CapForm["Square"], Tube[Join[Table[{-1, 0, j}, {j, l, 0, -0.1}], Table[-{Cos[t], 0, Sin[t]}, {t, 0, Pi, 0.1}], Table[{1, 0, j}, {j, 0, rt, 0.1}]], r]}, Boxed -> False] Visualizing: Manipulate[tube[i, j, k], {i, 0.1, 0.5}, {j, 0.5, 2}, {k, 0.5, 2}] You can ...


7

This is a very common problem for people who work on data analysis. Here as a solution to the problem using LocatorPane and a few other functions and tricks. TooltipListPlot[data_, tipFunction_, listPlotOptions___] := DynamicModule[ {displayQ = False, yRange , xRange, pt, minX, maxX, minY, maxY, tip, threshold, tipPosition, nf, dataPoints, ...


7

You can Partition the data into pairs of successive values. Reverse the data to make the previous day the dependent variable. Examples: Partition[{1, 2, 3, 4, 5}, 2, 1] (* {{1, 2}, {2, 3}, {3, 4}, {4, 5}} *) Partition[Reverse@{1, 2, 3, 4, 5}, 2, 1] (* {{5, 4}, {4, 3}, {3, 2}, {2, 1}} *) Reverse /@ Partition[{1, 2, 3, 4, 5}, 2, 1] (* {{2, 1}, {3, 2}, {4, ...


6

A quick-and-dirty way: get the contours for the .0000001st and .9999999th quantiles as approximations for min and max dp = DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}]; cp1 = ContourPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, ContourShading -> None, ContourStyle -> {Directive[Red, Thick], Directive[Orange, Thick]}, ...


6

In version 10 the PointSize of the legend will automatically match the PointSize of the Plot: ListPlot[Table[RandomReal[NormalDistribution[], {20, 2}], {2}], PlotLegends -> {"a", "b"}, PlotStyle -> PointSize[0.02]] Edit: The answer by @eldo made me realize, that this is only true up to a PointSize that is equal to the default ...


6

This uses some version 10 functions: Getting the data (takes time as I could have set this up better): dat = Table[{i, j, WeatherData[{j, i}, #] & /@ {"WindSpeed", "WindDirection"}}, {i, 113, 153, 4}, {j, -43, -11, 4}]; Processing: data = Cases[{{#1, #2}, -QuantityMagnitude[#3[[1]]] {1/Cos[#2 Degree], 1} Through[{Sin, ...


6

Though I was expecting to need something fancy I stumbled upon a simple solution: ListLinePlot[data, PlotMarkers -> Graphics[{Disk[]}, ImageSize -> 13], PlotLegends -> Automatic ] The only change is enclosing Disk[] in { }. Looking at the InputForm we see that expressions involving Disk have been changed to e.g.: Graphics[{ Hue[0.67, ...


6

The answer is 0, if the question is what is the value of Mean[fit["FitResiduals"]] and fit is a linear, least-squares fitted model. data = WeatherData["London", "Temperature", {{2004, 1, 1}, {2013, 12, 31}, "Day"}]; normaldata = Partition[Reverse[data["Values"][[All, 1]]], 2, 1]; fit = LinearModelFit[SetPrecision[normaldata, Infinity], x, x, ...


6

This is not an answer, but is too long for a comment. NSolve produces different results for NSolve[{y^4 + 6 x^3*y + x^8 == 0, y - x^3 == 0}, {x, y}, Reals] according to the Mathematica version it is evaluated in. In V9, it produces {{x -> 0, y -> 0}} while in V10 it produces {{x -> 0., y -> 0.}, {x -> 0., y -> 0.}, {x -> 0., ...


6

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]



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