Tag Info

Hot answers tagged

44

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


33

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


28

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


25

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


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


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


22

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


21

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


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

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


20

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


19

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


19

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


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


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


18

If you have a domain, you can often find a range using Interval. Examples: In[1]:= Sin@Interval[{0, 2 Pi}] Out[1]= Interval[{-1, 1}] In[2]:= Sin@Interval[{0, Pi}] Out[2]= Interval[{0, 1}]


18

When this question was originally asked, the closest thing to a built in function was via the built-in WolframAlpha functionality. As of V10, there's FunctionDomain and FunctionRange. FunctionDomain[x + x/(x (x^2 - 1)), x] (* Out: x < -1 || -1 < x < 1 || x > 1 *) FunctionRange[x/(x (x^2 - 1)), x, y] (* Out: y <= -1 || y > 0 *) Both ...


18

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


18

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


18

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


17

It is assumed that $x$ is a real number. Everything else would mathematically not make sense because on complex numbers there does not exist an ordering relation. An example would be to take the expression $\sqrt{x^2}$ and to imagine that this is not equal $x$ for $x=-\mathbb{i}$. Therefore the expression is in a general form not simplified In[37]:= ...


17

There is no need to play around with ReplaceAll, Rule, Block, Module or whatever using D, since you have an oparator Derivative really fulfilling your needs while you need not bother if the arguments were defined, so I recommend it to find symbolic derivatives of your function. Remember of shorthands f', f'' to represent first and second derivatives of ...


17

In this case you can use SeriesCoefficient SeriesCoefficient[Exp[x], {x, 0, n}]



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