Hot answers tagged

9

Let's rename things slightly to make it more consistent g = Fit[newdata, {1, x, x^2, x^3, x^4}, x]; To find inflection points, you can just put (blue) points where the second derivative is zero. Plot[g, {x, 20, 60}, Epilog -> {Red, PointSize[0.02], Point[newdata], Blue, Point[{x, g} /. Solve[D[g, {x, 2}] == 0]]}, PlotRange -> {{-5, 70}, {-5, ...


8

Given $d\in\mathbb{N}_0$, the Taylor series about $i/2^d$ is a polynomial of degree at most $d$ for all $i\in\mathbb{Z}$. Let $S_d$ be the set of such Taylor series. There exist unique polynomials $pol_0,pol_1,\ ...\ ,pol_d$ of degree $0,1,\ ...\ ,d$ and a function $c:\mathbb{N}\times\mathbb{R}\mapsto\{-1,0,1\}$ such that for all $x\in\mathbb{R}$, the ...


8

You can use the Euler-Maclaurin formula to get the limit (the sum can be approximated by an integral, which becomes exact in the infinite limit): f[i_] = i/(n^2 - i + 1); Integrate[f[k], {k, 0, n}, Assumptions -> n > 0] Limit[%, n -> Infinity] 1/2


7

Reverse the order of the summation. i.e., k -> (n - k + 1) s = Sum[(n - k + 1)/(n^2 - (n - k + 1) + 1), {k, 1, n}] // Simplify (* -n + (1 + n^2) PolyGamma[0, 1 + n^2] - (1 + n^2) PolyGamma[0, 1 - n + n^2] *) Limit[s, n -> Infinity] (* 1/2 *) For an alternative representation s2 = FullSimplify[s] (* -n - (1 + n^2) HarmonicNumber[(-1 + n) n] ...


6

