Values of Variables Matrix NumPy
Posted
by
Max Mines
on Stack Overflow
See other posts from Stack Overflow
or by Max Mines
Published on 2012-11-14T22:57:26Z
Indexed on
2012/11/14
22:59 UTC
Read the original article
Hit count: 236
I'm working on a program that determines if lines intersect. I'm using matrices to do this. I understand all the math concepts, but I'm new to Python and NumPy.
I want to add my slope variables and yint variables to a new matrix. They are all floats. I can't seem to figure out the correct format for entering them. Here's an example:
import numpy as np
x = 2
y = 5
w = 9
z = 12
I understand that if I were to just be entering the raw numbers, it would look something like this:
matr = np.matrix('2 5; 9 12')
My goal, though, is to enter the variable names instead of the ints.
© Stack Overflow or respective owner