Tag Info

Hot answers tagged

23

The plan is first get the "external" contour and then use Green's theorem to find its area. r[t_] := {-9 Sin[2 t] - 5 Sin[3 t], 9 Cos[2 t] - 5 Cos[3 t], 0} (*find the intersections*) tr = Quiet@ToRules@Reduce[{r@t1 == r@t2, 0 < t1 < t2 < 2 Pi}, {t1, t2}]; pt = {t1, t2} /. {tr} // Flatten; pts = SortBy[pt, N@# &]; pps = Partition[pts, 2]; Now ...


14

The "canonical" way in Mathematica is f[x_, y_] := x^2 + y^2 g[x_, y_] := x^4 + 4 x y + 2 y^4 - 8 Maximize[{f[x, y], g[x, y] == 0}, {x, y}] If you want to make explicit usage of the Lagrange multiplier: ss = N@Solve[Grad[f[x, y] + λ g[x, y], {x, y}] == 0 && g[x, y] == 0, {x, y, λ}, Reals] gives the {x, y} coordinates of the maxs and mins. ...


10

However, is there something you can put in the code to set the speed? Animate takes an option AnimationRate I still haven't been able to draw the bottom part of the first animation on https://courses.engr.illinois.edu/tam212/avt.xhtml#avt and note how it continues to move to the right (without everything jumping around). I think you can get as ...


8

