Solving algebra with 2 unknowns

image
Is it possible to solve and get x and y using luau?

m, n, r, and S are all known number constants

1 Like

If you can somehow get your set of equations down to linear equations you can solve them using matrix operations like this page does:

http://www.math.odu.edu/~bogacki/lat/

It’s not an API but it is nice in that it shows each operation done to reach a solution. It helped me with some linear algebra homework in the past :sweat_smile:

1 Like

I’m pretty sure the second equation is impossible to be converted to a linear equation because the terms are squared.

2 Likes

1 Like

Can you provide one set of constants for the two equations? It will make solving and checking equations a lot easier.

just use the equations i posted.

they work perfectly fine.

here you can test

1 Like

I forgot graphing calculators where a thing…

I converted the equations to lua code here:

local x1 = (mS - math.sqrt(n^2(m^2 * r^2 + n^2 * r^2 - S^2)))/(m^2 + n^2)
local y1 = (n^2 * S + m * math.sqrt(n^2 * (m^2 * r^2 + n^2 * r^2 - S^2)))/(m^2 * n + n^3)
local x2 = (mS + math.sqrt(n^2(m^2 * r^2 + n^2 * r^2 - S^2)))/(m^2 + n^2)
local y2 = (n^2 * S - m * math.sqrt(n^2 * (m^2 * r^2 + n^2 * r^2 - S^2)))/(m^2 * n + n^3)

thx dawg that works, thanks to @SevenRingsOfSaturn too