I would like to create a spreadsheet that will generate "random" 2X2 systems of linear equations, but ones in which the solution (x,y) is an ordered pair of integers.
I'm starting from Cramer's Rule, that for equations
ax + by = c and
dx + ey = f
the solution is x = (ce-bf)/(ae-bd) and y = (af-cd)/(ae-bd).
I've made the following observations:
1) ae-bd must not be 0.
2) ce-bf and af-cd must both be multiples of ae-bd if x and y are to be integers.
In order to create a system of equations, I'll have to assign numbers for a, b, c, d, e, and f that will "show up" on the printed problem, and assign x and y that will not "show up."
It seems to me that some of these variables can be assigned "randomly," wheras others will necessarily depend on what's already been assigned.
What strategy would you use to assign these 8 numbers?
A strategy for creating random systems of equations?
I would
1) randomly choose x and y
2) randomly choose a, b, d, e satisfying your condition
ae ≠ bd
Otherwise choose them again until they satisfy the condition.
You didn't say so, but I believe you want a, b, d,, e to be integers as well right.
c and f will calculate themselves.
Reply:(Ω) Dr D has given the straightfoward answer, but what intrigues me about this question is the use of the word "random". This can be fraught with complications whenever one attempts to "choose an element at random from a set that includes infinity". If you're hoping to do a Monte Carlo simulation, careless choice of "randomization" could lead to bad statistical biases. For example, do you want the graphed lines to have uniformly random orientation? If you were to stand at the origin (0,0) and look out, you will see that the lattice points are not anisotropic (for small coefficients), so that you'd have to take extra care to ensure uniform random orientation of the lines. This problem is compounded by the fact you want the coefficients to be integers. Because I don't know what is your ultimate purpose of having such "randomly generated integer 2x2 systems of linear equations", I'm not sure which way I should go with this.
Oh, okay, well then in that case, (Ω) Dr D's proposal seems like an easy way to do it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment