Hot answers tagged

5

The number of polynomials is not so great in your original case: just generate them all programmatically, and test each one for irreducibility using IrreduciblePolynomialQ, which seems faster than actually doing the factorization using Factor: p[x_, y_] = Total[Table[a[i, j] x^(i - 1) y^(j - 1), {i, 1, 3}, {j, 1, 3}], 2]; polynomials = p[x, y] /. Thread[...


4

Try something like x /. Solve[Sum[RandomChoice[{-1, 1}] x^k, {k, 0, 3}] == 0, x, Reals] instead of your Roots expression. Use NSolve if you want the numerical value of the roots, rather than a symbolic representation. For instance: t = Table[x /. NSolve[Sum[RandomChoice[{-1, 1}] x^k, {k, 0, 3}] == 0, x, Reals], 4500]; realroots = DeleteDuplicates@...


4

The error message tells everything: "NMaxValue::nnum: "The function value {-0.31322198} is not a number at {s,t} = {0.6524678079740285,0.04524817776440737}"" NMaxValue[First[f[s, t]], {s, t} ∈ Rectangle[{0, 0}, {1, 1}]]


3

First some references that are somewhat related. In all of them the large degree of the polynomials is a factor, in addition to the large coefficients. In this question, only the large coefficients are relevant. This may be a duplicate Q&A: NSolve for high degree univariate polynomials Related: Funny behaviour when plotting a polynomial of high ...


2

The precision of the numbers in the equation is such that near its roots when you change the input value just slightly, rounding errors turn out to have a significant impact. The same happens in this simpler example with a smooth function: Plot[(Cos[1 + h] - Cos[1])/h, {h, 0, 1/100000000}]. You could use exact numbers and solve the equation just once, and ...


2

In general one should not expect to obtain a general symbolic solution (a function x[a,b]) to the given equation since there are two independent variables, see e.g. Solve symbolically a transcendental trigonometric equation and plot its solutions for certain aspects regarding transcendental equations. To get an idea how the solution depends on parameters a ...


2

Perhaps this! It works if you only need the plot and not the values, or the function. That would require more work. ContourPlot3D[ Evaluate[-x + (Log[f2[x]] - Log[f1[x]] + Log[b] - Log[a])/((1 - a) + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x]))] , {a, 0, 1}, {b, 0, 1}, {x, 0, 1} , AxesLabel -> {"a", "b", "x"} , Contours -> {0} , Mesh -> None ...


2

You can try Solve or NSolve sol = x/.NSolve[(-2 + x)^3 (-2 + x^2) (-4 + x^3) (4 + 2 x^2 + x^4) (-8 - 8 x - 2 x^2 + x^3 + x^4) == 0, x] {-1.41421, -1.34768, -0.940763 - 1.33336 I, -0.940763 + 1.33336 I, -0.793701 - 1.37473 I, -0.793701 + 1.37473 I, -0.707107 - 1.22474 I, -0.707107 + 1.22474 I, 0.707107 - 1.22474 I, 0.707107 + 1.22474 ...


1

To find the exact values for min and max roots roots = DeleteDuplicates@ Flatten[x /. Solve[# == 0, x, Reals] & /@ (Tuples[{-1, 1}, {4}].{1, x, x^2, x^3})] // SortBy[#, N] &; {min, max} = roots[[{1, -1}]] // ToRadicals The approximate numeric values are as shown by @MarcoB {min, max} // N (* {-1.83929, 1.83929} *)


1

When I evaluate Roots[ (-2 + x)^3 (-2 + x^2) (-4 + x^3) (4 + 2 x^2 + x^4) (-8 - 8 x - 2 x^2 + x^3 + x^4) == 0, x] // N I get which seems to me to be a reasonable result. So I would recommend restarting Mathematica and trying again.


1

You can take advantage of the ordering of polynomial roots by Root to find the maximum real root. The first root is always the minimum real root, so change the sign of the variable and the result. maxRealRoot[f_] := -Root[f[-#] &, 1] Now make your polynomial a function: poly[x_] = (-2 + x)^3 (-2 + x^2) (-4 + x^3) (4 + 2 x^2 + x^4) (-8 - 8 x - 2 x^2 +...



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