From: Prof T. R. <Pro...@pr...> - 2024-02-17 23:25:03
|
Hi all, I am doing a mixed numerical-algebraic problem via iteration, an iteration that needs to stop once numerical coefficients are small. Is there a function in reduce that will go through an expression and set to zero all coefficients that are less than some tolerance? (I cannot find anything in the manual.) For example, after some iterations I have the following expressions and I would like to zero every coefficient of magnitude less than 1e-6 say. So that then the pde becomes a zero vector, and the dudt expressions simplify to just the significant terms. **** ITERATION 14 pde := mat((0.0000002622*df(uu(1),x)*d - 0.00000001295*df(uu(2),x)*d), ( - 0.0000003978*df(uu(1),x)*d + 0.00000006401*df(uu(2),x)*d), ( - 1.438e-14*uu(1) - 0.00000003801*df(uu(1),x)*d - 0.00000005106*df(uu(2),x)*d), (0.00000003801*df(uu(1),x)*d - 0.00000005106*df(uu(2),x)*d), (0.0000003978*df(uu(1),x)*d + 0.00000006401*df(uu(2),x)*d), ( - 1.952e-16*uu(1) - 0.0000002622*df(uu(1),x)*d - 0.00000001295*df(uu(2),x)*d)) normpde := 0.0000003978 dudt(0) := 9.939e-15*uu(1) + 3.875e-15*uu(2) + 6.98e-15*df(uu(0),x)*d - 5.402e-15*df(uu(1),x)*d + 0.6336*df(uu(2),x)*d dudt(1) := - 0.8371*uu(1) + 3.31e-15*uu(2) + 1.45e-15*df(uu(0),x)*d - 3.216e-14*df(uu(1),x)*d + 1.505*df(uu(2),x)*d 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 |