Proektsoftbg / Calcpad

Free and open source software for mathematical and engineering calculations.
https://calcpad.eu
MIT License
313 stars 38 forks source link

Multiple equations solver #259

Open jgagnonNT opened 4 months ago

jgagnonNT commented 4 months ago

Hello, is there a way to solve a system of multiple equations with multiple unknowns? If not I beleive it would be a great addition to the software.

Proektsoftbg commented 4 months ago

Hi! Yes, it is possible to some extent.

But, if you mean large systems of linear and non-linear equations, they will be implemented in effective and easy-to-use way, after we add vectors and matrices to Calcpad.

For small systems, you can apply the current $root and $find methods subsequentially for each equation. Bellow is an example for solving a system of two nonlinear equations:

"System of two nonlinear equations
f_1(x; y) = x^2 + y^2 - 4'= 0 - equation 1
f_2(x; y) = e^x - y - 1'= 0 - equation 2
a = 0', 'b = 2
c = 1', 'd = 2
'Find "x" from equation 1
x_0(y) = $Find{f_1(x; y) @ x = a : b}
'Find "y" from equation 2
y_0 = $Find{f_2(x_0(y); y) @ y = c : d}
x_0 = x_0(y_0)
'Check the roots
f_1(x_0; y_0)
f_2(x_0; y_0)

image

In a similar way, systems with three, four and five equations can be solved. I believe that for larger systems, this method will become too ineffective.

jgagnonNT commented 4 months ago

Thank you! That is a neat workaround! It requires a bit more of thinking. I am looking forward to the solver for the systems of equation.