FindMinimum::cvmit FindMaximum::cvmit FindFit::cvmit FindRoot::cvmit
Details
-
- This message is generated when the indicated limit on the number of iterations is reached before finding a region that contains the requested result.
- This error can occur if the objective function does not have the required minimum, maximum, or root.
- This error can often be corrected by choosing better starting values.
- Good starting values can often be chosen by evaluating the function at selected points, or by looking at a plot of the function.
- This error can also occur if the nonlinearity of the partial differential equation model is too strong. Then the error can be corrected by solving the PDE in steps.
- Off[message] switches off the message; On[message] switches it on. For example: Off[FindMinimum::cvmit].
Examples
Basic Examples (4)
The starting value is not near the local minimum of this function:
FindMinimum[1 / x - 2Exp[-x], {x, 5}]A minimum is computed without difficulty if the starting value is closer to the solution:
FindMinimum[1 / x - 2Exp[-x], {x, 1}]A plot of the function shows the location of the minimum:
Plot[1 / x - 2Exp[-x], {x, 1, 5}]The first argument in FindRoot does not have a real root:
FindRoot[x ^ 2 + x + 1, {x, 4, 10}]A complex root of this equation can be computed by giving complex starting values:
FindRoot[x ^ 2 + x + 1, {x, 0, I}]FindRoot[x ^ 2 + x + 1, {x, 0, -I}]The first argument in FindMinimum does not have a minimum:
FindMinimum[x, {x, 1}]Highly nonlinear partial differential equations may fail to solve when the nonlinearity is too strong. Consider this hyperelastic example from solid mechanics, where a rectangular region is held fixed on the left and the material is pulled on the right. Set up the model:
Ω = Rectangle[{0, 0}, {2, 1}];vars = {{u[x, y], v[x, y]}, {x, y}};
pars = <|"SolidMechanicsMaterialModel" -> "NeoHookean", "ShearModulus" -> 0.3 10^6, "ModelForm" -> "PlaneStress", "Thickness" -> 0.01|>;model[f_] := {SolidMechanicsPDEComponent[vars, pars] == SolidBoundaryLoadValue[x == 2, vars, pars, <|"Force" -> {Quantity[f, "Newtons"], 0}|>], SolidFixedCondition[x == 0, vars, pars]};Solve the model for a specific force of
:
displacement = NDSolveValue[
model[20 10^3], {u[x, y], v[x, y]}, {x, y}∈Ω];VectorDisplacementPlot[displacement, {x, y}∈Ω, VectorSizes -> Full, PlotLabel -> ("Force = 20kN")]Solve the model for a higher force of
:
force = 40 10^3;
displacement = NDSolveValue[
model[force], {u[x, y], v[x, y]}, {x, y}∈Ω];The model fails to solve because the nonlinearity has become too strong. Not all hope is lost, however. If this happens, a solver restart may help. The idea is to slowly increase the load and use the solution from the last step as a starting point for the next step until the maximum force has been applied.
A parametric function is created with a load parameter
that will control the amount of force applied:
pfun = ParametricNDSolveValue[
model[force * p], {u[x, y], v[x, y]}, {x, y}∈Ω, p]Next, set up an iteration with an initial displacement of 0 and where you want to get to the full force in 10 steps:
nsteps = 10;
pMax = 1;
displacement = {0, 0};When you run the parametric function with a specific parameter
, you get a displacement for that force. This displacement is used as an initial seed for the next-higher value of
until you reach the full force:
Monitor[Do[
pNew = step * 1 / nsteps;
displacement = pfun[pNew,
"InitialSeeding" -> {u[x, y] == displacement[[1]], v[x, y] == displacement[[2]]}];
, {step, 1, nsteps, 1}],
step];VectorDisplacementPlot[displacement, {x, y}∈Ω, VectorSizes -> Full, PlotLabel -> ("Force = 40kN")]