RegionMeasure chooses a method which is slow when exact non-rational coefficients are present. I will correct this for a future version. Thanks for pointing it out. In Mathematica 10 the example works fast with approximate coefficients. In[1]:= Timing@RegionMeasure@N@ RegionIntersection[ Tetrahedron[{{0, 0, Sqrt[3/2]}, {2/Sqrt[3], 0, ...


7

Here is a way to do this using the new commands FromPolarCoordinates and ToPolarCoordinates in version 10.1. I'll use ψ for the function name, instead of f or z. Also, I like to use ϕ for the polar angle: Clear[x, y, r, ϕ, ψ]; polarCoords = Thread[{x, y} -> FromPolarCoordinates[{r, ϕ}]] {x -> r Cos[ϕ], y -> r Sin[ϕ]} ψChain[x_, y_] = ...


7

Mathematica seems to split the integrand component, E^(-((-m + Log[x])^2/(2 s^2))) into E^(-((m^2 + Log[x]^2)/(2 s^2))) times the sort-of "coefficient" E^((m Log[x])/s^2) (* == x^(m/s^2) *) in order to calculate the integral in terms of Meijer $G$. For reasons that are obscure to me, it seems to want the coefficient of m in the exponent to be ...


6

EDIT : Corrected error. Clear[list]; list[n_] := Range[n, 2, -1]; x = Sqrt[1 + Fold[HoldForm[(#2^#2 + #1)^(1/#2!)] &, 0, list[5]]] x // Map[ReleaseHold, #, {0, Infinity}] & // N // InputForm 1.8430759846682


6

MyLine is embedded in 2D space, thus for $x\in\text{MyLine}$, x is a 2D point and Sin[x] just makes no sense. You probably meant the interval Interval[{-Pi,Pi}] instead, which I think should work. But it doesn't. I don't know why. Maybe a bug? In[27]:= MaxValue[Sin[x], x \[Element] Interval[{-Pi, Pi}]] During evaluation of In[27]:= MaxValue::objfs: The ...


6

You can use a conditional ColorFunction within DiscretePlot to achieve what I think you want. In that case, it is important to prevent Mathematica from scaling of the values passed to the ColorFunction using ColorFunctionScaling -> False. The conditional expression used as a ColorFunction is given the $(x,y)$ values to be plotted as a Sequence. We check ...


6

They should not be equal. Note that $$ \lim_{x\to0}\frac{d^n}{dx^n} e^{-\sqrt{x}}=\infty $$ for every integer $n$. What Series does is computing the fractional power series, a.k.a Puiseux Series, which cannot be obtained by evaluating the derivative. You can see this problem with a simpler example: try expanding the function $f=\frac{1}{x}$ or $g=\sqrt{x}$ ...


6

The problem is that you're mixing exact and machine numbers in the definition of the function f. The machine numbers create a small nonzero constant term in the numerator of the Limit, which is the cause of the infinite result as you divide by h and take h -> 0. The fix is to use {x0,y0}= u/5 instead of 0.2. However, if you do need to work with machine ...


6

The problem here is the Sin[n] which has no limit since it is an oscillating function, but it is always bounded by $\pm 1$: if you change you code with the following: Limit[(n - Sqrt[1 + 10 n + n^2])^2, n -> Infinity] with 1 in place of Sin (or -1 if you want), you get the result: (*25*)


5

I speculate about the reason for this behavior in the comment, but no matter whether that's the correct explanation, I would say that the documentation isn't wrong because I can verify the removal of the UpValues using Definition. However, this doesn't solve the problem. As a workaround that requires less typing than the UnSet approach in the question, I ...


5

Application of the implicit function theorem in this case shows that $\frac{\partial z}{\partial x}=-\frac{\partial f}{\partial x}/\frac{\partial f}{\partial z} $ and $\frac{\partial z}{\partial y}=-\frac{\partial f}{\partial y}/\frac{\partial f}{\partial z} $, where $f(x,y,z)=0$ is the implicit function. f = x^3 + y^3 + z^3 + 6 x y z - 1; -D[f, {{x, ...


5

Try this: Solve[0 == Dt[x^3 + y^3 + z^3 + 6 x y z - 1, x] /. Dt[y, x] -> 0, Dt[z, x]][[1, 1]] Dt[z, x] -> (-x^2 - 2 y z)/(2 x y + z^2) The procedure is similar for the other independent variable.


5

Reduce (on exact input) returns quickly and series of conditions joined by Or. The first one implies any disk of radius less than 1/10, d being the radius squared, is sufficient. res = Reduce[-1/10 < (y (x^4 + 4 x^2 y^2 - y^4))/(x^2 + y^2)^2 < 1/10 && x^2 + y^2 < d, {d, x, y}]; dom = If[Head[res] == Or, First[res]] (* 0 < d <= ...


5

Here is an approach using FixedPoint, where I keep the output in exact form to see how many terms are needed to satisfy a given tolerance: Clear[x]; step[{n_, f_}] := {n + 1, f /. x -> (n^n + x)^(1/n!)}; tolerance = $MachineEpsilon; sum = Last@FixedPoint[step, {2, Sqrt[1 + x]}, SameTest -> (tolerance > Abs[Last[#1] - Last[#2]] /. x ...


5

Summarizing the comments, this was a bug in version 10.0.0. It has been fixed as of version 10.0.1. In[1]:= Integrate[ DiracDelta[x]*DiracDelta[y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}] Out[1]= 1


5

If what you want is a nice smooth surface of the outer boundary, then in Mathematica 10.2 you can do the following: data3D = RandomReal[{0, 1}, {100, 3}]; (* generate some random point *) cvx = ConvexHullMesh[data3D] (* get the outer boundary *) Now we can Discretize the surface and smooth it in one go: smooth = DiscretizeRegion[cvx, ...


4

My experiments with this question indicate that something more than simple composition of Arrow and Tube is needed. What I came up with is ParametricPlot3D[{Cos[t], Sin[t], t/4}, {t, 0, 2 π}, PlotRange -> All, PlotStyle -> Directive[{Red, Arrowheads[.08]}]] /. Line[pts_] :> Arrow[Tube[pts, .04], {0, -.1}] which produces Of course, this ...


4

The purpose of this answer is to give simple, clear answers to the simple component questions, How to draw an infinite tangent line? How to draw an infinite secant line? I will use the V10+ InfiniteLine, which Mr.Wizard has already pointed out as a way to draw an infinite line. See also the Note below. How to draw a tangent line Round about the eighth ...


4

f[1, x] = (1 + x)^(1/2); f[n_ /; n > 1, x] := f[n - 1, x] /. x :> (x + n^n)^(1/n!) The above function can generate terms of the series. For example $\quad \quad f(3,\,x)=\sqrt{1+\sqrt[2!]{2^2+\sqrt[3!]{3^3+x}}}$ $\quad \quad f(4,\,x)=\sqrt{1+\sqrt[2!]{2^2+\sqrt[3!]{3^3+\sqrt[4!]{4^4+x}}}}$ f can be used to study the convergence of the OP's ...


4

Now fixed in version 10.2. In[1]:= Residue[LogisticSigmoid[z], {z, I Pi}] Out[1]= 1 In[2]:= Residue[1/(1 + Exp[-z]), {z, I Pi}] Out[2]= 1 In[3]:= Coefficient[Series[1/(1 + Exp[-z]), {z, I Pi, 0}], 1/(z - I Pi)] Out[3]= 1


4

Although Belisarius' creative solution is entirely satisfactory, a solution symbolic at every step may be useful. To begin, define x[t_] := -9 Sin[2 t] - 5 Sin[3 t] y[t_] := 9 Cos[2 t] - 5 Cos[3 t] and note that t = π corresponds to the uppermost point in the star in the question, {0, 14}}. From there, the point {0, -5} can be reached by increasing or ...


4

Both Module and DynamicModule are shadowing the global variables x and y in the example in which you use them. The demonstration is best written without using either Module or DynamicModule. Manipulate[ ContourPlot[f, {x, -1, 1}, {y, -1, 1}, Contours -> 20, Epilog -> Dynamic[Arrow[{pt, pt + grad /. {x -> pt[[1]], y -> pt[[2]]}}]]], {f, ...


3

The following much simpler Manipulate shows one way, how to get a label in Degree, while the variable value is in radian. Manipulate[x, Row[{Control[{{x, 0 Degree}, 0 Degree, 100 Degree}], Spacer[10], Dynamic[x/Degree], "\[Degree]"}]]


3

Solution with NIntegrate NIntegrate[f[X[u, v]] Norm[Cross[D[X[u, v], u], D[X[u, v], v]]], {u, -π/2, π/2}, {v, 0, π}] (* 19.8097 *) An alternative approach to the problem is s = ImplicitRegion[{x^2/2 + y^2/3 + z^2/2 == 1 && y > 0}, {x, y, z}]; Chop[NIntegrate[x^2 + z^2, {x, y, z} ∈ s], 10^-7] which, of course, yields the same answer. Added: ...


3

Fractional Iterates A way to obtain an approximate fractional iterate of a function is to use its Carleman matrix, which is formed from its Taylor coefficients, and then taking the appropriate $p$-th power of the matrix to obtain the series coefficients. Note that I never said that $p$ had to be an integer; in the example given in the OP, then, we can take ...


3

My comment in Manipulate form: func = {x^2 + x y + y^2}; Manipulate[ D[func, variable], {variable, {x, y}} ] The control that Manipulate uses is the SetterBar[Dynamic[variable], {x, y}] of my comment.


3

As pointed out by Artes, this integral has meaning only under Cauchy principal value. Luckily, NIntegrate has this strategy (explained here): NIntegrate[(4 Cos[\[Theta]] Sin[\[Theta]])/(1 - 16 Cos[\[Theta]]^4), {\[Theta], 0, \[Pi]/3, \[Pi]/2}, Method -> "PrincipalValue"] 0.127706 Note that the position of the sigularity has to be specified in the ...



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