Tag Info

Hot answers tagged

33

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


23

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


22

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


19

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


19

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


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

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


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

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


16

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


16

There is no way to do exactly what you want because an assumption can't be used to tell Mathematica that there exists an indefinite integral of the unknown function f[x]. See for example this MathGroup post. However, you can get almost what you need if you define the indefinite integral yourself in the following way: f /: Integrate[f[x_], x_] := ff[x] ...


16

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


16

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


16

Since Vitaliy already answered the question, I'll just add another answer to confuse you. To get the general form of the $n$-th derivative, you could use the properties of the Taylor series as follows: Clear[n]; c[n_] = FullSimplify[SeriesCoefficient[n! x Exp[-x], {x, 0, n}], n >= 0] $\begin{cases} -(-1)^n n & n\geq 1 \\ 0 & \text{True} ...


16

It is Kampé de Fériet function, introduced in Joseph Kampé de Fériet, "La fonction hypergéométrique.", Mémorial des sciences mathématiques, Paris, Gauthier-Villars. Its definition is given on Notations page: and, in an alternative form, in Wikipedia: $${}^{p+q}f_{r+s}\left( \begin{matrix} a_1,\cdots,a_p\colon b_1,b_1{}';\cdots;b_q,b_q{}'; \\ ...


15

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


14

Edit The answer is "ambiguous" because you have two parameters, $\alpha$ and $k$, and in this case the limit depends on the value of $\alpha$. What you can try is the following: f[k_, α_] := ((k + 2) (α^2 - Sqrt[α^4 + k]) + k)/(α^2 - Sqrt[α^4 + k] + 2 k) Simplify[Limit[f[k, α^(1/4)], k -> 0] /. α -> α^4, α ∈ Reals] $\frac{2 \left(\alpha ...


14

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


14

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


14

$\mathrm{abs}(z)$ defined on the set of complex numbers $\mathbb{C}$ is not a holomorphic function because it violates the Cauchy-Riemann conditions, and the derivative is not well defined. $\mathrm{abs}(x)$ defined on the set of real numbers $\mathbb{R}$ is differentiable everywhere except at $x=0$. Mathematica treats Abs[x] as a function defined on ...


14

The solution is to use Exclusions->None as option to Plot. The gap happens exactly where UnitStep[-a+h] has its discontinuity With[{a = 5}, Plot[{1/2 (2 a H + (a - H)^2 UnitStep[-a + H]), UnitStep[-a + H] + 25}, {H, 4.9, 5.1}] ] This behavior was introduced, when Wolfram decided, that discontinuities should be discontinuous displayed in ...


14

You want first to fix any typographical errors (such as the unbalanced parentheses) and it's also wise to avoid symbol names beginning with capital letters. Then, to obtain a series expansion in powers of $1/z$, expand the expression around infinity, not zero: Series[a + b (1 - Exp[-t/(b c)]/(z - Exp[-t/(b c)])) , {z, Infinity, 5}] $(a+b)-\frac{b ...


14

In general Mathematica cannot compute symbolically infinite sums over primes because of the lack of appropriate mathematical tools. However there are infinite products over primes which are basically well understood on the mathematical level. One famous example is the Euler formula for the Riemann zeta function, one of the most beautiful (and mysterious ...


14

Short story $$ \vartheta(x) = \arg \left[(\operatorname{Bi}x+i \operatorname{Ai}x)e^{-\frac{2}{3} i (-x)^{3/2}}\right]+\frac{2}{3} \operatorname{Re}\left[(-x)^{3/2}\right] $$ Update: I see that you want use only real functions, so you can expand this as $$ \vartheta(x) = \begin{cases} \arctan\frac{\cos \left(\frac{2}{3} (-x)^{3/2}\right) ...


14

For this function: f[z_] := (1 - E^z + z)/(z^3 (z - 1)^2) there are no branch cuts in the complex plane therefore we simply use Cauchy integral theorem and the related formula of the complex residue, i.e. we sum up residues of the function $f$ in the circle $\mid z \mid =2$. Let's denote $$int = \oint_{\mid z \mid =2}\frac{1-e^z+z}{z^3 (z-1)^2}dz$$ Now ...


13

For Integrate as well as for Simplify, Refine FunctionExpand, Limit etc. there is an option Assumptions: Integrate[ 1/Sqrt[ z^2 + u^2], {z, -l, l}, Assumptions -> (u | l) ∈ Reals] ConditionalExpression[ 2 ArcSinh[ l/Abs[ u]], u != 0 && l >= 0] or one can use Assuming[ (u | l) ∈ Reals, Integrate[ 1/Sqrt[ z^2 + u^2], {z, -l, l}]] the ...


13

In Mathematica: Integrate[Integrate[x^2 + y^2, {x, -Sqrt[1 - y^2], Sqrt[1 - y^2]}], {y, -1, 1}] Or, shorter: Integrate[x^2 + y^2, {y, -1, 1}, {x, -Sqrt[1 - y^2], Sqrt[1 - y^2]}] The main trick is to calculate the bound on $x$ based on the current value of $y$, which is what you need to make the integration bounds explicit. Indeed, $x_{max}=\sqrt{1-y^2}$. ...


13

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


13

Use the following representation of the Legendre polynomials: $$ P_n(x) = 2^n \sum_{k=0}^n x^k \binom{n}{k} \binom{\frac{n+k-1}{n}}{n} $$ Note that the sum effectively is over $k \equiv n \bmod 2$. Expand each Legendre polynomial into a sum. Integration with respect to $\theta$ is easy: $$ \int_0^{\pi} \sin^{k_1+k_2+k_3+1} \theta \mathrm{d}\theta ...


13

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



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