lundi 11 octobre 2021

Create random systems of linear equations - Python

Edit: more details

Hello I found this problem through one of my teachers but I still don't understand how to approach to it, and I would like to know if anyone had any ideas for it:

Create a program capable of generating systems of equations (randomly) that contain between 2 and 8 variables. The program will ask the user for a number of variables in the system of equations using the input function. The range of the coefficients must be between [-10,10], however, no coefficient should be 0. Both the coefficients and the solutions must be integers.

The goal is to print the system and show the solution to the variables (x,y,z,...). NumPy is allowed.

As far as I understand it should work this way:

Enter the number of variables: 2

x + y = 7 
4x - y =3

x = 2
y = 5

I'm still learning arrays in python, but do they work the same as in matlab?

Thank you in advance :)!




Aucun commentaire:

Enregistrer un commentaire