E. Chan-López
  • Member for 4 years, 2 months
  • Last seen this week
  • México
Mathematica can't simplify asymptotic expressions containing constant symbols
2 votes

Try this: Simplify[Refine[Asymptotic[Sech[a x], a x -> ∞], Assumptions -> Element[a,Reals]]]

View answer
Solving a second-order equation by imposing the constraint that the variables are real
Accepted answer
2 votes

Try with Reduce[] command: Reduce[(1 + x + x^2 + y - x y + y^2) == 0, {x, y}, Reals] (*x == -1 && y == -1*) Solve[] works too: Solve[(1 + x + x^2 + y - x y + y^2) == 0, {x, y}, Reals] (*x == -...

View answer
Penetrate (multiply) a factor into an existing expression
Accepted answer
2 votes

Try this: p[x_,y_, a_] := 7 + 2 a (x + 1)^2 + 3 a^4 (y - 2) (x + 5) Collect[a*p[x, y, a], a, FullSimplify]

View answer
My Mathematica Plot isn't smooth
2 votes

Other way: For your graphics labels, use: << MaTeX` Definition of the $\phi(x,n)$ function: a = 1; p[f_] := Plot[f, {x, 0, 1}, PlotRange -> {{-0.08, 1.08}, {-60, 280}}, PlotStyle -> {Blue,...

View answer
Lyapunov exponent and stability of limit cycles
Accepted answer
2 votes

I recommend that you review the Liu criterion for the Hopf bifurcation, since it is the most suitable for detecting limit cycles in systems with three or more equations. It is more convenient to write ...

View answer
Compare the coefficient in same part of the equations
1 votes

Try this: twoEqs = {d + (b + a c) x + (a + b + c) x^2 == 0, e + (b + a f) x + (a - c + k) x^2 == 0} Reduce[CoefficientList[twoEqs[[1, 1]], x] == CoefficientList[twoEqs[[2, 1]], x]] (*(d == e &&...

View answer
ExternalEvaluate not running the whole Python file
Accepted answer
1 votes

First, try registering the external evaluator (Python or other). You just have to locate the path where you have it installed. Test:

View answer
PlotRange is not working with MaterialShading in Graphics3D
1 votes

$Version (*12.3.0 for Microsoft Windows (64-bit) (May 10, 2021)*) Try this: dots[x_, y_, z_] := {{MaterialShading["Plastic"]}, EdgeForm[None], Sphere[{x, y, z}, 0.105], Lighting -> &...

View answer
how to select elements from do-loop for some condition?
1 votes

Try this: list = {};(*empty list*) Do[AppendTo[list, Det[Table[(-0.15 + 0.001*x)^(i + j), {i, 1, 9}, {j, 1, 9}]]], {x, 1,10}] Select[list, # > 0 &] (*{6.89637*10^-201, 6.10433*10^-201, 2.15982*...

View answer
Simple DO structure command
Accepted answer
1 votes

Try this: t = {}; Do[f[z_] := Sin[z]; Sol1 = {z, z f[z]}; AppendTo[t, Re[Sol1]];, {z, -4, 4, 3/4}, {p, {10}}]; PrependTo[t, #] &@{"z", "z f[z]"} // Grid[#, Alignment -> {&...

View answer
Rasterize drops anti-aliasing/changes axes thickness
1 votes

Try: Export["rotation-debug2.gif", Rasterize[img, RasterSize -> 700, ImageResolution -> 1000]]

View answer
multi-dimensional interpolating function evaluation and extract dimension
1 votes

You can use a Table: With[{x0 = {1, 3, 6}, t0 = 0,tfin = 5}, solx[s_] = Table[NDSolveValue[{x'[t] == -x[t], x[0] == x0[[i]]}, x[s], {t, t0, tfin}], {i, 1, Length[x0]}]; Plot[Evaluate[solx[t]], {t, 0,...

View answer
Trying to define the Lie bracket of two vector fields
1 votes

Try with the following code: LieBracket[field1_?VectorQ, field2_?VectorQ, vars_?VectorQ] := Module[{jac, lieb}, jac[field_?VectorQ, vars1_?VectorQ] := D[field, {vars}]; lieb = jac[field2, vars]....

View answer
Periodical sum of rows by a certain step
1 votes

Try with the following code: RowsSum[nmax_Integer?Positive, length_Integer?Positive, vector_List] := Module[ {matrix, matrixrows, s}, matrix = Table[i, {i, nmax}, {length}]; matrixrows[...

View answer
DSolve not evaluating initial condition
1 votes

According to the documentation: (*Recover a function from its gradient vector*) sol = DSolve[{D[x[u, v], u] == Cos[u - v] Cos[u - v], D[x[u, v], v] == Sin[u - v] D[Cos[u - v], v]}, x, {u, v}][[1]]...

View answer
find a jacobian for an ODE on Mathematica
1 votes

Your system: f1[y1_[t_],y2_[t_]]=4*y2[t]+y1[t]; f2[y1_[t_],y2_[t_]]=y2[t]*y1[t]+y1[t]-y2[t]; F[{y1_[t_],y2_[t_]}]:=Evaluate[{f1[y1[t],y2[t]],f2[y1[t],y2[t]]}]; X={y1[t],y2[t]}; Equilibrium points: ...

View answer
Linearization of a nonlinear system
1 votes

Your nonlinear system is a good example for showing Hopf and Bogdanov-Takens bifurcations. With the following changes A=A0+y0;B=A0*y0; we obtain the equilibria: (*{{x -> 1/A0, y -> A0}, {x ->...

View answer
How to get a result in a form without complex numbers?
1 votes

Try the following trick: realPartRule = Complex[re_, im_] :> Complex[re, 0]; realPart[exp__] := exp /. realPartRule; Applying this trick to your result we obtain: realPart[Integrate[Exp[a*(x^3)], {...

View answer
How do I enter a system of differential equations in the Manipulate command?
1 votes

Use the following code: Manipulate[sol = NDSolve[{x'[t] == x[t] (1 - x[t]/7) - (6 x[t]*y[t])/(7 (1 + x[t])), y'[t] == 1/5 y[t] (1 - n y[t]/x[t]), x[0] == 1, y[0] == 1}, {x, y}, {t, 0, 200}]; Grid[{{...

View answer
Plotting level curves for 2-variable exponential equation (Lotka-Volterra) - how?
1 votes

Try with the package CurvesGraphics6 (for more details see Gianluca Gorni): The function $V(x,y)$: V[x_, y_] := Exp[d x + b y]/(x^c y^a) /. {a -> 18/10, b -> 9/10, c -> 81/100, d -> 54/100}...

View answer
Fourier and Table to evaluate coefficients
1 votes

Try this: f[t_] := fp(t);(*Cos[t]^2*) n = 26; tm = N[Range[n - 1]]/n; fm = Map[f, tm]; coefs = FourierDST[fm, 1]/Sqrt[n/2] coefc = FourierDCT[fm, 1]/Sqrt[n/2]

View answer
How to determine the frequency of oscillations in system of three ODEs?
1 votes

Contributing to Chris's analysis: Taking $q=\displaystyle\frac{33}{4}$, $r=\displaystyle\frac{1}{90}$, $\alpha_{1}=\displaystyle\frac{64}{33}$, $\alpha_{1}=\displaystyle\frac{1}{22}$, $\beta_{1}=24$, $...

View answer
Rearrange the parts of formula expression
0 votes

Try this: Collect[D[k[θ[t]]*θ[t] - θ'[t], t] == 0, {D[θ[t], t], D[θ[t], {t, 2}]}]

View answer
Simplifying an equation by factoring the current coefficients in order to substitute a new coefficients
0 votes

Try this: With[{a = e d, b = f d,c = g d}, eq = a*x + b*y + c*z == d; Map[PolynomialQuotient[#, eq[[2]], x] &, eq]] (*e x + f y + g z == 1*)

View answer
Plotting several functions, each one with different properties using Table
0 votes

Try this: Table[Plot[Sqrt[2/Pi] Sin[(n Pi x)/Pi], {x, 0, Pi}, AxesLabel -> {"x", "\[CapitalPhi]"}, PlotLegends -> {"n = 1", "n = 2", "n = 3", &...

View answer
How to handle excluded values in a summation or product in Mathematica
0 votes

Your finite sum exists using a conditional (If): Simplify[Sum[If[i === j, 0, (a - Subscript[a, i])/(Subscript[a, i] - Subscript[a, j])], {i, 0, n}, {j, 0, n}]] (*-(1/2) (1 + n)^2*)

View answer
How to work symbolically with a compiled function?
0 votes

Another option: fcompiled = Quiet[Compile[{x}, 1 + Cos[x], CompilationTarget -> "C"]] f[x_?NumericQ] := If[x \[Element] Reals, fcompiled[x], HoldForm[f[x]]] Tests: (* Test 1: *) f[I] (*...

View answer
Symbolic nest expressions
0 votes

Try this: Q[function_,variable_,n_? Positive]/;Element[n,Integers]:=Nest[D[#,variable]&,function[variable],n] Example: Q[f,s0,1] Q[f,s0,2] (*f'[s0]*) (*f''[s0]*)

View answer
How to get rid of {{ }} from scalars?
0 votes

You can define the product of two matrices as follows: 〈matrix1_, matrix2_〉 := If[Dimensions[matrix1] == {1, 2} && Dimensions[matrix2] == {2, 1}, Inner[Times, Flatten@matrix1, Flatten@matrix2,...

View answer
1
2