Tag Info

Hot answers tagged

11

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


9

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


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


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

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


7

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


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

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


5

With f[a_, {x_, y_}] := Piecewise[{{a x, x < y}, {x, x == y}, {1 - a + a x, x > y}}, 0] one simulation can be defined by sim[length_] := Module[{rv = RandomVariate[BetaDistribution[3, 1], length], y, yBar}, y[1] = First@rv; yBar[t_Integer] := yBar[t] = 1/t * Sum[y[i], {i, 1, t}]; y[t_Integer] := y[t] = f[0.5, {rv[[t]], yBar[t - 1]}]; ...


5

Is this the sort of thing you want? data = #/Total[#, {2}] &@Log@RandomReal[1, {10000, 4}]; pts = data.PolyhedronData["Tetrahedron", "VertexCoordinates"]; Graphics3D[Point[pts, VertexColors -> RGBColor @@@ data], Axes -> True] Based on Ray Koopman's answer to Uniformly distributed n-dimensional probability vectors, which I used in my answer ...


5

Here is a straightforward alternative in Version 10 that works for your purpose, since you just want to extract the polygons on the surface. The approach is to discretize the graphics object and collect the Polygons: data = Table[x^2 + y^2 + z^2 + RandomReal[0.1], {x, -2, 2, 0.2}, {y, -2, 2, 0.2}, {z, -2, 2, 0.2}]; gr = ...


5

Another method with a single plot: ClearAll[myFunc2]; yvalues = {0.1`, 0.5`, 1.`, 2.`, 3.`}; myFunc2[x_?NumericQ, y_?NumericQ] := ConditionalExpression[Sin[x y], IntervalMemberQ[Interval[{0, Cos[y]}], x]]; {min, max} = Through[{Min, Max}[Cos[yvalues]]]; Plot[myFunc2[x, #] & /@ yvalues, {x, min, max}, Evaluated -> True, BaseStyle -> ...


5

A method using a single Plot expression: myFunc[x_, y_] := Sin[x y] yvalues = {0.1, 0.5, 1.0, 2.0, 3.0}; Block[{x}, Plot[#, {x, -5, 5}, PlotRange -> All, PlotLegends -> Automatic] &[ If[Cos[#] <= x <= 0 || 0 <= x <= Cos[#], myFunc[x, #]] & /@ yvalues ] ] Notes: I use Block to keep x localized. I did not programmatically ...


5

This is not a complete solution but it may help. Manipulate[ Graphics[{{Circle[{0, -1}, 1]}, {Blue, Disk[{0, -1}, 1, {ArcTan[1/b], ArcTan[1/a]}]}, {Blue, Disk[{0, -1}, 1, \[Pi] + {ArcTan[1/b], If[b < 0, \[Pi], 0] + ArcTan[1/a]}]}, {Green, Line[{{{a, 0}, {0, -1}}, {{b, 0}, {0, -1}}}]}}, Frame -> True, PlotRange -> ...


4

I post this for illustrative purposes. You can access values. I suggest looking at the properties of your model, e.g. if your model is nlm then nlm["Properties"]. Some data and model: wd = WeatherData["Brisbane", "Temperature", {{2004, 1, 1}, {2013, 12, 31}, "Day"}]; vl = QuantityMagnitude /@ wd["Values"]; bnl = ...


4

Show[ Plot3D[{Sqrt[x^2 + y^2], -Sqrt[x^2 + y^2]}, {x, -10, 10}, {y, -10, 10}, PlotStyle -> RGBColor[0.86`, 0.86`, 0.`, .1], Mesh -> None], Plot3D[1/5 (3 x + 4 y), {x, -10, 10}, {y, -10, 10}, PlotStyle -> Hue[0.3, 0.96, 0.54, 0.7], MeshStyle -> Directive[Dashed, White, Opacity[.3]]], Graphics3D[Arrow[{{0, 0, 0}, {-6, -8, 10}}]], ...


4

