Tag Info

Hot answers tagged

45

I'm going to brute force it numerically. First, let's define the function we're interested in: fun = KnotData[{3, 1}, "SpaceCurve"] Imagine that this function fun[t] describes the position of a moving point in time. The the magnitude of its velocity as a function of the time t is Sqrt[#.#] & [fun'[t]] I'm going to make an interpolating function ...


34

The integrand has two singular points: Solve[ 4z^2 + 4z + 3 == 0, z] {{z -> 1/2 (-1 - I Sqrt[2])}, {z -> 1/2 (-1 + I Sqrt[2])}} At infinity it becomes zero: Limit[ 1/Sqrt[ 4 z^2 + 4 z + 2], z -> ComplexInfinity] 0 All these points are the branch points, thus we should define appropriately integration contours in order to avoid possible ...


34

Funny you should ask :), it turns out there is an undocumented use of Integrate that one can leverage to integrate over regions. Unfortunately this does not seem to work for NIntegrate. This usage is better leveraged in conjunction with some other undocumented functions (see here and here). I will show a few examples of how to use this feature. First, let's ...


32

Mathematica wouldn't be much helpful if one applied only formulae calculated by hand. Here we demonstrate how to calculate the desired geometric objects with the system having a definition of the curve r[t] : r[t_] := {t, t^2, t^3} now we call uT the unit tangent vector to r[t]. Since we'd like it only for real parameters we add an assumption to Simplify ...


30

You can check out this one. I don't know how well it works Periodic`PeriodicFunctionPeriod[E^(I 2 Pi t) + Cos[3/9 Pi t], t] 6 Perhaps you are also interested in the other functions in that context. Check Names["Periodic`*"] EDIT As @Artes notes in the comments, in v10 there's a documented version of this function called FunctionPeriod


29

Taking a limit depends on the path used to approach that limit. Consider the function in the question: f[x_, y_] := Piecewise[{{x y / (x^2 + y^2), x != 0 && y != 0}}, 0]; base = Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}, MeshStyle->Opacity[0.2], PlotStyle->Opacity[0.5]] (A plot of its graph, saved here as base, appears in subsequent figures.) ...


26

I've completely overhauled my answer. I believe this now answers the questions posed (why mma thinks the violet line is the derivative of IntegerPart'[x]). Let's first look at ND, simply because its internals are easier to access and we may obtain some insight. Try: Needs["NumericalCalculus`"] nd[x_, opts___] := ND[IntegerPart[u], u, x, opts] Manipulate[ ...


26

The standard built-in logarithm function is defined for complex variables as follows: Log[z] = Log[Abs[z]] + I Arg[z] The location of the branch cut is simply caused by the convention that polar angles of z are assumed to be in the range $-\pi$ to $\pi$. This same branch cut is also part of the definition of the built-in Arg function. Here is a different ...


25

Fixed (see below) Here's an approach: r1 = Exp[-x^3 - y] - 1 == z; r2 = y == z; We create ImplicitRegions: reg1 = ImplicitRegion[r1, {x, y, z}]; reg2 = ImplicitRegion[r2, {x, y, z}]; The intersection of these regions is the line you seek: reg = RegionIntersection[reg1, reg2]; And here is the length (note the inclusion of the range of values in ...


24

This is indeed a serious and problematic issue. We know many similar problems with symbolic integration which provides Integrate. There were some improvments in newer versions of the system but also some issues become worse, see e.g. Mathematica 9 can't integrate this function but earlier versions could. ). One can find more problems looking for tags ...


23

