Tag Info

Hot answers tagged

19

Summary: Setting GenerateConditions -> False turns off safety checks. In my opinion, when the user does that and the result is erroneous, I would not call that a bug. Now WRI could decide to improve Mathematica in this case, but it might not be such a simple matter. On the other hand, it is entirely up to the user to decide whether or not he or she is ...


9

Not so fancy as transforming an image, but I like how the mesh in ParametricPlot shows the deformation. {chvar} = Simplify[ Solve[u == x y && v == y - x && y > 0 && x > 0, {x, y}, Reals], 1 <= u <= 4 && 0 <= v <= 2] (* {{x -> (2 u)/(v + Sqrt[4 u + v^2]), y -> 1/2 (v + Sqrt[4 u + v^2])}} *) ...


9

It's because it has no closed form, and the default numerical methods don't converge quite fast enough on it. NIntegrate returns -0.585566 given a higher-than-usual value of MaxRecursion: NIntegrate[ Exp[-r^2]*r^2*Log[Exp[-r^2]*r^2*(25/10 - r^2)*(25/10 - r^2)], {r, 0, 10}, MaxRecursion -> 20] Here's how to do it without specifying any MaxRecursion. ...


9

RegionPlot[1 < 2 x + y < 4 && -1 < x - y < 1, {x, -1, 2}, {y, -1, 3}]


8

