Python | sympy.lcm() method
The function
lcm() provides the direct way to compute Least Common Multiple for polynomials.That is, for polynomials f and g, it computes LCM.
Syntax: sympy.lcm(f, g) Return: LCM of given polynomials
Example #1:
# import sympy from sympy import * f = x * y**2 + x**2 * y g = x**2 * y**2 # Using sympy.lcm() method gfg = lcm(f, g) print(gfg) |
chevron_right
filter_none
Output:
x**3*y**2 + x**2*y**3
Example #2:
# import sympy from sympy import * f = x * y / 2 + y**2g = 3 * x + 6 * y # Using sympy.lcm() method gfg = lcm(f, g) print(gfg) |
chevron_right
filter_none
Output:
x*y + 2*y**2
Recommended Posts:
- class method vs static method in Python
- Python | next() method
- Python | set() method
- Python | os.dup() method
- Python | sympy.Pow() method
- Python | os.WIFCONTINUED() method
- Python PIL | blend() method
- Python | Decimal max() method
- Python Dictionary | pop() method
- Python PIL | Image.new() method
- Python | range() method
- Python | os.sysconf() method
- Python | Tensorflow exp() method
- Python | os.confstr() method
- Python | os.fchmod() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


