From: Prof T. R. <Pro...@pr...> - 2024-02-28 20:13:12
|
Hi, thanks for this procedure, works so far. Two questions follow: On 24/2/2024 8:01 pm, Arthur Norman wrote: > symbolic procedure kill v; > if floatp v and v <= 1.0e-6 then 0.0 > else if atom v then v > else kill car v . kill cdr v; 1. Why do I not need "abs(v)<=" I can see in the trace that so far negative values appears to be always stored as (minus positive-number) so abs(v) is apparently not needed, but is that really always the case? 2. In the interim I have found that my current problem really needs the threshold to vary depending upon the overall norm of stuff that I am dealing with, so I want to code something like symbolic procedure kill v; if floatp v and v <= tolerance then 0.0 else if atom v then v else kill car v . kill cdr v; ... on rounded; for i:=1:99 do begin ... tolerance:=1e-8*normStuff; kill(v); ... end; But then kill(v) fails. I have tried declaring "share tolerance;" but that also fails. Tony -- --------------------------------------------------------------------- Four books and a toolbox: * (2020) Linear Algebra for the 21st Century Oxford University Press. isbn: 978-0-19-885640-5, 978-0-19-885639-9 https://global.oup.com/academic/product/linear-algebra-for-the-21st-century-9780198856399 * (2015) Model emergent dynamics in complex systems SIAM, Philadelphia. isbn: 9781611973556. https://epubs.siam.org/doi/10.1137/1.9781611973563 * (2009) Elementary calculus of financial mathematics SIAM, Philadelphia. isbn: 978-0-898716-67-2. https://epubs.siam.org/doi/10.1137/1.9780898718225 * (1994) A one-dimensional introduction to continuum mechanics World Sci. isbn: 978-981-02-1913-0. * (2020) with John Maclean, and J. E. Bunder; Equation-Free function toolbox for Matlab/Octave. http://github.com/uoa1184615/EquationFreeGit Emeritus Professor A.J. Roberts, FAustMS School of Mathematical Sciences, University of Adelaide https://profajroberts.github.io/ mailto:Pro...@pr... http://orcid.org/0000-0001-8930-1552 |