From: Soegtrop, M. <mic...@in...> - 2016-02-09 17:09:10
|
Dear Stavros, thanks for the hints and pointers, I appreciate it! > (3) I actually don't think this is that hard to automate, but I haven't tried. > The advantage of this approach is that someone could actually code it at the > Maxima level with no knowledge of Maxima internals at all. I think the problem is that when numerators and denominators are taken apart, e.g. all coefficients of a polynom are brought to a common denominator and this is factored out, information about the original scaling of numbers is lost. Imagine what happens when this is done to a rational function: all the coefficients are large integers, and the two common denominators end up as factored out fraction. In this situation it is almost impossible to recover the original order of magnitude of the coefficients. You end up with very large coefficients in the numerator and denominator polynom. Of cause one could make the coefficient of the largest power of numerator and denominator 1, but this is not always desirable in physical applications. The original numbers might make some sense to the user, while the rescaled numbers don’t. And there are definitely cases, which are more intricate than rational functions. Best regards, Michael From: mac...@gm... [mailto:mac...@gm...] On Behalf Of Stavros Macrakis (Sta???? ?a??????) Sent: Tuesday, February 9, 2016 5:39 PM To: Soegtrop, Michael <mic...@in...> Cc: Raymond Toy <toy...@gm...>; max...@li... Subject: Re: [Maxima-discuss] Other number forms. Michael, I think I understand your problem, and there seem to be several ways to approach it: 1) Ensure that more of Maxima (including solve) implements keepfloat. 2) Allow rational coefficients (and while we're at it, bfloats) for polynomials, not just integers. 3) Post-process results to normalize numbers. ---------- (1) Seems like a desirable thing. It does require someone to root around various pieces of not-well-documented code. (2) The main implementation issue here is that the rational package (CRE) uses a quick shortcut to determine whether an object is a coefficient. Simply changing (defmacro pcoefp (e) `(atom ,e)) to (declaim (inline pcoefp)) (defun pcoefp (e) (or (atom e) (listp (car e)))) or maybe (declaim (inline pcoefp)) (defun pcoefp (e) (or (atom e) (and (listp (car e)) (memq (caar e) '(rat bigfloat)))))* is the first step towards allowing rationals ((rat) 2 3) and bfloats ((bfloat...)...) as coefficients. This does add a bit of general overhead to all CRE operations, but I suspect it is not prohibitive. There is a bit more work needed to make sure this all works correctly, but I don't think it's difficult if we're willing to accept two calls to 'atom' instead of one. (3) I actually don't think this is that hard to automate, but I haven't tried. The advantage of this approach is that someone could actually code it at the Maxima level with no knowledge of Maxima internals at all. * yes, memq dammit On Tue, Feb 9, 2016 at 4:55 AM, Soegtrop, Michael <mic...@in...<mailto:mic...@in...>> wrote: Dear Ray, > It seems if you just modified the printer to convert decimals exactly and modified the printer > to print out your decimals forms, you'd have everything you want. Yes? No. The main issue I have is that maxima takes the numerator and denominator apart and that they end up quite far away in the terms, where it is not easy to put them together again in a print routine. E.g. numerators of some numbers are combined into one number while denominators of other numbers are combined. In the end I get 10^200 integers all over the place and this completely obscures the term. I can convert these terms back to something readable, but I find that the solution needs to be adjusted case by case and that this takes way too much time. Also I think it would be very hard to automate this. The only solution I see is to keep exact rationals as atomic unit, like a floating point number, together with some information if they were derived from input in decimal or fraction notation, so that the output matches this. Something like 0.5^2 = 0.25 (1/2)^2 = 1/4 Best regards, Michael Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0<tel:%2B49%2089%2099%208853-0>, www.intel.de<http://www.intel.de> Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ Maxima-discuss mailing list Max...@li...<mailto:Max...@li...> https://lists.sourceforge.net/lists/listinfo/maxima-discuss Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 |