[GiNaC-devel] Power laws
Vladimir V. Kisil
V.Kisil at leeds.ac.uk
Fri Apr 10 09:43:52 CEST 2020
Dear Richard,
Thank you for pointing out an issue with notmalisation of
expressions. What about the attached _draft_ of the patch? It allows
to reduce all suitable exponents with arguments different by a
rational numeric factor to monomials of the same temporary
variable. Thus it reduces
(exp(2*x)-1)/(exp(x)-1) to exp(x)+1
as well as other more complicated cases like
(exp(15*x)+exp(12*x)+2*exp(10*x)+2*exp(7*x))/(exp(5*x)+exp(2*x)) to
exp(5*x)^2+2*exp(5*x)
The patch modifies some signatures of functions, which however are not
advertised as user interface. A footprint on the performance with
expressions without exponents shall not be really noticeable.
If the approach is suitable I can add a similar behaviour for powers,
then the simplification
(a^(2x)-1)/(a^x-1) to a^x+1
will work as well.
Some tests shall be added for the final version of the patch.
Once this will be working, shall we add the automatic simplification
(a^b)^c=a^(b*c) for suitable cases as well?
Best wishes,
Vladimir
--
Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/
Book: Geometry of Mobius Transformations http://goo.gl/EaG2Vu
Software: Geometry of cycles http://moebinv.sourceforge.net/
Jupyter: https://github.com/vvkisil/MoebInv-notebooks
>>>>> On Thu, 9 Apr 2020 01:51:09 +0200, "Richard B. Kreckel" <kreckel at in.terlu.de> said:
RK> Hi Vladimir!
RK> On 06.04.20 14:34, Vladimir V. Kisil wrote:
>> Coming back to our previous discussion (with a long history) on
>> the power law (e^x)^a=e^(x*a). I am attaching a patch which does
>> not break the automatic simplification exp(x)/exp(x)=1.
RK> Your new patch is much better since it doesn't break any
RK> existing test suite.
RK> Playing around with it, it still seems to raise some fundamental
RK> questions: What justifies treating exp(x)^a fundamentally
RK> different than any other (b^x)^a with a (positive) base b? With
RK> the patch, there seems to be this discrimination: exp(x)^5 is
RK> rewritten to exp(5*x) but (b^x)^5 is _not_ rewritten to b^(5*x).
RK> It's a nice pastime to fancy consequences of this. Let y=b^x,
RK> then normal((y^2-1)/(y+1)) returns b^x-1. But if y=exp(x), the
RK> patch prevents the normalization to exp(x)-1. Ugh.
RK> Or, consider this gedankenexperiment: If we didn't have exp(x)
RK> as a function but instead a symbol e, would it be justified to
RK> have special re-writing rules for (e^x)^a but not for (b^x)^a?
RK> I'm not sure...
RK> Best wishes, -richy. -- Richard B. Kreckel
RK> <https://in.terlu.de/~kreckel/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-a-stronger-normalisation-for-expressions-with-e.patch
Type: text/x-diff
Size: 19704 bytes
Desc: Draft of a patch
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20200410/13c8f427/attachment.bin>
More information about the GiNaC-devel
mailing list