New answers tagged

3

Factor[2 (1 + z), Modulus -> 1 + z] (* 0 * ) Factor[2 (z + 2) (z + 3) + (z + 4), Modulus -> z + 2] (* 2 *) Factor[2 (z + 2) (z + 3) + (z + 4) (y + 3), Modulus -> z + 2] ( * 6 + 2 y * )


2

Using the option MaxRecursion reduces the number of PlotPoints needed. Clear["Global`*"] f[x_, y_] := 2 (-4 + x^2) Sinh[(π x)/3] + 1/16 (((4 + x^2)^2 + 64 (-4 + x^2) Cos[y] Cosh[(2 π x)/3] + 256 x Sin[y] Sinh[(2 π x)/3]) Sinh[π x] - 2 (4 + x^2)^2 Sinh[(5 π x)/3] + (-12 + x^2)^2 Sinh[(7 π x)/3]); ContourPlot[f[x, y], {x, 3....


3

You can solve for $y$ to get the two level sets. Note that the plot in the question is inaccurate, even for a high number of plot points, and it seems to think they are left/right, but actually they are top/bottom: {f1, f2} = y /. Solve[f[x, y] == 0, y] /. C[1] -> 0; Plot[{f1, f2}, {x, 3.45, 3.5}] These expressions are both ArcTan of a large inner ...


1

Not a complete answer but one direction to go in: cp = ContourPlot[f[x, y] == 0, {x, 3.465728, 3.465729}, {y, 1.046786, 1.046795}, PlotPoints -> 500] {l1, l2} = Cases[Normal[cp], _Line, Infinity]; {{x1, y1}} = MinimalBy[First@l1, RegionDistance[l2]]; {{x2, y2}} = MinimalBy[First@l2, RegionDistance[l1]]; Show[ cp, ListPlot[{{x1, y1}, {x2, y2},}, ...


0

You need to estimate the value of $\rho_0$ using NIntegrate: Subscript[a, p] = 0.428; Subscript[α, p] = 1.04; R = 2.45; Subscript[ρ, 0] = 1/NIntegrate[1/( 1 + (E^(2.336448598130841` (-2.45` + r)) + E^(-2.336448598130841` (2.45` + r))) (0.5` + 0.08329862557267803` r^2)^1.04`), {r, 0, ∞}] Subscript[ρ, p1][r_] = Subscript[ρ, 0]/((E^((r - R)/...


0

ArcTan simplifications are somehow limited: Simplify[ArcTan[x, y], {x == y, 0 < y, 0 < x}] Sadly only gives: ArcTan[y, y]


4

Try Derivative Plot[ Derivative[1][Sin ][x], {x, 0, 2 \[Pi]}] or Evaluate Plot[Evaluate[D[Sin[x], x]], {x, 0, 2 \[Pi]}]


0

expr = 1/32 (8 - Sqrt[(-8 - 36 Abs[y] (1 + 2 Sqrt[Abs[z]]) - 27 (Abs[y] + 2 Abs[y] Sqrt[Abs[z]])^2)^2 - 64 (1 + Abs[y] + 2 Abs[y] Sqrt[Abs[z]])] + 36 Abs[y] (1 + 2 Sqrt[Abs[z]]) + 27 (Abs[y] + 2 Abs[y] Sqrt[Abs[z]])^2); Looking at the plot, Plot3D[expr, {y, -1, 1}, {z, -1, 1}, PlotPoints -> 100, MaxRecursion -> 5,...


2

This can be done by the change Abs[y] -> a^2, Abs[z] -> b^2 in order to obtain a polynomial in a and b as follows. Maximize[{1/ 32 (8 - Sqrt[(-8 - 36 Abs[y] (1 + 2 Sqrt[Abs[z]]) - 27 (Abs[y] + 2 Abs[y] Sqrt[Abs[z]])^2)^2 - 64 (1 + Abs[y] + 2 Abs[y] Sqrt[Abs[z]])] + 36 Abs[y] (1 + 2 Sqrt[Abs[z]]) + 27 (Abs[y] + 2 Abs[y] Sqrt[Abs[z]])^2)...


2

The comment of Henrick Schumacher answered my question so I am posting it here: The RegionMeasure of a discrete point cloud is of course the counting measure (because RegionDimension[Point[{{0, 0, 0}, {8, 8, 8}}]] returns 0). And for two points it is equal to 2, no matter what the coordinates are.


0

What is the meaning of false and how to find the range of function in this case? The default for domain is Reals When it returns False it means there is no range in the reals. FunctionRange[{1/2 (1 - Sqrt[-1 + 4 Abs[x]] Sqrt[-1 + 4 Abs[z]]), 0 < Abs[x] < 1/4 && 0 < Abs[z] < 1/4}, {Abs[x], Abs[z]}, y] (*False*) Change to complex ...


6

One can use Composition (which should be the true meaning of the product of operators) with (pure) Function: ClearAll[op, ff] ff[j_] := f \[Function] D[f, x] - j f op[n_] := Composition @@ Table[ff[j], {j, n}] op[2][f[x]] // Simplify 2 f[x] - 3 f'[x] + f''[x] Update The version without Apply (@@) (actually Composition can be also replaced by ...


7

Clear["Global`*"] Defining the operator recursively, dOp[func_, x_Symbol, 1] := dOp[func, x, 1] = D[func, x] - func; dOp[func_, x_Symbol, n_Integer?Positive] := dOp[func, x, n] = D[dOp[func, x, n - 1], x] - n*dOp[func, x, n - 1]; For example, dOp[f[x], x, 2] // Expand (* 2 f[x] - 3 f'[x] + f''[x] *) Looking at the first several, Table[{n, ...


3

op[f_, x_, n_] := Block[{d}, Total[MapIndexed[#1*If[#2[[1]] == 1, 1, D[f[x], {x, #2[[1]] - 1}]] &, CoefficientList[Product[d - j, {j, 1, n}], d]]]] op[g, y, 2] gives 2 - 3 g'[y] + g''[y] Update based on your comment: op[f_, x_, n_] := Block[{d}, Total[MapIndexed[#1*D[f[x], {x, #2[[1]] - 1}] &, CoefficientList[Product[d - j, {j, 1, ...


2

The problem is that Abs has no built in derivative. One solution is setting Abs'[x_] := HeavisideTheta[x] Then you can do Plot[f'[x], {x, 0, 1}]


2

Perhaps this: energy = Interpolation[Transpose@Reverse@Transpose@data, pressure]; pressure = Interpolation[data, energy]; Or this: energy = Interpolation[Transpose[{pressuredata, energydata}], pressure]; pressure = Interpolation[Transpose[{energydata, pressuredata}], energy]; Addendum: Inverting data alternatives (in order of decreasing code length and ...


3

Why not putting it explicitly? From help, Root "Represents the exact k^th root of the polynomial equation f[x]==0" This can be rewritten as follows expr = Root[-a+b#1^3&,1]< \[Beta] < (a/b) expr // ToRadicals From help on ToRadicals it says attempts to express all Root objects in expr in terms of radicals. To try to answer the ...


1

Clear["Global`*"] m2 = 1/2; ℏ = 1; w = 1/2; \[ScriptCapitalO]2 = -ℏ^2/(2 m2) Laplacian[u[x, y], {x, y}] + 1/2 m2 w^2 (x^2 + y^2) u[x, y]; {vals, funs} = NDEigensystem[{\[ScriptCapitalO]2, DirichletCondition[u[x, y] == 0, True]}, u[x, y], {x, -10, 10}, {y, -10, 10}, 28, Method -> {"PDEDiscretization" -> {"...


4

Have a look at the documentation. This is from the ref page of NDEigensystem {vals, funs} = NDEigensystem[-Laplacian[u[x], {x}], u[x], {x, 0, \[Pi]}, 4] NIntegrate[#^2, {x, 0, \[Pi]}] & /@ funs (* {1., 1., 0.999995, 1.} *) Note that the argument u[x] to NDEigensystem tells NDEigensystem that the resulting interpolating functions will also have the ...


0

Alright, I seem to have a solution that works for now, but I do planning on using a loop and this might get a little hard to incorporate into the same, so if anyone has any better ideas please do let me know. I explicitly defined an Integrand as a function of x and y and was able to integrate the functions after that Integrand[x_,y_] = \[Psi]1[x,y] x \[Psi]2[...


1

Just get an overview with RegionPlot3D . RegionPlot3D[ PolyLog[2, x*y/z] - PolyLog[2, -x*y/z] \[Element] Reals && x > 0 && y < 0 && z < 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, PlotPoints -> 100]


3

You can use the more explicit 3-argument form of OptionValue: ClearAll[g]; Options[g] = {a -> 1}; g[][opts : OptionsPattern[]] := OptionValue[g, {opts}, a]; g[][] g[][a -> 2] 1 2 Or: ClearAll[g]; g[][opts : OptionsPattern[{}]] := OptionValue[{}, {opts}, a]; g[][a -> 2] 2 Or if you want default option values without defining options for g: ...


2

OptionsPattern apparently does not work for SubValues. One possible solutions is to use an Association for option-like behavior g[][opts_Association] := opts["a"] g[][<|"a" -> 1|>] (* 1 *) Of course, if you desire the more complex features of options then this will not be too helpful (unless you want to re-implement all the ...


5

Recommend that you look at Array Clear["Global`*"] genMat[n_Integer?Positive, f_] := Array[f, {n, n}] genMat[4, f] (* {{f[1, 1], f[1, 2], f[1, 3], f[1, 4]}, {f[2, 1], f[2, 2], f[2, 3], f[2, 4]}, {f[3, 1], f[3, 2], f[3, 3], f[3, 4]}, {f[4, 1], f[4, 2], f[4, 3], f[4, 4]}} *) genMat[4, Times] (* {{1, 2, 3, 4}, {2, 4, 6, 8}, {3, 6, 9, 12}, {...


4

It's a question of numerical precision. Set ky and ky to zero and plot the integrand ii, enlarge working precision and rationalize variable in Plot. ii[p_, u_] = 96*Cos[p/2]*(1 + I*kx*Cos[p] + I*ky*Sin[p])^(-7/2)*1/(6!* Sqrt[Pi])*(((Sqrt[ 2*u]/(Cos[ p/2]*(1 + I*kx*Cos[p] + I*ky*Sin[p])^(1/2)))^6 + 15/2*(Sqrt[ 2*u]/(Cos[...


2

As mentioned by flinty, Iw should be I*w; and LogLinearPlot makes it easier to visualize. freq[a_, b_, t0_, tr_, s_] := -((b E^(-s (b + t0)) (b E^(s (b + t0)) (-1 + b s) UnitStep[-b] - b E^(s t0) UnitStep[b] + E^(s (b - tr)) (E^(s (t0 + tr)) (-1 + b s) UnitStep[-t0] + E^(s tr) (-1 + b s - s t0) UnitStep[t0] - E^(s ...


10

A packed arrays (or a MTensor on the C++ side of Mathematica) consists of a linear array containing all entries plus the information needed for storing of the Dimensions of the packed array. That is 1 mreal=double/mint=long long int = 64 bit = 8 byte per entry + a few bytes for storing the array of the Dimension of the packed array (again probably a mint/...


Top 50 recent answers are included