This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / polynomial / polyutils / mapdomain

function

numpy.polynomial.polyutils:mapdomain

source: build-install/usr/lib/python3.14/site-packages/numpy/polynomial/polyutils.py :288

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_like

Points to be mapped. If x is a subtype of ndarray the subtype will be preserved.

old, new : array_like

The two domains that determine the map. Each must (successfully) convert to 1-d arrays containing precisely two values.

Returns

x_out : ndarray

Array 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)
Also works for complex numbers (and thus can be used to map any line in the complex plane to any other line therein).
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