We define the function f and multiple constraint functions g1, g2: f[x_, y_, z_] := x y + y z g1[x_, y_] := x^2 + y^2 - 2 g2[x_, z_] := x^2 + z^2 - 2 then, in order to find necessary conditions for constrained extrema we introduce the Lagrange function h with Lagrange multipliers λ1 and λ2: h[x_, y_, z_, λ1_, λ2_] := f[x, y, z] - λ1 g1[x, y] - λ2 g2[x, ...


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


22

Edit for Mathematica version 9 and higher To make this answer work with definite integrals in versions greater than 8, I added the line with SetAttributes in the definition below. Without declaring the antiderivative ff as a NumericFunction, the simplifications that were done in version 8 don't kick in, and the expressions remain unevaluated. End edit ...


22

Here's one way to implement Yves's suggestion: (* arclength function *) trefarc = \[FormalS] /. First[NDSolve[ {\[FormalS]'[t] == Norm[KnotData[{3, 1}, "SpaceCurve"]'[t]], \[FormalS][0] == 0}, \[FormalS], {t, 0, 2 Pi}, Method -> "Extrapolation"]] (* length of trefoil *) end = trefarc[2 Pi]; With[{n = 25}, (* n - number of points to ...


21

It's true that the multivariable version of Series can't be used for your purpose, but it's still pretty straightforward to get the desired order by introducing a dummy variable t as follows: Normal[Series[f[(x - x0) t + x0, (y - y0) t + y0], {t, 0, 2}]] /. t -> 1 $(x-\text{x0}) (y-\text{y0}) f^{(1,1)}(\text{x0},\text{y0})+\frac{1}{2} ...


20

The functions Re and Im (just as Conjugate) don't satisfy the Cauchy-Riemann differential equations and are therefore not analytic. That means their derivative is not uniquely defined in the complex plane. That's the reason why Re' and Im' can't be simplified. Therefore, we have to be more specific about how we want the limit to be done that corresponds to ...


20

You can realize a discrete Hilbert transform by convolving your discrete signal with a Hilbert kernel. The convolution is implemented with least effort in the frequency domain, where the spectrum of the Hilbert kernel is $$\sigma_H(\omega)=-i\cdot\mathrm{sgn}(\omega)$$ where $\omega$ is the angular frequency. Continuous case We define a function to perform ...


20

The most direct way to test this is probably the following: $Assumptions = x > 0; Element[x, Reals] // Simplify (* Out[1]= True *) $Assumptions = True; Element[x, Reals] // Simplify (* Out[4]= x ∈ Reals *) So $x>0$ seems to imply that $x$ is real.


20

I very much suspect that the limit is not $1/4$, but rather $$\exp \left( \max_{y>0} \int_{t=0}^1 \left( -yt + \log(1-e^{-yt}) \right) dt \right) \approx 0.185155.$$ If I were writing this up on math.SE, I'd start right in on a proof of this, but on this site I think that it would be more welcome to show some of the Mathematica techniques I used to come ...


20

Maximize[{y, x^2 + y^2 == (2 x^2 + 2 y^2 - x)^2}, {x, y}] {(3 Sqrt[3])/8, {x -> 3/8, y -> (3 Sqrt[3])/8}}


19

Certainly, there is a better way: y[x_] := 2 x Sin[x]; a = Pi/2; Collect[Normal[Series[y[x], {x, a, 1}]], x, Simplify] Recall that the formula for a Taylor polynomial looks a bit like this: $$f(x)=\color{red}{f(a)+f^\prime (a)(x-a)}+\frac{f^{\prime\prime}(a)}{2}(x-a)^2+\cdots$$ and reconciling this with the geometric interpretation of the Taylor ...


19

Identifying the sum as ($N$ times) a Riemann sum should inspire us to look at the integral of the function $x^N$ for $0\le x \lt 1$, whose value is $1/(N+1)$, of which here are a few examples for $N=1,4,16,64$: Plot[Evaluate@Table[x^n, {n, {1, 4, 16, 64}}], {x, 0, 1}, Filling -> Axis, PlotStyle -> Thick] Noticing that this area becomes more and ...


19

Here is a numeric approximation method that can be useful when no analytic information is known. I will illustrate with the function WeierstrassPPrime[t, {2, 3}] that was mentioned in a comment to one response. We begin by taking random steps, and sampling the function at those steps (I'll explain the random step size presently). We then plot the ...


19

Some programming principles help us make short work of this. The key principle is to encapsulate what's going on. First, the surface. It depends on some parameters, so let's be explicit about that, rather than letting those parameters run around loose as "global" variables. To illustrate, I begin by generating some (reproducible) random values for these ...


19

After a lengthy study (I'm using version 8) I conclude that there is a bug in Mathematica in the Integrate function when applied to a Sqrt integrand. Ok. let's go (some patience is required because of the long text) Let us define the functions corresponding to your integrals. Remark: because of the relation $1 + cos(2x) = 2 cos^2(x)$ the two forms of ...


19

Summary: Setting GenerateConditions -> False turns off safety checks. In my opinion, when the user does that and the result is erroneous, I would not call that a bug. Now WRI could decide to improve Mathematica in this case, but it might not be such a simple matter. On the other hand, it is entirely up to the user to decide whether or not he or she is ...


18

line[x_] := Solve[{a + b == 13, a x + b == 15 - 2 x^2}, {a, b}] // Quiet f[x_, x0_] := {15 - 2 x^2, (a x + b) /. line[x0]} Animate[ Plot[{f[x, x0], -4 x + 17}, {x, -2, 3}, PlotRange -> {0, 18}, PlotStyle -> Thick, Evaluated -> True, Epilog -> {PointSize[0.025], Point[{{1, 13}, {x0, 15 - 2 x0^2}}]}], {x0, ...


18

Here's a direct implementation of the formula $$\mathcal H(u)(t) = \frac1{\pi} -\hspace{-1.1em}\int_{-\infty}^\infty \frac{u(\tau)}{t-\tau}\, \mathrm d\tau$$ hilbertTransform[f_, u_, t_] := FullSimplify[Convolve[f, 1/u, u, t, PrincipalValue -> True]/π] Try it out: hilbertTransform[#, v, w] & /@ {Sin[v], Cos[v], 1/(1 + v^2), Sinc[v], ...


18

Mathematica already knows quite a lot about functional derivatives. In particular, you can do variational derivatives. That is, you have to give it the functional and the function (I would strongly suspect that your problem can be written so as to use the VariationalD function). To get started, have a look at the tutorial for the Variational Methods package. ...


18

What you have is a MultinormalDistribution. The quadratic and linear forms in the exponential can be rewritten in terms of $\frac12(\vec{x}-\vec{\mu})^\top\Sigma^{-1}(\vec{x}-\vec{\mu})$ where $\vec{\mu}$ represents the mean and $\Sigma$ the covariance matrix, see the documentation. With this, you can do integrals of the type given in the question by ...



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