Post Reply 
Some of Python's linalg commands in HP Prime
11-02-2022, 02:20 AM
Post: #12
RE: Some of Python's linalg commands in HP Prime
In the absence of multi-dimensional arrays (numpy) following commands using native zip(), map(), lambda, list constructions ...can be used to have similar effect while considering dimensions as well.
Few array examples & their equivalents

Code:

# x + b21 * k1 + b32 * k2
# where x, k1 & k2 are numpy arrays while b21 & b32 is some scalar value
[sum(i) for i in zip(x, [b21*i for i in k1], [b32*i for i in k2] )]
# r  / ( q*( abs(x)+abs(k1) ) )
# where r, x & k1 are equal shaped arrays & q is scalar value
[ (r[i] / ( q*( abs(x[i]) + abs(k1[i]) ) ) ) for i in range(len(x) ) ]

HP Prime G1
Python via Android Termux...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Some of Python's linalg commands in HP Prime - Ioncubekh - 11-02-2022 02:20 AM



User(s) browsing this thread: 1 Guest(s)