bundles / numpy 2.4.4 / numpy / polynomial / polyutils / mapdomain
function
numpy.polynomial.polyutils:mapdomain
Signature
def mapdomain ( x , old , new ) Summary
Apply linear map to input points.
Extended Summary
The linear map offset + scale*x that maps the domain old to the domain new is applied to the points x.
Parameters
x: array_likePoints to be mapped. If
xis a subtype of ndarray the subtype will be preserved.old, new: array_likeThe two domains that determine the map. Each must (successfully) convert to 1-d arrays containing precisely two values.
Returns
x_out: ndarrayArray of points of the same shape as
x, after application of the linear map between the two domains.
Notes
Effectively, this implements:
where
Examples
import numpy as np from numpy.polynomial import polyutils as pu old_domain = (-1,1) new_domain = (0,2*np.pi) x = np.linspace(-1,1,6); x✓
x_out = pu.mapdomain(x, old_domain, new_domain); x_out
✗x - pu.mapdomain(x_out, new_domain, old_domain)
✓i = complex(0,1) old = (-1 - i, 1 + i) new = (-1 + i, 1 - i) z = np.linspace(old[0], old[1], 6); z✓
new_z = pu.mapdomain(z, old, new); new_z
✗See also
- getdomain
- mapparms
Aliases
-
numpy.polynomial.polyutils.mapdomain