<jupyter_start><jupyter_text>Floating-point operations*(this chapter is not important on first contact with Polynomial Numbers)*`PolyNum` class is ready to use different floating-point format of PN digits. See `PolyNumConf.py`. To have homogeneous type of float calculations, for example `mpf` from mpmath[ 1 ](mpmath10), use the same type for scalars using strings to initialize all scalars and all PNs. Recommended starting precision: mpmath -> mp.prec = 128  (38 dec. significant dig. of float), max_N=64 or 128 (PN significant digits number).1: <NAME> and others. [mpmath](http://mpmath.org/): a Python library for arbitrary-precision floating-point arithmetic (version  1.0.0), 2017. http://mpmath.org/.<jupyter_code>from PNlib import PolyNumConf
PolyNumConf.max_N=80 # PN significant digits number (restart jupyter kernel on change conf.)
PolyNumConf.FLOAT_TYPE = 'FLOAT-MPMATH-MPF'
PolyNumConf.MPMATH_PREC = 150
#PolyNumConf const can be changed efficiently before loading any other PNlib files
%matplotlib inline
from PNlib.digitPN import flt
#example: h = flt('0.1') - Use it for all scalars.
print(repr(flt('0.1')))                 # ...9982')
from PNlib.PolyNum import PolyNum
print(repr(PolyNum().mantissa[0]))<jupyter_output>mpf('0.0')<jupyter_text>Example<jupyter_code># Z-transform live example of homogeneous type of float calculations (to set in PolyNumConf.py)
h = flt('0.01') # sampling period
p = 1/h * PolyNum('const:(~2~,-4~4~-4~4~...~)') #intiger can be mixed with mpf float
E_0 = flt('10')
E = E_0/2 * PolyNum('const:(~1~,2~2~2~2~...~)') # flt('10')/2, but not 10/2
R, L, C = flt('20'), flt('2'), flt('1e-3')
Z_C = 1 / (p*C)
Z = R + p*L + Z_C
U_C = E * Z_C / Z
# plt.plot(E, 'r--',U_C, 'b-') 
import matplotlib.pyplot as plt
plt.plot(E, 'r--',U_C, 'b-')
plt.grid(b=True)
plt.text(0.6,10.4,"$ e(t) $", fontsize=16, color='red')
plt.text(21,12.2,"$ u_C(t) $", fontsize=16, color='blue')
plt.show();
print(repr(U_C.mantissa[0])) #to see float type<jupyter_output>mpf('0.058823529411764705882352941176470588235294117724')
{'fraction_non_alphanumeric': 0.15727584517393434, 'fraction_numerical': 0.06467417932386085, 'mean_word_length': 4.9533527696793005, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '287960', 'license': 'MIT', 'n_tokens_mistral': 849, 'n_tokens_neox': 756, 'n_words': 217, 'path': 'PN.py/03.PN digits type.ipynb', 'repo_name': 'andrzejQ/Polynomial_Numbers.py', 'size': '2052'}