Just for fun, try this ControllerManipulate[ RegionPlot[True, {x, 1, 4}, {y, 1, 4}, ColorFunctionScaling -> False, ColorFunction -> Function[{x, y}, Block[{d = Norm[l - #]}, RGBColor[1 - d/(1 + d), 0, d/(1 + d)]] & @{x, y}]], {{l, {2, 2}}, Locator, Appearance -> None}]


3

The Plot has to be within Dynamic, as the Plot needs to be updated when z is changed. You can't just update the content of Plot without making a new Plot. {Slider[Dynamic[z], {1, 4, 1}], Dynamic@Plot[Evaluate[Table[Sin[i*t], {i, 1, z}]], {t, 0, 2 Pi}]} The syntax highlighting is due to the Head of your command inside Plot being Dynamic ...


3

The question was reopened after I went to bed, so it seems like I left the party early. :) In any case, LogPlot[f, <>] of course is the plot of Log[f] with the tick labels and positions adjusted to correspond. So the slope of the tangent is given by the derivative of Log[f]. Using the variable x for my own convenience, the tangent arrow (of length ...


3

A brute-force approach to get the torus outer = {Cos[#], Sin[#], 0} & /@ Range[0, 2 Pi, 2 Pi/3]; top = # + {0, 0, 1/4} & /@ (.5 outer); bottom = # + {0, 0, -1/4} & /@ (.5 outer); verts = Join[outer, top, bottom]; polygons = {Polygon[{##, Sequence @@ (Reverse@{##} + 8)} & @@@ #], Polygon[{##, Sequence @@ (Reverse@{##} + 4)} & ...


3

If eldo's plot is your desired outcome you could also do: Show[Plot[Sin[x #], {x, 0, Cos@#}, PlotStyle -> Hue[RandomReal[]]] & /@ yvalues, PlotRange-> All] Noting Cos2 and Cos[3] are negative. If you want legends: With[{col = Hue /@ RandomReal[{0, 1}, 5]}, Legended[ Show[MapThread[ Plot[Sin[x #1], {x, 0, Cos@#1}, PlotStyle -> ...


3

Is something like this your intention? myFunc[x_, y_] := Sin[x y] yvalues = {0.1, 0.5, 1.0, 2.0, 3.0}; fun = Map[myFunc[x, #] &, yvalues]; lim = Table[Cos[yvalues[[i]]], {i, 1, 5}]; plot = Table[Plot[fun[[j]], {x, 0, lim[[j]]}, PlotStyle -> {Red, Green, Blue, Orange, Brown}[[j]]], {j, 1, 5}] Show[plot, PlotRange -> All]


2

First, I should say that I could find no examples of using RegionPlot3D with regions in the documentation. It works on some regions, not on others, and in this case runs longer than one wants to wait. It runs nonstop because Reduce[Exists[{u, v}, x - Cos[u] == 0 && y - Cos[v] - Sin[u] == 0 && z - Sin[v] == 0 && 0 <= u ...


2

Finaly, I plotted them with your hints. Thanks a lot. Show[ Plot3D[{2 x + 2 y + 10, 2 - x - y}, {x, -2, 2}, {y, -2, 2}], ContourPlot3D[{x^2 - 1 - y == 0, 1 - x^2 - y == 0}, {x, -2, 2}, {y, -2, 2}, {z, -20, 20}]]


2

EDIT Forgot for LogPlot. Firs of all read about tangent line. Then try to uderstand how work function getTangentVectAtValue func[t_]:=(1-t)^(-0.5); getTangentVectAtValue[func_,xValue_,vectLen_]:={{xValue,Log@func[xValue]},{xValue+vectLen,Log[(func[xValue]+(D[func[t],t]/.t->xValue)*(x-xValue))]/.x->(xValue+vectLen)}}; Show[ LogPlot[func[t], {t, 0, ...


2

Does this do what you desire?: LocatorPane[Dynamic[pt], Plot[Sin[x], {x, 0, 10}, Epilog -> {PointSize[Large], Dynamic @ Tooltip[Point[pt], pt]}, PlotLabel -> Dynamic@pt], Appearance -> None]


1

{meanhumidity, meantemp} = WeatherData["London", #, {{2007, 1, 1}, {2007, 12, 31}, "Day"}] & /@ { "MeanHumidity", "MeanTemperature"}; plotdata = Transpose[{meanhumidity[[;; -2, 2]], meantemp[[2 ;;, 2]]}]; ListPlot[plotdata, Frame -> True, FrameLabel -> {"Mean Humidity [t-1]", "Mean Temp [t]"}]


1

For this specific example but adaptable: fun[t_] := With[{pt = {t, -0.5 Log[1 - t]}, vec = 0.4 Normalize[{1, 0.5/(1 - t)}]}, Show[LogPlot[(1 - x)^(-0.5), {x, 0, 1}, PlotRange -> {0.9, 10}, AspectRatio -> Automatic, BaseStyle -> 12, PlotLabel -> (1 - x)^(-0.5)], Graphics[{{Red, PointSize[0.04], Point[pt]}, {Thick, ...


1

Here is a method using scaling. The tangent is drawn at x = 0.8. f[t_] := (1 - t)^(-0.5); Print@LogPlot[f[t], {t, 0, 1}, PlotRange -> {{0, 1}, {0.66, 20}}, Frame -> True, PlotLabel -> "Original plot", AspectRatio -> 1]; rescale[i_] := Exp[(i - 1) Log[2.]]; Print[Column[{"Rescaling function: Exp[(i-1) Log[2.]]", Row[{"E.g. ", ...



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