Python | sympy.lucas() method Last Updated : 26 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report With the help of sympy.lucas() method, we can find Lucas numbers in SymPy. lucas(n) - Lucas numbers satisfy a recurrence relation similar to that of the Fibonacci sequence, in which each term is the sum of the preceding two. They are generated by choosing the initial values L_0 = 2 and L_1 = 1 and the recurrence relation L_n = L_{n-1} + L_{n-2}. Syntax: lucas(n) Parameter: n - It denotes the number upto which lucus number is to be calculated. Returns: Returns the nth lucas number. Example #1: Python3 # import sympy from sympy import * n = 7 print("Value of n = {}".format(n)) # Use sympy.lucas() method nth_lucas = lucas(n) print("Value of nth lucas number : {}".format(nth_lucas)) Output: Value of n = 7 Value of nth lucas number : 29 Example #2: Python3 # import sympy from sympy import * n = 10 print("Value of n = {}".format(n)) # Use sympy.lucas() method n_lucas = [lucas(x) for x in range(11)] print("N lucas number are : {}".format(n_lucas)) Output: Value of n = 10 N lucas number are : [2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123] Comment More infoAdvertise with us Next Article Python | sympy.lcm() method R rupesh_rao Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | sympy.lcm() method With the help of sympy.lcm() method, we can find the least common multiple of two numbers that is passed as a parameter in the sympy.lcm() method. Syntax : sympy.lcm(var1, var2) Return : Return value of least common multiple. Example #1 : In this example we can see that by using sympy.lcm() method, 1 min read 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: Python3 1== # import sympy from sympy import * f = x * y**2 + x**2 * y g = x**2 * y**2 # 1 min read Python | sympy.ilcm() method With the help of sympy.ilcm() method, we can find the least common multiple of two nonnegative integers that is passed as a parameter in the sympy.ilcm() method. Syntax : sympy.ilcm(var1, var2) Return : Return value of least common multiple of two nonnegative integers. Example #1 : In this example w 1 min read Python | sympy.Lambda() method With the help of sympy.Lambda() method, we can perform any mathematical operation by just defining the formula and then pass the parameters with reference variable by using sympy.Lambda(). Syntax : sympy.Lambda() Return : Return the result of mathematical formula. Example #1 : In this example we can 1 min read Python | sympy.euler() method With the help of sympy.euler() method, we can find the Euler number and Euler polynomial in SymPy. euler(n) - Syntax: euler(n) Parameter: n - It denotes the nth Euler number. Returns: Returns the nth Euler number. Example #1: Python3 # import sympy from sympy import * n = 4 print("Value of n = 2 min read Python | sympy.lambdify() method With the help of sympy.lambdify() method, we can convert a SymPy expression to an expression that can be numerically evaluated. lambdify acts like a lambda function, except it, converts the SymPy names to the names of the given numerical library, usually NumPy or math. Syntax: lambdify(variable, exp 2 min read Like