Skip to contents

HomotopyProblem(sys, op) builds a continuation problem from a system whose equations contain homotopy() nodes: the residual is f(u, p, lambda) with every node replaced by (1 - lambda) * simplified + lambda * actual. solve(prob, HomotopySweep()) solves it at lambdaspan[1] and follows the solution to lambdaspan[2], predicting each step by secant extrapolation and correcting with a nonlinear solver; a failed step halves the increment. AbstractNonlinearProblem(sys, op) returns a HomotopyProblem when the system contains homotopy nodes and a NonlinearProblem() otherwise.

Usage

HomotopyProblem(
  sys,
  op = list(),
  lambdaspan = c(0, 1),
  ...,
  guesses = list(),
  missing_guess_value = NULL
)

AbstractNonlinearProblem(sys, op = list(), ...)

HomotopySweep(
  inner = NULL,
  initial_step_factor = 0.1,
  min_dlambda = sqrt(.Machine$double.eps),
  max_step_factor = 1,
  expand_factor = 2,
  expand_threshold = 2L,
  maxsteps = 10000L
)

Arguments

sys

A complete System.

op

Operating point: values of unknowns and parameters.

lambdaspan

The range of the continuation parameter.

...

Solver options stored with the problem.

guesses, missing_guess_value

As in NonlinearProblem().

inner

The nonlinear algorithm used at each step.

initial_step_factor

First increment as a fraction of the span.

min_dlambda

Smallest increment before giving up.

max_step_factor

Largest increment as a fraction of the span.

expand_factor, expand_threshold

Growth of the increment after expand_threshold accepted steps in a row.

maxsteps

Maximum number of steps.

Value

A HomotopyProblem, or the algorithm object.

Examples

y <- Variable("y")
sys <- complete(System(list(0 ~ homotopy(atan(y - 3), y)), name = "h"))
prob <- HomotopyProblem(sys, list(y ~ 12))
sol <- solve(prob, HomotopySweep())
sol$u; sol$retcode
#> y 
#> 3 
#> [1] "Success"
class(AbstractNonlinearProblem(sys, list(y ~ 12)))[1]
#> [1] "HomotopyProblem"