Monday, June 8, 2026
HomeLanguagesPython – Sympy Curve.translate() method

Python – Sympy Curve.translate() method

In Sympy, the function Curve.translate() is used translate the given curve by the given values of x, y. It translates the curve along with both the directions i.e. along x-axis and y-axis.

Syntax: Curve.translate(x, y)

Parameters:
x: translation value along x-axis
y: translation value along y-axis

Returns: Translated Curve

Example #1:




# import Curve, parameter and interpolate
from sympy.geometry.curve import Curve
from sympy.abc import t
from sympy import interpolate
  
# using interpolate() and Curve()
C1 = Curve((t, interpolate([1, 4, 9, 16], t)), (t, 0, 1));
print(C1)
  
# using translate()
C2 = C1.translate(2, 3)
print(C2)


Output:

Curve((t, t**2), (t, 0, 1))  
Curve((t + 2, t**2 + 3), (t, 0, 1))

Example #2:




# import Curve and parameter
from sympy.geometry.curve import Curve
from sympy.abc import x
  
# using Curve()
C1 = Curve((x, x), (x, 0, 1));
print(C1)
  
# using translate()
C2 = C1.translate(1, 2)
print(C2)


Output:

Curve((x, x), (x, 0, 1))  
Curve((x + 1, x + 2), (x, 0, 1))
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6895 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7018 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS