pyoculus.solvers.fixed_point
fixed_point.py
Contains the class for finding fixed points of a map.
- authors:
Zhisong Qu (zhisong.qu@anu.edu.au)
Ludovic Rais (ludovic.rais@epfl.ch)
- class pyoculus.solvers.fixed_point.FixedPoint(map)
Class to find fixed points of a map, i.e. points that satisfy \(f^t(x) = x\).
- find(t: float | int, guess: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = None, nrestart: int = 0, method: str = 'scipy.root', **kwargs)
Tries to find a fixed point of the map applied \(t\) times.
- Parameters:
t – the number of iterations of the map
guess – the initial guess of the fixed point
nrestarts – the maximum number of restart with different random initial conditions
method – the method to use to find the fixed point, default is ‘newton’.
**kwargs – additional arguments for the method
- Returns:
- the output data of the fixed point search
coords: the coordinates of the fixed point
Jacobian: the Jacobian of the fixed point
GreenesResidue: the Greene’s Residue of the fixed point
- Return type:
FixedPoint.OutputData
Notes
There are several methods implemented, newton is a simple Newton’s method implemented in this class. it evaluates the full map. scipy.root uses the scipy root method to find the fixed point without derivative evaluation, it also finds the point using only a half-map forwards and backwards, which should help with convergence to very unstable fixed points scipy.derivs is the same as root, but also uses the calculated derivatives. scipy.1D is a 1D solver that finds the fixed point on a symmetry plane using a 1D bisection method and looking a zero in the difference in Z in the half-maps (defalut solver is brentq, specified by the keyword scipy_method=”..”)
For IntegratedMaps, often best results are obtained with ‘scipy.root’, which does not use derivatives. This is because the derivative evaluation is often more expensive than several map evaluations and most scipy solvers internally construct a jacobian from the evaluations. For s
- find_with_iota(n: int, m: int, guess: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], x_axis: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = None, nrestart: int = 0, method: str = 'scipy.root', **kwargs)
Tries to find the fixed point of a map with winding number \(\iota/2\pi = q^{-1} = n/m\) around x_axis.s
- Parameters:
n (int) – the numerator of the winding number
m (int) – the denominator of the winding number
guess (array) – the initial guess of the fixed point
x_axis (array) – the point around which the winding number is calculated
nrestarts (int) – the maximum number of restart with different random initial conditions
method (str) – the method to use to find the fixed point, default is ‘newton’
**kwargs – additional arguments for the method
- Returns:
- the output data of the fixed point search
coords: the coordinates of the fixed point
Jacobian: the Jacobian of the fixed point
GreenesResidue: the Greene’s Residue of the fixed point
MeanResidue: –
- Return type:
FixedPoint.OutputData
- random_initial_guess(prev_guess=None, max_step=0.5)
Returns a random initial point uniformly sampled from the domain of the map.
If prev_guess is provided and the map is a CylindricalBfieldSection, the sampling region is restricted to prev_guess ± max_step (intersected with the domain).
- Parameters:
prev_guess (np.array) – the previous guess to sample around
max_step (float) – the maximum step size from prev_guess in each dimension
- record_data(x_fp)
Record some additional data about the fixed point, such as the Jacobian, the Greene’s Residue, and the Mean Residue for each iteration of the map.
- Parameters:
x_fp (array) – Fixed point coordinates
is_winding (bool)
- property eigenvalues
Compute the eigenvalues of the Jacobian of the fixed point
- property RZcoords
Return the RZ coordinates of the fixed point, applying a transform if the field is a ToroidalBfield (rho theta)
- property polarcoords
Return the polar coordinates of the fixed point, applying a transform if the field is a ToroidalBfield (rho theta)
- property topological_index
return the topological index of the fixed point
- property rotational_transform
return the rotational transform if the fixed point is Elliptic
- plot(plottype='RZ', plot_all=True, **kwargs)
Plot the fixed point. :param plottype: the type of plot to make, either ‘RZ’ or ‘polar’ or None. if None, the natural coordinats of the map will be plotted. :param plot_all: if True, all the iterates of the fixed point will be plotted, otherwise only the fixed point itself will be plotted. :param **kwargs: additional arguments for the scatter plot, such as color, size, etc.