0

I have to write an algorithm (using NumPy) that creates:

  1. random system of 4 linear equations with 4 variables and integer coefficients
  2. two column vectors b_1, b_2 with integer numbers such that:

1) The first one makes created system Ax = b_1 inconsistent

2) The second one makes created system Ax = b_2 have infinitely many solutions (preferably with integer numbers, but rational are also possible)

Lev
  • 146
  • 2
  • 12
  • That sounds like a reasonable assignment. What does your code look like, and exactly where are you stuck? – PM 2Ring Sep 23 '18 at 15:00
  • @PM2Ring This is not a homework, actually. I'm preparing some tasks for other students. So, I’ve been thinking about Rouché–Capelli theorem. I could use it for a random (4 x 5) matrix to make sure it is inconsistent and then try to do some magic for b_2. But I also need to make sure that solutions are all integer/rational – Lev Sep 23 '18 at 15:19
  • Ok, but at this stage, it sounds like you have a [mathematics question](https://math.stackexchange.com/questions), not a coding question. Keeping solutions rational is easy, since your equations are linear. Keeping them integers is probably easiest if you work backwards from the solutions to the coefficients. For Ax = b_2 to have an infinite number of solution the system has to be over-determined. Maybe that will also help in constructing b_1... but I haven't thought very deeply about that. ;) – PM 2Ring Sep 23 '18 at 15:30
  • One approach would be to try to create (maybe by hand) a simple set of equations (eg A all but diagonal) that satisfy your constraints, and then seek invertible matrices U and V and use them to transform the system int UAinv(V) Vx = Ub that look more complex. – dmuir Sep 24 '18 at 10:45

0 Answers0