New answers tagged

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


0

All countably infinite sets have a bijection into $\mathbb{N}$. Therefore, both $A$ and the set {2, 3, 4, ...}, which is an infinite subset of $\mathbb{N}$ and thus countable, have a bijection into $\mathbb{N}$ and hence into each other. Now pair $b$ with 1 and you have a bijection of $A$ $\cup$ {b} into $\mathbb{N}$. Q.E.D. This is an abstract version of ...


1

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]


0

Or Integrate[1/((x^2 - a^2)^2 + b^4), {x, 0, Infinity}, Assumptions -> {a > 0, b > 0}]


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


2

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


2

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


1

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


1

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


10

There is also a newer package, HolonomicFunctions, that has an implementation of Chyzak's generalization of Zeilberger's algorithm. To perform the desired task, use the following commands: smnd = Simplify[ G /. HoldPattern[HypergeometricPFQ[pl_List, ql_List, x_]] :> (Times @@ (Pochhammer[#, k] & /@ pl)) / (Times @@ (Pochhammer[#, k] & /@ ql)...


1

The function cannot be integrated with unknown n, because its form changes with different values for n: Table[Integrate[Sqrt[2 - Cos[x]] Exp[I n x], x], {n, 0, 3}] 1: 2 EllipticE[x/2, -2], 1/3 (-4 EllipticE[x/2, -2] + 6 EllipticF[x/2, -2] - I Sqrt[2 - Cos[x]] (-5 + 2 Cos[x/2]^2 + Cos[x] + 2 I Sin[x])) 2: 2/15 (I + Cot[x]) (13 ...


0

NIntegrate[expr,{\[Theta],0,2*Pi}]// Timing {0.008, 0.0151049} When you integrating it within a limit, it will always give you a number, not a function. Now, say you are interested in finding the integration as a function of the upper limit. In that case you can get an InterpolatingFunction which you can use in any further calculation. data = Table[{...


3

How about adding some assumptions (I think the following is reasonable): res = Integrate[(x1 + x2 - 1)*(Boole[ x1 + x2 >= s && x1 >= t1 && x2 >= t2]), {x1, 0, 1}, {x2, 0, 1}]; FullSimplify[res, 0 < s < 1 && 0 < t1 <= t2 < 1] $$\begin{cases} \frac{1}{2} (\text{t1}-1) (\text{t2}-1) (\text{t1}+\text{...


1

Here is how to do the contour integral. Shown for some specific parameters. A = 1; B = -1/2; a = 1; f[z_] := (E^(-a z))/(A + B (Cosh[z])) Integrate[f[rz - I Pi], {rz, Infinity, 0}] + Integrate[f[z], {z, -I Pi, I Pi}] + Integrate[f[rz + I Pi], {rz, 0, Infinity}] // Simplify 4/3 I (-3 + 2 Sqrt[3]) Pi You will need to add appropriate assumptions to ...


3

Michael E2 and Bob have solved the integral. Here is an alternative method which might be of interest as well. I have used the similar method already in How to solve this integration?. We solve the integral transforming it into a complex contour integral which, after a simple binomial expansion, can easily be soved by the Cauchy theorem. The remaining ...


4

Rather than define a function, you can define a replacement rule using Hold and RuleDelayed rule = Hold[Integrate[ Exp[p_. Cos[x_] + q_. Sin[x_]]* Sin[a_. Cos[x_] + b_. Sin[x_] - m_. x_], {x_, 0, 2 Pi}]] :> I*Pi*((b - p)^2 + (a + q)^2)^(-m/ 2)*(((p^2 - q^2 + a^2 - b^2) + I*(2*(p*q + a*b)))^(m/2)* BesselI[m, Sqrt[(p^2 +...


6

One problem is that Exp[y] evaluates to Power[E, y], so that the integral does not match the (held) pattern with Exp. Another is that other functions sometimes evaluate to other forms, such as Sin: Sin[Sin[x] + Cos[x] - x] (* -Sin[x - Cos[x] - Sin[x]] *) Here is a fix that works on the example. I added a constant factor c_ to take care of the -1 ...


2

To some extent (and with some care) this can be done with FeynCalc. At least I used it several times when I needed to compute gradients and divergences of Cartesian vectors. The trick is to work with D-dimensional 4-vectors and take the limit $D \to 3$ at the end. Since FeynCalc doesn't distinguish between upper and lower indices, the results are the same as ...


6

Everything you want in the question can be done by defining the derivative of the Norm: Derivative[1][Norm][z_] := z/Norm[z] D[Norm[x - y], {x}] (* ==> (x - y)/Norm[x - y] *) Simplify[D[Norm[x - y], {y}]] (* ==> (-x + y)/Norm[x - y] *) Here, the syntax I used for the derivatives is such that it would remain valid if x or y were replaced by vectors ...


3

We can simplify the derivation of coolwater appreciably by getting rid of the mixture of t and alpha. It turns out that in the present aproach the only jumps of the antiderivative occur at t = Pi which can be easily taken into account. Here we go: $Version (* Out[176]= "10.1.0 for Microsoft Windows (64-bit) (March 24, 2015)" *) In the first step we "...


0

I have found yet another way to solve this. Based on J.M.'s answer and another post on defining the derivative of Abs for Real valued functions (will look it up later to add here). The following code works: Derivative[1][Abs][x_] := Re[ Conjugate[x] D[x, s] ]/Abs[x]/D[x, s]; Plot[D[Abs[k[s]], s] /. k -> kf /. s -> ss, {ss, 0, 1}] It is worth ...


7

First of all you can simplify the integral by the substitution $t\mapsto t/\omega$, which just changes the value by a known factor. After this, the integrand is: (Cos[t]^2 Cos[α + t])/(-1 + A Cos[α + t])^2 Which is integrated to obtain int = Integrate[(Cos[t]^2 Cos[α + t])/(-1 + A Cos[α + t])^2, t]; Plotting the int for some values of A, omega, and ...


2

I. A summary for the failing trial Residue can't calculate the residue of u directly. (It's hard to tell whether it's a bug or not, Residue never promises he will calculate every known residue, anyway.) SeriesCoefficient won't give desired answer in the following case: SeriesCoefficient[u, {s, 0, -1}] If it gave the desired answer, we would be able ...


2

Alternatively, you could do a little complex number algebra for the purpose: kf = NDSolveValue[{I k'[s] == 20 (s k[s] - (1 - s) (1 - k[s]) (1 + k[s])), k[0] == 1/2}, k, {s, 0, 1}]; Plot[{10 Abs[kf[t]], Re[kf[t] Conjugate[kf'[t]]]/Abs[kf[t]]}, {t, 0, 1}, PlotLegends -> {"scaled function", "numerical derivative"}]


1

Integrate[Sin[x]^3 (Cos[x])^3, x]; Plot[{-(3/64) Cos[2 x] + 1/192 Cos[6 x], 1/6 (Cos[x])^6 - 1/4 (Cos[x])^4 + 1/24, 1/4 (Sin[x])^4 - 1/6 (Sin[x])^6 - 1/24}, {x, -4 Pi, 4 Pi}, PlotLegends -> "Expressions", PlotRange -> All]


3

You could try using numerical differentiation from the Numerical Calculus package: Clear[r, fun] Needs["NumericalCalculus`"] r = NDSolve[ {I k'[s] == 20 (s k[s] - (1 - s) (1 - k[s]) (1 + k[s])), k[0] == 1/2}, k, {s, 0, 1} ]; fun[s_] := Abs[(k /. r[[1]])[s]]; Plot[ {10 fun[t], ND[fun[s], s, t, Terms -> 20]}, {t, 0, 1}, PlotLegends -&...


5

If you provide those important Assumptions to Limit, it will correctly compute that the exponential goes to zero, as you already know: Limit[ -(((-1 + E^((t*α)/(-1 + α)))*x)/α), α -> 1, Direction -> 1, Assumptions -> t > 0 && Element[x, Reals] ] (* x *) This is explained in the documentation for Limit -> Examples -> Options -> ...


4

This is a corrected version of poor quality post I originally posted. This is to classify the extreme values using Lagrange multiplier method. The bordered Hessian for 2D case with one constraint is calculated. Projections onto x-z and y-z plane are used just to show the minima and maxima (local and global for constraint): f[x_, y_] := x^3 - x*y + y^2 + 3 ...


3

Here is a way to do the manipulation. First I define a convenient way to set up vector fields, then I do the dot product and gradient. The main thing is that the application to the vector argument on the right is done element-wise, so that the natural Mathematica operation is Map (/@). To make the order of operations clearer, I also use two different ...


2

Here's a possible approach: Clear[a, b, c, s, int] a = 4 Cos[af/2]^2; b = 1 - 5 Cos[af/2]^2; c = Cos[af/2]^2; s = Sqrt[a*x^4 + b*x^2 + c]; int[par_?NumericQ] := With[{integrand = s /. af -> par}, NIntegrate[integrand, {x, 0, 1}]] Plot[int[af], {af, -2 Pi, 2 Pi}] Finding the maxima and minima using the int expression is also possible. Let's first ...


3

Comment Realize that there is a difference between your original nicely printed equations and the code that you have typed. The difference is in the numerator of the function to be integrated. In the nicely typed set of equations you have Δ in the numerator where as in the code you have typed you have Δ0. Original Code Which is correct? Original ...


1

ComplexExpand with TargetFunctions -> Abs help us to solve this integral. f[t_] := Sqrt[Exp[I*t]^2 - 1]; complex = ComplexExpand[f[t], TargetFunctions -> Abs] Sqrt[Abs[-1 + E^(2 I t)]] Cos[1/2 (-I Log[-1 + E^(2 I t)] + I Log[Abs[-1 + E^(2 I t)]])] + I Sqrt[Abs[-1 + E^(2 I t)]] Sin[1/2 (-I Log[-1 + E^(2 I t)] + I Log[Abs[-1 + E^(2 I ...


2

EDIT It can get more complicated. Look at a contour given by r[t_] := 1 + 2 Cos[t]; Original post The result of the integral for a (reasonable) closed contour is just 2 I times the area enclosed by the contour. Proof: the integral is $$\int \left(z^*+z\right) \, dz$$ Letting $$z=x+i y$$, $$dz=dx+i dy$$ the integral becomes $$\int 2 x (dx + i dy)=...


0

May be it will help if you look at the plots: Plot[SquareWave[t], {t, 0, 10}] Plot[Evaluate[Integrate[SquareWave[t], t]], {t, 0, 10}]


2

As requested, comment made into an answer. The problem was with the integration limits in the OP. The points on the circle satisfy (x-x0)^2 + (y-y0)^2 == R^2 so for a point x in the range [x0-R,x0+R] the limits on y are {y0 - Surd[R^2 - (x-x0)^2,2],y0 + Surd[R^2-(x-x0)^2,2]} I use Surd here because MMA may simplify more easily than with Sqrt, since ...


5

First we shall define 'the integration on a curve'. Traditionally, this is defined as integration of f.dl where dl is the length of a small part of the curve. So, using t as a medium, we can explicitly write out the curve's function on a complex plane, here let's assume it's z=2 Exp[I t]. Then we can use t, a real number, as the integration variable, which ...


7

Rule-replacement with x^n_. :> Derivative[n,0][a][y,z] (as done in Kuba's answer) has two drawbacks: if your polynomial has a constant term, then it will not be replaced by the zero-th derivative a[y,z], and if your polynomial is not expanded the result is incorrect. Namely, (1+x)(2+x) becomes (1+a'[y,z])(2+a'[y,z]) rather than 2a[y,z]+3a'[y,z]+a''[y,z] (...


1

Here is my function that integrates $x$ over arbitrary segment defined by points $P_1$ and $P_2$: r[p1_List, p2_List] := (p2*# + (1 - #) p1) &; iSeg[p1_List, p2_List] := Module[{rr, v, x}, rr[t_] := r[p1, p2]@t; v[t_] := Evaluate@Norm@D[rr[t], t]; x[t_] := rr[t][[1]]; Integrate[x[t] v[t], {t, 0, 1}] ]; iSeg[{0, 0}, {1, 0}] (* 1/2 *) ...


2

For a closed curve you can parameterise it with the angular variable. First use $x=r cos(\theta),y=r sin(\theta)$ and then find $r=r(\theta)$ from the the curve. So you end up with $x=x(\theta),y=y(\theta)$. First you change your coordinates to polar. Make sure to choose the origin inside the region or else you will not get a [0,2Pi] limit for the angle. I ...


4

{x, x^2, x^2 + x} /. x^n_. :> Derivative[n, 0][a][y, z]


3

This is a bug due to the use of slots (#1, #2, ...) internally in the implementations of Derivative and of Integrate. Focus first on Derivative. Derivative[1,0][Print] prints #1#2. This means that at least one branch of the code for Derivative involves calling Print[#1,#2]. In your case, Derivative[1,0][f] calls f[#1,#2]. Focus next on Integrate The ...



Top 50 recent answers are included