Ricky Teachey writes:

 > I'll try to speak to [what would engineers use a matrix library
 > for] below.

I don't get it.  Among other things, the object uwt_per_ft isn't
defined.  I think it's a typo for the one-dimensional array
γ_per_foot, but not sure.  I don't see any advantage to numpy or a
matrix library in this code, unless you're desperate for speed (see my
last version where z is a Python list).

 > This operation:
 > 
 > q_s = γ_prime * z
 > 
 > And these operations:
 > 
 > P_n_per_foot = μ_s * q_s * C_shaft
 > P_n = np.sum(P_n_per_foot)

Are you saying that the operations above would be clearer in a
four-function calculator version of a matrix library?  I don't see how
the above is less clear than

    q_s = γ_prime * z
    P_n_per_foot = μ_s * q_s * C_shaft
    P_n = math.fsum(P_n_per_foot)

or either is more clear than

    z = list(range(1, 21))
    q_s = [γ_prime * x for x in z]
    P_n_per_foot = [μ_s * x * C_shaft for x in q_s]
    P_n = math.fsum(P_n_per_foot)

although they might be faster for large enough values of "20".

 > That being said, I do think it would be nice to have a "matrix"
 > type in the std lib that supported both element-wise operations
 > like this and basic matrix arithmetic.

If the answer to the question above is "no", then nice for what?  If
"yes", do you think the stdlib 'matrix' module should have a
'linspace' class/function?  Or that

    z = matrix.Matrix(columns=1, data=range(1, 21))

is in general an adequate substitute?
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/IRO4VNCOPHMWAK3A53IACL2FW4LTULMC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to