CAS Equations Internal Representation For Python
|
11-03-2022, 02:42 PM
(This post was last modified: 11-04-2022 10:37 AM by Ioncubekh.)
Post: #1
|
|||
|
|||
CAS Equations Internal Representation For Python
I wanted full symbolic equations to be transported from stack to python code so that it can calculate & work with those; however, I found that symbolic expressions have to be modified before being used by python math() library
For instance this code retrieves CAS symbolic equations from a user list & display what it contains internally Code: EXPORT strpy() Check CAS settings Observations for python compatibility & manipulations: ~ CAS changes equations to some approximation? See screenshot ~ If you have alphabets in list [] CAS returns a list encapsulated in {}; if only numbers in list CAS returns [] ~ { & } are to be replaced by [ & ] for python list conversions ~ remove extra space after ever , ~ math operator like LN, SIN, ATAN... are to be made lower case ~ raised to power ^ to be replaced with ** ~ there is no LN() in python math() replace it with log() ~ HP's alog10, log10 are converted to e^ & LN notations. Weird, though python has log10 ~ sqrt sign √ will certainly be a challenge for python to understand, don't use it ~ Last example very important the minus sign. Hp provides a separate - sign for prefixing negative numerals perhaps it will not play well with python in the result? HP Prime G1 Python via Android Termux... |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)