Linear Equations and Functions

Add a section about creation of the discord bot.

Add a section about the algorithms used to solve simple linear functions.

When a user inputs an equation into the Discord textbox, the formatting becomes crucial as it determines how the math bot can interpret and solve the equation. Solving a linear equation without fractions or parentheses is relatively straightforward – it involves splitting the string into plus, minus, or equal signs, creating two arrays (left and right sides), or just a left-side array if no equal sign is present. The process becomes simple: move the right variable to the left side by multiplying it by negative one, placing the correct coefficient, constant into the appropriate new array. The solution involves factoring (if applicable) and presenting the steps to the user.

However, a challenge arises when users input two-tiered equations, as illustrated below:

\[\frac{(6x-18)}{(3x+2x-8)}*\frac{(12x-16)}{(4x-12)}\]

The first step is to split the equation by the division sign, creating three distinct segments:

\[(6x-18),(3x+2x-8)*(12x-16),(4x-12)\]

Further splitting these components by left and right parentheses results in:

\[6x-18, 3x+2x-8, 12x-16, 4x-12\]

This enables the computer to store the numerator (top of the division) in one array and the denominator (bottom) in another array. However, the challenges lie in breaking down the denominator into its correct positions. The second element in the array always represents the bottom, the third element is a symbol stored in its array for later solving, and the fourth element is the numerator. Next it is breaking down each of the indexes to be able to solve, the coefficient, exponent, and constant:

Next would be able to detect what will be the operation that will be applied to the now split equation, as I would have to be able to detect the operation, this being division, multiplication, subtraction, addition. Then once that is figured out to then see if the fraction needs to be reduced.

(Zero is not the exponent actually power, it just helps with the writing the equation out)

Since the symbol is multiplication, we will prepare to multiply the top and bottom together:

\[(6x-18)/(3x^2+2x-8)*(12x-16)/(4x-12)→(6x-18)(12x-16)/(3x^2+2x-8)(4x-12)\]

Within the stored coefficient top and the constant numerator array, look for the greatest common factor to reduce the overall top. The same will be done on the denominator , since the denominator has an exponent of 2, we will first reduce it by finding a common factor:

(6x-18)/(3x^2+2x-8)*(12x-16)/(4x-12)→(6x-18)(12x-16)/(3x^2+2x-8)(4x-12)

→ (6(x-3)4(3x-4))/((3x-4)(x+2)4(x-3))

**