Skip to content

Sequences

algorythmTTV edited this page Apr 3, 2024 · 1 revision

Wiki Sequences

Classes

Sequence

Represents a mathematical sequence.

Attributes

  • initial_term (int): The initial term of the sequence.
  • expression (str): The expression used to generate the terms of the sequence (Un+1, example: 2*Un).
  • type (int, optional): The type of the sequence. Defaults to 0.

Methods

Name Description Arguments Returns
isArithmetic Checks if the sequence is arithmetic. None If false: bool, If true: tuple: (True, difference)
isGeometric Checks if the sequence is geometric. None If false: bool, If true: tuple: (True, ratio)
sequence Returns the values of the n first terms of the sequence. n (int): Numbers of terms. list[int]: The custom sequence as a list of integers.
variation Calculates the variation of the sequence. n (int, optional): Defaults to 0. str: The variation of the sequence.
artithmeticSequence Generates an arithmetic sequence starting from the initial term of the sequence. n (int), k (int) list[int]: The arithmetic sequence generated.
geometricSequence Generates a geometric sequence starting from the initial term of the sequence. n (int), k (int) list[int]: A list containing the generated terms of the geometric sequence.
term Returns the nth term of the sequence. n (int): The position of the term in the sequence. The nth term of the sequence.
arithmeticSum Returns the sum of the terms of an arithmetic sequence from p to n. p (int), n (int) float: The sum of the sequence.
geometricSum Returns the sum of the terms of a geometric sequence from p to n. p (int), n (int) float: The sum of the sequence.
infLimit Returns the limit of the sequence when n tends to infinity (for now, only do smth with arithmetic and geometric). None The limit of the sequence (if it exists, else None).
Clone this wiki locally