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

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


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

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])}} *) ...


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


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


6

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


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


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


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

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

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


4

At first glance it seems hopeless - you have all those hyperbolic trig and regular trig functions in your exponent. But then you notice that that is all superfluous since the only two variables you care about, X2 and P2 don't go into any of those functions, so that other stuff is just a distraction. {X1,P1,r, φ, θ, η} are all just constants! What you are ...


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


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

Square brackets in Mma are used only to specify function arguments.Your function is equivalent to the following (by using FullSimplify[ ]) f[x_, y_, z_] := -((x (-1 + x + y) + (x + y) z)/ Sqrt[(-1 + x + y) (x + y) (-1 + x + z) (x + z)]) and then {D[f[x, y, z], x] , D[f[x, y, z], y] , D[f[x, y, z], z]}


3

When I first made this answer I was bleary eyed and didn't realize that Willinski's answer matched the question except that he made a nice edit by replacing, for example, 1.5 with 3/2. This answer is in addition to Willinski's fine work. I followed his procedure. I wanted to do a numerical study and try to find the region of interest. A = 1; J = 1; c = 1; ...


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

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])$


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

The reason that you get the error "r1/Rc is not a valid variable" is that Mathematica can't take a derivative with respect to an expression, and your definitions make it so that somewhere in your code, you are trying to do something like D[h[r1/Rc], r1/Rc] which doesn't make sense. Instead, I think the most straight-forward way to do this is via ...


2

The use of NumericQ as mentioned by MarcoB and Guess who it is. in the comments seems to be important. Also, estimating the integral using a Total[Table[]] as in the code I posted in the second revision of the question makes this method computational feasible enough to solve my problem.


2

Besides getting the syntax as discussed by belisarius, FullSimplify will be very helpful to you in this case. f[x_, y_, z_] := Sqrt[(x + y) (1 - x - y) (x + z) (1 - x - z)] * (x/((x + y) (x + z)) - y/((x + y) (1 - x - z)) - z/((1 - x - y) (x + z)) + (1 - x - y - z)/((1 - x - y) (1 - x - z))) D[f[x, y, z], x] // FullSimplify ((-1 + 2*x + y + ...


2

A = 1; J = 1; c = 1; beta = 1; int = Integrate[E^(c*beta*l*H*(3/2 x^2 - 1/2)), {x, 0, 1}] //FullSimplify; sum1 = Sum[l^(3/2)*E^(-u*l)*int, {l, 1, 100}]; sum2 = Sum[l^(5/2)*E^(-u*l)*int, {l, 1, 100}]; eq1 = A*beta^(-3/2)*E^(-J*beta - 1/2*c*beta*H^2); eq2 = eq1*(1 + sum1) - 1; eq3 = eq1*(1 + sum2) - H; ContourPlot[{eq2, eq3}, {u, 0, 10}, {H, 0, 5}, ...



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