On a different occasion (Dirichlet coefficients as limits: wrong) I have shown that the sometimes limited capabilities of the function Limit[] can be improved by using an intermediate Series[]. Following this idea we can write for the limit in question Limit[Expand[ Normal[Series[(n - n Sqrt[1 + x])^2, {x, 0, 2}]] /. x -> 10/ n + Sin[n]/n^2], n ...


8

I will post this to avoid confusion - region has a new meaning in WL since Geometric Computation was introduced in V10. Relative to that meaning what you showed is not a WL region because you cannot compute over it, but of course is a visual of some mathematical region defined analytically and shown with help of Filling. To achieve the same via computable ...


6

Assuming your parameters are real, you can replace Sin by its range: Limit[T /. Sin[_] :> Interval[{-1, 1}], Ε -> ∞] (* 1 *)


5

Since your integrand does not approach zero but a finite positive number, Limit[Exp[-16.136 (1 - Exp[-0.012*t])], t -> Infinity] (* 9.82255*10^-8 *) the integral over {t, 0, Infinity} does not converge. By the way, the error in the NIntegrate[integrand, {t, 0, 1000}] should be about 10^-7, which seems better than R. In fact, the precision seems ...


5

When parameters to a integral are integers, I often fall back to calculating the "general" result, make a table where the parameter is explicitly given integer values, and then feed to FindSequenceFunction. In this case: table = Table[h[x, a, e] - g[x, a, e], {a, 1, 11}]; limits = Limit[#, e -> 0] & /@ table; f = FindSequenceFunction[limits]; ...


5

another test: f = x^3 + x*z^2 - 3*x^2 + y^2 + 2*z^2; cpts = Solve[Grad[f, {x, y, z}] == 0, {x, y, z}, Reals] {{x -> 0, y -> 0, z -> 0}, {x -> 2, y -> 0, z -> 0}} hesse = D[f, {{x, y, z}, 2}] /. cpts {{{-6, 0, 0}, {0, 2, 0}, {0, 0, 4}}, {{6, 0, 0}, {0, 2, 0}, {0, 0, 8}}} {ev1[l1,l2,l3], ev2[l1,l2,l3]} = Eigenvalues /@ hesse {{-6, 4, ...


5

The choice of branch cuts is made by re-defining the argument of the complex number under the square root. This can be done by using the approach of this answer: arg[z_, σ_: - Pi] := Arg[z Exp[-I (σ + Pi)]] + σ + Pi; sqrt[x_, σ_: - Pi] := Sqrt[Abs[x]] Exp[I arg[x, σ]/2] Here, the parameter $\sigma$ is the location of the branch cut of the square root. ...


4

$Version "10.2.0 for Mac OS X x86 (64-bit) (July 7, 2015)" The Direction of the limit should be -1 to approach 0+. From the documentation, "Direction -> -1 takes variables to approach their limits by decreasing from larger values." Limit[Integrate[(E^(-y*x) - 1)/y^3, {y, 1, \[Infinity]}], x -> 0, Direction -> -1] 0 Including the ...


4

The integral in your Mathematica code is not the same integral as in your image. Integrate[t^a Exp[-I t^b], {t, 0, Infinity}] (* ConditionalExpression[Gamma[(1 + a)/b]/ (E^((I*(1 + a)*Pi)/(2*b))*b), Re[a] > -1 && Re[b] > 1 + Re[a] && Im[b] == 0] *) Using these stated conditions Assuming[{Re[a] > -1, ...


4

Both Module and DynamicModule are shadowing the global variables x and y in the example in which you use them. The demonstration is best written without using either Module or DynamicModule. Manipulate[ ContourPlot[f, {x, -1, 1}, {y, -1, 1}, Contours -> 20, Epilog -> Dynamic[Arrow[{pt, pt + grad /. {x -> pt[[1]], y -> pt[[2]]}}]]], {f, ...


4

What about explicitly differentiating under the integral sign? dFlux[r0_?NumericQ, t_?NumericQ] := NIntegrate[ Derivative[0, 0, 1][B][r, s, t]*r, {s, 0, 2 Pi}, {r, 0, r0}, AccuracyGoal -> 3, PrecisionGoal -> 3, Method -> "Trapezoidal"]; Plot[Flux[0.2, t], {t, 0, 4*period}, AxesLabel -> {t, Flux}] Plot[dFlux[0.2, t], {t, 0, 4*period}, ...


4

The simplest method is to wrap xdummy in Quantity, e.g. result = Integrate[Quantity[3, "kN/m"] (1 - x/Quantity[10, "m"]), {x, Quantity[xdummy,"m"], Quantity[10, "m"]}] (* Quantity[(15000 - 3000 xdummy + 150 xdummy^2), ("Kilograms" "Meters")/("Seconds")^2] *) Since xdummy is now effectively unitless, you no longer need to include units in Plot, ...


4

When you try to NIntegrate your expression, the error messages include: "suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small". Your expression does not have a singularity, its integral is manifestly not zero, it is not oscillatory, so it must be a numerical precision problem. ...


4

The brute force method to arrive at your second solution f[z_] = 1/beta/(2*z)/(1 - beta); cl = CoefficientList[f[z], 1/z]; cl.Integrate[(1/z)^Range[0, Length[cl] - 1], z] Log[z]/(2*(1 - beta)*beta)


4

This symmetrizes an arbitrary expression by adding it to itself with the variable names interchanged. As a result, any term in the original expression has a symmetry-related counterpart, making the expression manifestly symmetric in the only sense that can be reasonably applied to an arbitrary expression. It's a special case of my answer to What is the ...


4

edit I have corrected omission of absolute value determinant. I am not currently able to access Mathematica but will correct image accordingly but till then just noted sign difference. Apologies. Just another way (including @belisarius region) change of variable (for this case can use affine transform to plot): mat = {{2, 1}, {1, -1}}; rect = Rectangle[{1, ...


3

Perhaps what you are looking for is: A = {{2, -1, 0}, {-1, 2, -1}, {0, -1, 1}}; Integrate[Exp[(-x . A . x)/2], x ∈ FullRegion[3]] 2 Sqrt[2] π^(3/2)


3

Not the simplest solution, but a clever one: eqs1 = {2 x + y == 1, 2 x + y == 4}; eqs2 = {x - y == -1, x - y == 1}; cornerPts = Flatten[({x, y} /. Outer[Solve[#1 && #2, {x, y}] &, eqs1, eqs2]), 2]; or cornerPts = Flatten[({x, y} /. Outer[Solve[2 x + y == #1 && x - y == #2, {x, y}] &, {1, 4}, {-1, 1}]), 2]; ...


3

I am using π rather than Pi in the equations you gave. I think this is what you wanted. When I substitute in 1 for the variables a, b, R and V0 it will not integrate in a closed form. Integrate[-((4 E^-r^2 r^2)/((1 + E^(-1 + r)) Sqrt[π])), {r, 0, Infinity}] However, NIntegrate works. NIntegrate[-((4 E^-r^2 r^2)/((1 + E^(-1 + r)) Sqrt[π])), {r, 0, ...


2

If you want to teach the students to interpret level sets, then it is possible visualize the behavior of a function by manipulating the level. There are various ways to set it up, to cue the students' recognition of the type of extremum, etc. Here's one, whipped up rather quickly. Clear[f, x, y, z]; f = x^3 + x z^2 - 3 x^2 + y^2 + 2 z^2 cpts = {x, y, z} /. ...


2

You can visualise a function of 3 paramters by putting one of them as argument of Manipulate: Manipulate[Plot3D[f /. z -> z1, {x, -3, 3}, {y, -3, 3}], {z1, -3, 3}]


2

If I understand the question properly, you would like to differentiate the expression f = Sum[c[k] Exp[-(a - t[k])^2], {k, kmax}] with respect to t[n], where n is an integer between 1 and kmax, to obtain (* 2 E^-(a - t[n])^2 c[n] (a - t[n]) *) Almost certainly, a similar question has been raised before, but I cannot find it now. In any case, the ...


2

I think what you want is something like this: Conjugate[f[x_, y_, z_]] ^:= cf[x, y, z] Derivative[d__][cf][x__] := Conjugate[Derivative[d][f][x]] D[Conjugate[f[x, y, z]], x] Conjugate[Derivative[1, 0, 0][f][x, y, z]] All I did here is to define the derivative of the function f to be another function cf which then can be given the property you want. ...


2

Right now (V10.2) NDSolve uses FEM for elliptic PDEs and that code does up to 2nd order spatial derivatives. The fact that this PDE can be viewed as a time dependent ODE is a coincidence in 1D as pointed out by @MichaelE2 and time dependent ODE are specified via explicit bounds. Another, harder, issue is that it is not trivial to write a general test to see ...


2

Here is some food for thought f[a_, t_List, c_List] /; Length @ t == Length @ c := Plus @@ MapThread[(#1 Exp[-(a - #2)^2]) &, {c, t}] f can be used as a numerical function or to generate symbolic expressions. The clause /; Length @ t == Length @ c enforces the constraint that the vectors t and c must have the same length. f[a, {t1, t2, t3}, {c1, ...


2

f[a_, b_] := a (a + b) + a b + b^2 Simplify@(f[a, b] + f[b, a])/2 or for polynomials: SymmetricReduction[a (a + b) + a b + b^2, {a, b}][[1]] $(a + b)^2$ The first approach works for functions such as: f[a_, b_] := Cos[a] + Sin[a + b] Simplify@(f[a, b] + f[b, a])/2 $1/2 (Cos[a] + Cos[b] + 2 Sin[a + b])$



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