Tag Info

Hot answers tagged

5

With[{maxR = 10}, Manipulate[ expr = Sqrt[R^2 - zeta^2] - zeta Tan[zeta]; zero = zeta /. NSolve[{expr == 0, R^2 - zeta^2 >= 0}, zeta] // Quiet; Column[{ Plot[expr, {zeta, -maxR, maxR}, Exclusions -> {Cos[zeta] == 0}, PlotRange -> {{-maxR, maxR}, {-25, 40}}, Epilog -> {Red, AbsolutePointSize[4], Point[{#, 0} ...


5

It turns out that Reduce finds candidate solutions relatively quickly and spends the vast majority of time proving correctness and completeness of the result. NSolve didn't have its own code for handling such problems, and was ending up using the same code as Reduce, finding symbolic solutions, and then numericizing them. I have implemented an NSolve version ...


5

You can get very close to the solution in three iterations of Newton's method: f[x_, a_] := x/Sin[Pi/2 x]^a fInvNewton[y_?NumericQ, a_?NumericQ, iter_: 3] := Nest[# - (f[#, a] - y)/Derivative[1, 0][f][#, a] &, If[y > 2/Pi, y, ((Pi/2)^a y)^(1/(1 - a))], iter] Example: Plot[Evaluate@{fInvNewton[y, 0.5, 3], InverseFunction[f, 1, 2][y, 0.5]}, ...


4

If all you're interested in is the inverse power series, then don't calculate the InverseFunction; instead, use the InverseSeries function: fseries[α_] := Series[x (1/Sin[Pi x/2])^α, {x, 0, 5}] Table[InverseSeries[fseries[α], y], {α, -1, 1, 1/2}] Note that $\alpha$ has to be a rational number for this to work. In particular, if you replace the 1/2 ...


3

In such cases I prefer to get an idea from numerical solution. f[x_] = 202. (2.51521 + 1/(-1 + E^(202. x))) + 802. (2.52457 + 1/(-1 + E^(802. x))) + 1802. (2.52632 + 1/(-1 + E^(1802. x))) + 3202. (2.52694 + 1/(-1 + E^(3202. x))) + 5002. (2.52722 + 1/(-1 + E^(5002. x))); data = Table[{a, x /. FindRoot[f[x] == a, {x, -0.001}]}, {a, -100, 100, 10}]; ...


3

First our definitions: f[x_, y_] := Max[2 - (y - 1)^2, x + 1 - (y - 2)^2] Γ = Interval[{0, 4}] The definition of $G(x)$ is (adjusting the notation slightly): $$ \{y\in\Gamma:\forall_{z\in\Gamma}f(x,y)\geq f(x,z)\} $$ In English, this is The set of $y$ (in $\Gamma$) for which $f(x,y)$ is no less than $f(x,z)$ for any $z$ in $\Gamma$. We can make ...


2

As commented, Nest or Fold might be applicable here, but there's a neat and underused function called ComposeList that does this elegantly. Here's an example of a function that takes the list of functions, the starting argument, and number of times to apply them in sequence, resulting in a list of results: f[x_] := x^2 g[x_] := 2*x fns = {f, g} ...


2

For example, this is reasonably fast on the following example: eqn = Sin[x] + 0.5 Cos[10 Pi x]; sols = FindRoot[eqn, {x, #}] & /@ Module[{n = 0}, Reap[ NDSolve[{y'[x] == D[eqn, x], y[0] == (eqn /. x -> 0), WhenEvent[y[x] == 0, Sow[x]; If[++n >= 50, "StopIntegration"]]}, {}, {x, 0, Infinity}] ][[2, 1]] ] (* {{x -> ...


2

Perhaps eq1 = 1/s^3 + 3 s^2 + 4 s + 1 == 0; eq2 = Simplify[s^3 # & /@ eq1] 1 + s^3 + 4 s^4 + 3 s^5 == 0 which demonstrates that the equation is indeed of the 5th order. Solve[eq2, s] // N {{s -> -1.21261}, {s -> -0.506962 - 0.665378 I}, {s -> -0.506962 + 0.665378 I}, {s -> 0.446601 - 0.439765 I}, {s -> 0.446601 + 0.439765 I}} ...


2

First I'll store the equations to a variable: eqns = {(x - x1)^2 + (y - y1)^2 == r1^2, (x - x2)^2 + (y - y2)^2 == r2^2} Note that I've switched to lowercase variable names; this is generally good practice to avoid conflicts with Mathematica's builtin identifiers, which are always uppercase. Without loss of generality we can assume that the first circle ...


1

If the goal is only to obtain the sum of positive roots, then f[r_] := Total[ζ /. NSolve[{Sqrt[r^2 - ζ^2] - ζ Tan[ζ] == 0, r^2 - ζ^2 >= 0, ζ > 0}, ζ]] produces this quantity. For instance, Plot[f[r], {r, .1, 10}, AxesLabel -> {R, Total}] Quiet is used only to suppress the occasional information message, Solve::ratnz: Solve was ...


1

If you just want the $x$ values: x/. {{x -> 0., y -> 4.}, {x -> 1., y -> 1.}, {x -> 1.5, y -> 0.}, {x -> 0., y -> 0.}} (0., 1., 1.5, 0} and likewise for the $y$ values, which of course can be named, or: mySols = {x, y} /. {{x -> 0., y -> 4.}, {x -> 1., y -> 1.}, {x -> 1.5, y -> 0.}, {x -> 0., y -> 0.}} ...


1

It appears that Mathematica does automatic simplification in some cases which can change the domain of a function. In your case Simplify[eqs] Gives {1/(2-x)+2/y==0, x y (1/(1-3 x)+1/(2 y+1))==0}, putting x=0 in the domain. A similar thing happens with expressions like Simplify[(x^2-36)/(x+6)]



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