[GiNaC-devel] Power laws
Vladimir V. Kisil
V.Kisil at leeds.ac.uk
Thu Jun 4 17:45:56 CEST 2020
Dear All,
Coming back to the previous discussion on exponent/power
functions I am sending the collection of three patches. The first two
are corrected/polished versions of two patches described in my
previous email (see forwarded below). Briefly:
1. First patch adds the rule (e^a)^b = e^(ab) to automatic evaluation
in safe cases.
2. Second improves normalisation method for exponents, it is able to
reduce (exp(2*x)-1)/(exp(x)-1) to exp(x)+1.
3. Third patch add the similar functionality for powers, it is able to
reduce (x-1)/(sqrt(x)-1) to sqrt(x)+1.
Patches have check components which illustrate further examples of
normalisation.
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 Fri, 10 Apr 2020 08:43:52 +0100, "Vladimir V. Kisil" <V.Kisil at leeds.ac.uk> said:
VVK> Dear Richard,
VVK> Thank you for pointing out an issue with notmalisation
VVK> of expressions. What about the attached _draft_ of the patch?
VVK> It allows to reduce all suitable exponents with arguments
VVK> different by a rational numeric factor to monomials of the same
VVK> temporary variable. Thus it reduces
VVK> (exp(2*x)-1)/(exp(x)-1) to exp(x)+1
VVK> as well as other more complicated cases like
VVK> (exp(15*x)+exp(12*x)+2*exp(10*x)+2*exp(7*x))/(exp(5*x)+exp(2*x))
VVK> to exp(5*x)^2+2*exp(5*x)
VVK> The patch modifies some signatures of functions, which
VVK> however are not advertised as user interface. A footprint on
VVK> the performance with expressions without exponents shall not be
VVK> really noticeable.
VVK> If the approach is suitable I can add a similar behaviour for
VVK> powers, then the simplification
VVK> (a^(2x)-1)/(a^x-1) to a^x+1
VVK> will work as well.
VVK> Some tests shall be added for the final version of the patch.
VVK> Once this will be working, shall we add the automatic
VVK> simplification (a^b)^c=a^(b*c) for suitable cases as well?
VVK> Best wishes, Vladimir -- Vladimir V. Kisil
VVK> http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius
VVK> Transformations http://goo.gl/EaG2Vu Software: Geometry of
VVK> cycles http://moebinv.sourceforge.net/ Jupyter:
VVK> https://github.com/vvkisil/MoebInv-notebooks
>>>>> On Thu, 9 Apr 2020 01:51:09 +0200, "Richard B. Kreckel"
VVK> <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-Automatic-evaluation-of-e-t-s-e-ts.patch
Type: text/x-diff
Size: 2016 bytes
Desc: Exponent law patch
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20200604/e5db48bf/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Make-a-stronger-normalisation-for-expressions-with-e.patch
Type: text/x-diff
Size: 21253 bytes
Desc: Exponent normalization patch
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20200604/e5db48bf/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Stronger-normalisation-method-for-powers.patch
Type: text/x-diff
Size: 7232 bytes
Desc: Power normalization
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20200604/e5db48bf/attachment-0002.bin>
More information about the GiNaC-devel
mailing list