Assume analyticity : Limit[1 + (r El'[r])/El[r], r -> 0, Analytic -> True] (* 1 *) Analytic->True assumes that generic functions (e.g., El[r] and El'[r] in this case) are analytic.


6

Using the conditions in the book ClearAll[a, x]; expr = Log[1 + 2 a*Cos[2 x] + a^2]*Sin[x]^2; r = Integrate[expr, {x, 0, Pi/2}, Assumptions -> a^2 > 1] Book result You used $a>1$ but the book says to use $a^2>1$. These are not the same. Update: I asked about this on another forum. Experts opinions says that result should be valid for $...


5

In addition to what was suggested by @BobHanlon, one might just replace the quotient of El'[r])/El[r] by the assumed value of A+O[r] to denote that it is the given constant A to first order. In[646]:= Limit[1 + r (A + O[r]), r -> 0] (* Out[646]= 1 *)


5

The problem appears to be that Mathematica assumes certain values for a and b so that it can use a particular expression to obtain the result. This is not (necessarily) consistent with the assumptions that you supply for Simplify. The solution is to supply the assumptions around the integral, so that they can be accounted for there. I believe that the ...


4

TL;DR Use HeavisideTheta's properties before integration. This is my strategy. First the HeavisideTheta gives you the following integration limits: $$0\leq y \leq 1-x \qquad \& \qquad 0\leq x \leq 1$$ $$0\leq x \leq 1-y \qquad \& \qquad 0\leq y \leq 1$$ In both cases I used Integrate first then NIntegrate. In the first case I could not ...


4

[...] I am only interested in very fast numerical methods, no analytical results are needed. [...] I have no idea how I can do it in Mathematica The package AdaptiveNumericalLebesgueIntegration.m has Lebesgue integration strategy and rules implementations and it is discussed in detail in the blog post "Adaptive numerical Lebesgue integration by set ...


4

The problem is that the two Hypergeometric2F1 terms each take the value of ComplexInfinity when n=1. The resulting difference is necessarily undefined. If Mathematica substitutes n->1 before evaluating the integral, it is able to use a more specific integration technique. This sort of behaviour occurs frequently: Mathematica results that are ...


4

Consider the following additional definition: Clear[deriv] deriv[α_][a_ x_^k_][x_] := If[k >= α, Gamma[k + 1]/Gamma[k + 1 - α] a x^(k - α), 0] deriv[α_][polynomial_Plus][x_] := Plus @@ (deriv[α][#][x] & /@ MonomialList[polynomial]) Now: deriv[1.0][5 x^1.2 + 3 x^0.8][x] (* Out: deriv[1.][0][x] *) You should still add definitions for such special ...


3

Maybe you want something like this?: eq = 4/2 x (1 - x) (x - 1/2) - 1/2 m x^2 sols = x /. Solve[expr == 0, x] (* Out[2] := {0,1/8 (6-m-Sqrt[4-12 m+m^2]),1/8 (6-m+Sqrt[4-12 m+m^2])} *) realandimaginarysolutions = Through[{Re, Im}[#]] & /@ sols (* Out[3] := {{0,0} ,{1/8 (6+Re[-m-Sqrt[4-12 m+m^2]]),1/8 Im[-m-Sqrt[4-12 m+m^2]]} ,{...


3

Another form I have found useful is: f = ListInterpolation[ Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}] Then one can make derivative functions that can be treated as normal function via dfdx[x_, y_] := Evaluate[D[f[x, y], {x, 1}]] dfdy[x_, y_] := Evaluate[D[f[x, y], {y, 1}]] and the second derivatives d2fdx[x_, y_] := Evaluate[...


3

Using an example from the documentation of ListInterpolation: f = ListInterpolation[ Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}] dfdx[u_, v_] := D[f[x, y], x] /. {x -> u, y -> v} dfdy[u_, v_] := D[f[x, y], y] /. {x -> u, y -> v} Manipulate[ Show[{Plot3D[f[x, y], {x, 0, 1}, {y, 0, 2}], Graphics3D[{Red, PointSize[0.03]...


3

f[x_] = Piecewise[{{Sqrt[x], x >= 0}, {Sqrt[-x], x < 0}}]; f'[x] gives $$ \begin{cases} -\frac{1}{2 \sqrt{-x}} & x<0 \\ \frac{1}{2 \sqrt{x}} & x>0 \\ \text{Indeterminate} & \text{True} \end{cases} $$ f[x_] = Sqrt[Abs[x]]; f'[x] gives $$ \frac{\text{Abs}'(x)}{2 \sqrt{\text{Abs}(x)}} $$ So the second form doesn't evaluate ...


3

In cases where you can't get a symbolic result, it's also possible to use a completely numerical approach: Needs["NumericalCalculus`"] sum[n_?NumberQ] := NSum[k/(n^2 - k + 1), {k, 1, n}] NLimit[sum[n], n -> Infinity] (* ==> 0.499999 *)


3

The following definition takes as arguments two pure functions, a and b, their argument x and the parameter n. HirotaD[a_, b_, x_, n_] := Module[{}, sol = D[a[x + y]*b[x - y], {y, n}] /. y -> 0 // TraditionalForm; Print[("\!\(\*SubscriptBox[\(D\), \(x\)]\)")^n, "=", sol]]; It works on general functions, not yet defined. HirotaD[a, b, x, 1] (*...


3

Use of NIntegrate and ?NumericQ were helpful in reducing errors. Take a look at the referenced questions at the bottom for additional information. ClearAll["Global`*"] data = {{0.0049351, 887.55}, {0.014628, 2076.6}, {0.024377, 2684.6}, {0.034198, 3044.85}, {0.043943, 3281.3}, {0.053758, 3454.15}, {0.06349, 3585.85}, {0.073305, 3692.4}, {0....


2

Please make your question clear. But I think you're simply using f'[x,y] and hope that you can get a result? Try the following code: f = ListInterpolation[ Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}] D[f[x, y], x] Plot3D[Evaluate@D[f[x, y], x], {x, 0, 1}, {y, 0, 2}] for higher order: D[f[x,y],{x,2}] Will this code help? ...


2

I've edited my answer in the linked thread so that it can now be used without modification. Previously, you had to define the functions uv that you wish to differentiate in a more general way, replacing the explicit 0 in their argument with y. The reason is that my earlier answer assumed differentiations are performed on the given function, not on the new ...


2

This has been confirmed as a bug by Wolfram support.


2

You are correct. It is the logical OR function. It evaluates its arguments in order, giving True immediately if any of them are True, and False if they are all False. https://reference.wolfram.com/language/ref/Or.html


2

To get a simpler form f[a_, b_] =Assuming[a > 0 && b > 0, Integrate[ 1/((x^2 - a^2)^2 + b^4), {x, 0, Infinity}] // ComplexExpand[#, TargetFunctions -> {Re, Im}] & // Simplify] Plot3D[f[a, b], {a, -5, 5}, {b, -6, 6}, ClippingStyle -> None]


2

The integrand cannot be solved when $|z|\rightarrow1$ Therefore, let's integrate the function on a possible domain, numerically. zdat=Table[NIntegrate[f, {Phi, 0, 7 Pi/18}, {z, 0, i}], {i, -0.95, 0.95, 0.1}]; This gives us a list of values, from which we can approximate a function for this part of the domain for z. Plotting this list gives us: lp = ...


2

I am definitely not an expert in this field, but I believe that some part of Integrate uses Risch's algorithm. And that, to my understanding, is also the reason why it's not easy to show the "steps" Integrate takes to solve an integral. The intermediate "steps" are not meaningful to most humans. Some more references are in the page "Some Notes On Internal ...


2

To expand on my comment: in Gradshteyn and Ryzhik (the seventh edition, at least), they list formula 2.174, which I think is more practical for computational purposes than the direct output of Mathematica. Translated into Mathematica syntax for the OP's specific case, if we have int[n_] := Integrate[t^n/(t^2 + b t + 1), t] then there is the useful (...


2

Plugging in F[x_] := Piecewise[{ {0, x == 0}, {2*x*Cos[1/x], x != 0}}]; Integrate[F[x], x] leads to the output Piecewise[{{2 (1/2 x^2 Cos[1/x] + 1/2 CosIntegral[1/x] - 1/2 x Sin[1/x]), x <= 0}}, I \[Pi] + 2 (1/2 x^2 Cos[1/x] + 1/2 CosIntegral[1/x] - 1/2 x Sin[1/x])]]


2

To answer this ill-posed question, we need to know the following, Values of m and θ which to do not produce a singularity in the integrand in the domain of interest, {r, 1, 8}. I choose m = 20 and θ = 4 π, more or less arbitrarily. A syntactically correct integrand. I am guessing you want 1/(1 - 4 m/(r Sqrt[π]) GammaRegularized[3/2, r^2/(4 θ)]) With ...


2

Clear your variables before you run and "cosine" isn't recognized by Mathematica. You need to use Cos[]. ClearAll["Global`*"] Integrate[1/(1 + 3 Cos[x] Cos[x]), {x, -Pi, Pi}] Pi In regard to your follow-up question in the comments about the following equation: $$1/(1 - Cos[x] - I (1/3) Sin[x])$$ The integral doesn't converge with the region {x,-Pi,...



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