Hot answers tagged calculus-and-analysis
32
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 ...
19
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 ...
19
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.)
...
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 ...
17
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 ...
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]:= ...
15
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}]
15
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, ...
15
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}
...
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
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
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
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]
...
14
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 ...
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
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
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
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 ...
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
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
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 ...
12
Is InverseSeries what you are looking for?
InverseSeries[Series[ArcTan[Log[1 + x]/(1 + x)], {x, 0, 5}]]
(*
x+(3 x^2)/2+3 x^3+(149 x^4)/24+(68 x^5)/5+O[x]^6
*)
EDIT: looks reasonable:
Plot[{
pl[x],
invs
},
{x, -.3, .3},
PlotStyle -> {{Dashed, Black}, Red}
]
Who knows what the radius of convergence is, though.
12
Not sure about the creation of a "smooth" surface. But from Mma help, you may create a convex hull in 3D by using TetGenConvexHull
Needs["TetGenLink`"]
data3D = RandomReal[{0, 1}, {100, 3}];
Graphics3D[Point[data3D]];
surface = TetGenConvexHull[data3D];
(* TetGenConvexHull was changed sometime between 8.0.0 and 8.0.4.
Uncomment the following line only if ...
12
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 ...
12
The proof of the original statement that $f(x)\equiv x\sin\frac{\pi}{x}$ is a monotonically increasing function of $x$ for $x>1$ can be done as follows:
First, we show that the second derivative $f''(x)$ of the function is negative:
Simplify[D[x Sin[\[Pi]/x], x, x] < 0, Assumptions -> x > 1]
True
This means that the first ...
12
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 ...
12
Working with RSolve we can find much more than only a few first terms, here is a general term of your function u[n] e.g. :
u[n_] = u[n] /. Flatten[ RSolve[{ u[1] == 1, u[2] == 2, u[3] == 3,
u[n] == -u[n-3] + 3 u[n-2] + 2 u[n-1]}, u[n], n]]
Root[1 - 3 #1 - 2 #1^2 + #1^3 &, 3]^n Root[-45 + 457 #1 - 1028 #1^2 + 257 ...
12
I know two approaches to this:
In[1]:= FullSimplify[SeriesCoefficient[ArcTan[y], {y, x, n}] n!, Element[n, Integers] && n > 0]
Out[1]= 1/2 I ((-I - x)^n - (I - x)^n) (1 + x^2)^-n Gamma[n]
and
In[2]:= FullSimplify[InverseFourierTransform[(-I k)^n FourierTransform[
ArcTan[x], x, k] , k, x], Element[n, Integers] && n > 0]
...
11
One way is to use Refine to filter out only the positive root. For example:
assume = Z > 0 && a > 0 && n > 0;
int = Integrate[n^2*Radial[1, 0, r]*r^2, {r, 0, ∞}, Assumptions -> assume];
sol = Solve[int == 1, n];
If[Refine[(n /. #) > 0, assume], #, ## &[]] & /@ sol
I've changed N to n since the former is a built-in ...
11
Mathematica often responds well when provided a little expert assistance. Let's focus on techniques that have a wide application rather than just to this problem.
Can the function be decomposed into simpler pieces? Yes, obviously: $f(x)$ is the product of $x$ and $\sin{\pi / x}$. Both are obviously increasing for $x \in [1,2]$. After that, $\sin{\pi / ...
Only top voted, non community-wiki answers of a minimum length are eligible
