Tag Info

Hot answers tagged

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


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


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

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


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


13

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


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


13

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{}'; \\ ...


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

There is nothing wrong with the issue in the question. Mathematica shouldn't evaluate Simplify[ Integrate[f[x] + g[x], x] == Integrate[f[x], x] + Integrate[g[x], x]] to True, because in general such a rule would be mathematically simply wrong. Consider e.g. $ \forall_{x } f(x) = - g(x)$, while $f$ is not e.g. Lesbegue integrable. Of course ...


11

Minimalist: k[t_] := KnotData[{3, 1}, "SpaceCurve"][t]; len[r_] := N@Integrate[Total[D[k[t], t]^2], {t, 0, r}]; pts[n_] := Solve[len[t1] == len[2 Pi] #/n, t1, Reals] & /@ Range[n + 1]; Graphics3D@Tube[k[t1] /. # & /@ (Flatten@pts@30), .1]


11

f[x_] := 15 - 2 x^2 x0 = 1; tangentLine[x_] = Normal[Series[f[x], {x, x0, 1}]] secantLine[h_, x_] := InterpolatingPolynomial[{{1, f[1]}, {h, f[h]}}, x] Animate[Plot[{f[x], tangentLine[x], secantLine[h, x]}, {x, -1, 3}, AxesLabel -> {"x", "y"}, Epilog -> {AbsolutePointSize[7], Point[{{1, 0}, {1, f[1]}, {h, 0}, {h, f[h]}}]}, PlotRange -> ...


11

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


11

You have 2 typos. No space in xe and use capital E not e - or better Exp[x] You have nicely behaving functions, so this would work: f[x_] := x Exp[-x] Table[D[f[x], {x, n}] /. x -> 0, {n, 1, 5}] {1, -2, 3, -4, 5} But this is dangerous and it is better to use this: f[x_] := x Exp[-x] Table[Limit[D[f[x], {x, n}], x -> 0], {n, 1, 5}] {1, ...


11

The Simplify idea is on the right track, but you have to tell Mathematica about the relationship between f and Plus in a slightly different way: ClearAll[f]; Plus[f[x_], f[y_]] /; x + y == 1 ^:= 1 The Upset symbol ^:= means this is a definition for f rather than Plus. This approach is inefficient--there is going to be a lot of blind checking to find ...


11

It is a bug in Series. Note that a := (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2/( 4 (h^2 + 1/4 (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2)) b = FullSimplify[a] Series[a,{h,Infinity,0}] (* Out: 1 + O[1/h]^2 *) Series[b,{h,Infinity,0}] (* Out: O[1/h]^2 *) The fact is that for $h\to\infty$ there are two terms cancelling each other in the ...


11

There's a bit more to the story. Mathematica treats variables as complex by default, and I for one have had trouble figuring out how Limit figures out how to treat variables such as c in this case. Some analysis First, let's examine a0 (= a in OP) with the assumption thatc is real: a0 = (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2 / (4 (h^2 ...


10

This numerical approach is based on length of chord (not arc), so it is a good approximation as long as the curve is smooth and you have close points. You have a parametric curve f of variable t. Define a numerical function that given ti finds such tf that Norm[f[tf]-f[ti]] stays constant. You need 2 functions to keep both negative and positive roots which ...


10

The result you're after is only correct in the reals. Since Mathematica generally assumes that everything is complex, I'm not sure if there is a simple way to make it return the result you want. You can go backwards and check that, for $x\in\mathbb{R}$, $\frac{d}{dx}\log|x|=\frac1x$: D[Log[Abs[x]], x] FullSimplify[%, x \[Element] Reals] (* ==> ...


10

f[{a_, b_, r0 : {x0_, y0_}}, r : {x_, y_}] := a Exp[-(b Norm[r - r0])^2]; a = Range@6; b = (1/Reverse@Range@6)^2; r0 = Array[{#, #} &, 6]; u[{x_, y_}] := Total[f[#, {x, y}] & /@ Transpose@{a, b, r0}] p[t_] := {2.5 + 1.8 Sin@(4 t), 2 - 1.2 Cos[4 t]} Show[Plot3D[u[{x, y}], {x, -10, 15}, {y, -10, 15}, Mesh -> False], ...


10

First, you can try to apply the FunctionExpand command to the DifferenceRoot object. If it is able to find a closed form of the sequence, then the Limit might be able to find an exact symbolic limit. To find a numerical approximation, you can use the SequenceLimit command. In general, it does not guarantee to give the correct result, but if your sequence ...


9

I think that the closest thing to a built in function, as you ask for, is the the built-in WolframAlpha functionality. For example: WolframAlpha["domain of x+x/(x(x^2-1))", {{"Result", 1}, "Output"}] WolframAlpha["range of x/(x(x^2-1))", {{"Result", 1}, "Output"}] HoldComplete[x < -1 || -1 < x < 0 || 0 < x < 1 || x > 1] ...


9

Interval is a proper way for your task, but sometimes it is not the way to go. There are functions which can return neither their ranges nor domains, e.g. function yielding k-th non-trivial zero of the Riemman zeta function. E.g. ZetaZero[1000]//N yields 0.5 + 1419.42 I, while N[ ZetaZero @ Interval[{1000, 10000}]] yields ZetaZero[Interval[{1000, ...



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