Bach.eval: Way to get the numerator and the denominator (like Numden in Mathlab)

Discussions, advice, bug reports and much more about the "bach" environment.
Post Reply
sydy
Posts: 63
Joined: Tue Mar 21, 2017 1:34 pm

Bach.eval: Way to get the numerator and the denominator (like Numden in Mathlab)

Post by sydy » Thu Feb 27, 2020 9:15 am

Hy,
I'm looking for a way in bach.eval to find the numerator and denominator of a symbolic number.
Eg. I have the rational 4/5
I want to have as separate information the numerator n and the denominator d.
n =
4

d =
5

Thanks for your help.

M.

sydy
Posts: 63
Joined: Tue Mar 21, 2017 1:34 pm

Re: Bach.eval: Way to get the numerator and the denominator (like Numden in Mathlab)

Post by sydy » Thu Feb 27, 2020 11:31 am

Well here's a dirty way I just found using regexp. Still would be happy about a more elegant solution.

<pre><code>
----------begin_max5_patcher----------
742.3ocyVssSiCCD84zuBqn9PqTHquk3DVsR7ePWUkj5ELp3D43T5JD+66D6
1PoTffnqDRso0yEOdNybFmGmDDVVuU1FhtDcMJH3wIAANQ8BB1sNH79hsUqK
ZclEpkOTWdWXjWkUt05DWVTca7ClhFDYuNc28J8Zo04GYmP0Jm4vVbgfcfk0
c1iM0Kx92Fo+7EFh98NUME1paU5aVZjUVuVdBKlkQYbNOiyn4TJOBQ3IwDt.
mjlQxv3LNkEgD7XbDhRiwC6WawF4pkvgB1tkEVqQU1Y83Rv.NDDtQZZU0Z33
VJM8JyvDL1o7oIS1+7oIQmArrpd859j6TfI6DfI8bBlTVODQxHw4DhHkjmmS
XXJOGPO52bzyHuQtsA8CzUscksVkENKnEgvmQ2XRNMVl7lXYzQe+nFU.S4BF
giEjzjDnmjPRi66SyREhTAiwxy.grC5TOysWMFk1NV.I4MXp3OpChhyiyRn4
LQNKUjQyXhHTJ46RGDDDasdznv.EqovTbuzJMKk5hx0xCwhQR+JKz2LBJHG6
vJ99mm89.4lh0nolBXzsUU2h9E5O0FzTERoQDTbbLhjh1MKBMyqT+rxopKHC
putWE35uQyQKV7SXU8J4K2xChzdulptbFAQlCLV+eodue1IK.My7a17A2Vo5
wJ.WmQVrHBrbN5pAYsvw6J3WzPK9ZkVVU2ocoNcrUb7o66ou6ff2k7yeM2OU
DmBxRywYhTLVfApeB2U9YIGPRp..vcz9OTt9JEqOSoxWnB+bzdIP2WcPIZ7C
BbXmq1ez633JM8xeIsostyTsuXt+ZUzyk.HsrJcOjnOvn9win2hZN5HQFQjD
mkHwFSj5SbxWLRIiB8vuvnZyJeIE+0BM1e9e+jjbFfyQkjG0GMjjjW0rVzzr
q61E29nBSyuq12lG4Vpz9kN9.7BOaT6s2Kov.ycr.opy3mXrMkG5cEXlFcmZ
Wrg7EBo6lBMbiVaSgO0bWnL4oI+C0vZ5EB
-----------end_max5_patcher-----------
</code></pre>

Post Reply