ginac.git
3 years agoFix some pedantic compiler warnings.
Richard Kreckel [Sun, 8 Nov 2015 22:18:19 +0000 (23:18 +0100)]
Fix some pedantic compiler warnings.

Found with CLang++ -Wall. (There remain some more, but these are
more ugly to fix.)

3 years agoReplace GiNaC::ToString() with std::to_string().
Richard Kreckel [Sun, 8 Nov 2015 21:19:08 +0000 (22:19 +0100)]
Replace GiNaC::ToString() with std::to_string().

And, while at it, also make CMake exercise the new real_imag exam
introduced last week and document successful build with GCC-4.8.

3 years agoUse C++11 'nullptr' where applicable.
Richard Kreckel [Sat, 7 Nov 2015 21:24:29 +0000 (22:24 +0100)]
Use C++11 'nullptr' where applicable.

3 years agoRemove C++89 workaround for closing angle brackets in nested templates.
Richard Kreckel [Sat, 7 Nov 2015 12:23:26 +0000 (13:23 +0100)]
Remove C++89 workaround for closing angle brackets in nested templates.

3 years agoRemove 'discardable' option from ctors of container and derived classes.
Richard Kreckel [Sat, 7 Nov 2015 12:03:05 +0000 (13:03 +0100)]
Remove 'discardable' option from ctors of container and derived classes.

The whole idea of this was to allow the ctor to pilfer the data from the
constructed-from object, which is precisely the move semantics which
C++11 supports with rvalue references.

3 years agoAdd trivial shortcuts in expair plumbing of class add.
Richard Kreckel [Sat, 7 Nov 2015 00:50:00 +0000 (01:50 +0100)]
Add trivial shortcuts in expair plumbing of class add.

These little shortcuts in add::split_ex_to_pair(ex) and in
add::combine_ex_with_coeff_to_pair(ex, ex) avoid the creation of
new ex objects. These pieces of code are executed so often that this
patch speeds up GiNaC by 5-10%, depending on test.

3 years agoFix little missed optimization.
Richard Kreckel [Fri, 6 Nov 2015 14:04:49 +0000 (15:04 +0100)]
Fix little missed optimization.

3 years agoReplace dynamic throw() with static noexcept operator.
Richard Kreckel [Fri, 6 Nov 2015 00:00:55 +0000 (01:00 +0100)]
Replace dynamic throw() with static noexcept operator.

3 years agoAdd some minor optimizations.
Richard Kreckel [Thu, 5 Nov 2015 12:41:18 +0000 (13:41 +0100)]
Add some minor optimizations.

3 years agoSpeed up power::real_part() and power::imag_part().
Richard Kreckel [Thu, 5 Nov 2015 12:30:48 +0000 (13:30 +0100)]
Speed up power::real_part() and power::imag_part().

Add special case for real base and exponent (not just integer exponent).
Improve special case for integer exponent by explicitly constructing
the result using the Binomial expansion.
Add a test case for real/imaginary part expansion.

3 years agoUse AX_CXX_COMPILE_STDCXX_11 macro to force C++11 compilation.
Richard Kreckel [Tue, 3 Nov 2015 20:23:16 +0000 (21:23 +0100)]
Use AX_CXX_COMPILE_STDCXX_11 macro to force C++11 compilation.

3 years agoFix most remaining GCC compiler warnings.
Richard Kreckel [Tue, 3 Nov 2015 19:53:07 +0000 (20:53 +0100)]
Fix most remaining GCC compiler warnings.

3 years agoMove ctors for classes matrix and pseries.
Richard Kreckel [Tue, 3 Nov 2015 15:46:06 +0000 (16:46 +0100)]
Move ctors for classes matrix and pseries.

3 years agoUse C++11 range-based foor loops and auto, where possible.
Richard Kreckel [Tue, 3 Nov 2015 13:15:57 +0000 (14:15 +0100)]
Use C++11 range-based foor loops and auto, where possible.

3 years agoUpdate documentation of prerequisites.
Richard Kreckel [Sun, 1 Nov 2015 23:00:48 +0000 (00:00 +0100)]
Update documentation of prerequisites.

3 years agoReplace use of NULL by C++11 nullptr.
Richard Kreckel [Sun, 1 Nov 2015 22:48:05 +0000 (23:48 +0100)]
Replace use of NULL by C++11 nullptr.

3 years agoRemove dependence on depreacted std::auto_ptr<T>.
Richard Kreckel [Sun, 1 Nov 2015 19:16:12 +0000 (20:16 +0100)]
Remove dependence on depreacted std::auto_ptr<T>.

Most of the auto_ptr were introduced to avoid copying. C++11 supports
move semantics for this. Some other can be replaced by std::unique_ptr<T>.

3 years agoRemove support for Cint.
Richard Kreckel [Sat, 31 Oct 2015 16:18:55 +0000 (17:18 +0100)]
Remove support for Cint.

3 years agoRemove unfinished code for hash table-based expairseq.
Richard Kreckel [Sat, 31 Oct 2015 16:02:14 +0000 (17:02 +0100)]
Remove unfinished code for hash table-based expairseq.

This is unfinished code by A.F. Later generations don't ever
seem to have tinkered much with it.  ;-)

4 years agoFix make check with g++ -std=c++11.
Richard Kreckel [Thu, 15 Oct 2015 06:59:20 +0000 (08:59 +0200)]
Fix make check with g++ -std=c++11.

Our template function log() returning an object of type GiNaC::function
turns out to compete with a template from a libstdc++ header. We have
to help the compiler a bit.

4 years agoFix some apparent typos and misindentations 2.
Richard Kreckel [Sat, 10 Oct 2015 20:24:32 +0000 (22:24 +0200)]
Fix some apparent typos and misindentations 2.

(Formatting should comply with http://www.cebix.net/indentation.html.)

4 years agoFix algebraic power::has() for larger integer exponents.
Richard Kreckel [Sat, 10 Oct 2015 09:02:17 +0000 (11:02 +0200)]
Fix algebraic power::has() for larger integer exponents.

There is no need to overflow integers in (x^2147483648).has(x^2).

4 years agoInclude crc32.h only if needed.
Richard Kreckel [Mon, 21 Sep 2015 21:04:20 +0000 (23:04 +0200)]
Include crc32.h only if needed.

This shuts up a compiler warning about unused static function crc32.

4 years agoRemove unused variable.
Richard Kreckel [Mon, 21 Sep 2015 20:49:44 +0000 (22:49 +0200)]
Remove unused variable.

This shuts up a compiler warning.

4 years agoFix parser example in tutorial.
Richard Kreckel [Fri, 31 Jul 2015 22:52:11 +0000 (00:52 +0200)]
Fix parser example in tutorial.

Thanks to Jean-Michaël Celerier for pointing this out.

4 years agoFix some apparent typos and misindentations.
Richard Kreckel [Fri, 31 Jul 2015 22:41:30 +0000 (00:41 +0200)]
Fix some apparent typos and misindentations.

4 years agoFinalizing release 1.6.5. ginac_1-6-5
Richard Kreckel [Mon, 27 Jul 2015 19:28:44 +0000 (21:28 +0200)]
Finalizing release 1.6.5.

4 years agoFix bug in PolyLogs of rational numbers.
Stefan Weinzierl [Fri, 24 Jul 2015 18:50:57 +0000 (20:50 +0200)]
Fix bug in PolyLogs of rational numbers.

Thanks to Alexander Hasselhuhn for reporting this bug.

4 years agoSpeed up pow(+(...),n).expand() where n>2.
Richard Kreckel [Sat, 18 Jul 2015 22:04:49 +0000 (00:04 +0200)]
Speed up pow(+(...),n).expand() where n>2.

This new algorithm is faster than the old one because it re-uses
multinomial coefficients as much as possible.

4 years agoFix pow(+(...),2).expand().
Richard Kreckel [Sat, 18 Jul 2015 21:56:55 +0000 (23:56 +0200)]
Fix pow(+(...),2).expand().

Due to a failure to expand result terms, expand((sqrt(1+x)+y*sqrt(1+x))^2)
returned 1+y^2+x+x*y^2+2*y*(1+x). Note that 2*y*(1+x) was not expanded
to 2*y+2*y*x.

4 years agoFinalized 1.6.4 release. ginac_1-6-4
Richard Kreckel [Fri, 8 May 2015 07:35:24 +0000 (09:35 +0200)]
Finalized 1.6.4 release.

4 years agoFix pow(+(...),2).expand().
Richard Kreckel [Thu, 7 May 2015 20:33:13 +0000 (22:33 +0200)]
Fix pow(+(...),2).expand().

Due to a failure to recombine coeffs and rests to expairs,
expand((x+sqrt(2)*x)^2) returned x^2+2*x^2+2*sqrt(2)*x^2. The
2*x^2 term was not combined with the x^2 term to 3*x^2 because it
was not the canonical expair [[x^2,2]] but rather [[2*x^2,1]].

Thanks to Isuru Fernando for the bugreport.

4 years agoAdd test cases for improved abs(arg).
Richard Kreckel [Thu, 23 Apr 2015 20:33:52 +0000 (22:33 +0200)]
Add test cases for improved abs(arg).

Exam the evaluations abs(±sqrt(p)) -> sqrt(p) for p > 0.

4 years agoImprove abs(arg).
Vladimir Kisil [Wed, 22 Apr 2015 21:21:53 +0000 (23:21 +0200)]
Improve abs(arg).

Make abs(arg) return -arg if arg is negative or if -arg is known to be
nonnegative.

4 years agoFix pow::info(info_flags::nonnegative).
Vladimir Kisil [Wed, 22 Apr 2015 21:06:56 +0000 (23:06 +0200)]
Fix pow::info(info_flags::nonnegative).

This function call was missing the case where a positive base is raised
to a real power (where pow::info(info_flags::positive) correctly returned
true).

4 years agoFix mul::info(info_flags::nonnegative).
Vladimir Kisil [Wed, 22 Apr 2015 19:52:15 +0000 (21:52 +0200)]
Fix mul::info(info_flags::nonnegative).

Due to an obvious Boolean inversion, this function call always
returned the wrong answer.

4 years agoMake power::expand() (x*p)^c -> x^c * p^c, if p>0.
Vladimir Kisil [Tue, 14 Apr 2015 21:14:09 +0000 (23:14 +0200)]
Make power::expand() (x*p)^c -> x^c * p^c, if p>0.

This expansion seems to be helpful in many cases.

4 years agoMake compile_ex() work with CMake.
Martin Vala [Tue, 14 Apr 2015 20:50:31 +0000 (22:50 +0200)]
Make compile_ex() work with CMake.

Infrastructure fixes to make CMake find libdl and make ginac-excompiler
listen to the $CXXFLAGS environment variable.

4 years agoImprove normalization with nested functions.
Ladislav Zejda [Sat, 14 Mar 2015 10:12:11 +0000 (11:12 +0100)]
Improve normalization with nested functions.

normal() fails to fully normalize expressions where nested functions occur
multiple times because replace_with_symbol() searches repl for an
original expression but inserts into repl the substitued expression. Then
the repeated search does not work and a new symbol is introduced.

This patch fixes that by searching for the expression with the repl
substituted instead of for the original expression.

4 years agoFixing index in tutorial.
Vladimir V. Kisil [Sun, 8 Feb 2015 19:53:55 +0000 (20:53 +0100)]
Fixing index in tutorial.

The index entry for clifford::get_metric() did not work, change it to get_metric().

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
4 years agoExplicit derivation of functions.
Vladimir V. Kisil [Sun, 8 Feb 2015 19:50:51 +0000 (20:50 +0100)]
Explicit derivation of functions.

Some function cannot be cleanly differentiated through the chain rule.
For example, it is natural to define derivative of the absolute value as

(abs(f))'=(f'*f.conjugate()+f*f'.conjugate())/2/abs(f)

This patch adds a possibility to define derivatives of functions in this way.
In particular the derivative of abs(), Order(), real_part(), imag_part() and
conjugate() are defined.

For example, conjugate of a derivative with respect of a real symbol
If x is real then U.diff(x)-I*V.diff(x) represents both
conjugate(U+I*V).diff(x) and conjugate((U+I*V).diff(x))
Thus in this patch we use the rule

conjugate(f)'=conjugate(f')

for a derivative with respect to the real symbol.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
4 years agoPut a reference on eta function into tutorial.
Vladimir V. Kisil [Sat, 31 Jan 2015 12:04:13 +0000 (13:04 +0100)]
Put a reference on eta function into tutorial.

4 years agoHappy new year!
Richard Kreckel [Sun, 25 Jan 2015 10:50:43 +0000 (11:50 +0100)]
Happy new year!

4 years agoSmall optimization in simplify_indexed.
Vladimir V. Kisil [Sun, 25 Jan 2015 10:39:04 +0000 (11:39 +0100)]
Small optimization in simplify_indexed.

If the new expression is product again then we call the same function return
simplify_indexed_product() rather than the its mother implify_indexed().

4 years agoEvaluate abs(z)^(2n) -> z^n * conjugate(z)^n.
Vladimir V. Kisil [Wed, 31 Dec 2014 18:07:26 +0000 (18:07 +0000)]
Evaluate abs(z)^(2n) -> z^n * conjugate(z)^n.

4 years agoFinalized 1.6.3 release. ginac_1-6-3
Richard Kreckel [Thu, 27 Nov 2014 21:29:39 +0000 (21:29 +0000)]
Finalized 1.6.3 release.

Updated NEWS file, moved some comments so Doxygen won't be confused.

4 years agoPrepare for 1.6.3 release.
Alexei Sheplyakov [Sun, 19 Jan 2014 17:50:23 +0000 (19:50 +0200)]
Prepare for 1.6.3 release.

5 years agoUpdate copyright statements.
Richard Kreckel [Tue, 14 Oct 2014 19:41:20 +0000 (19:41 +0000)]
Update copyright statements.

5 years agoThe FSF has moved (long ago).
Richard Kreckel [Tue, 14 Oct 2014 19:27:34 +0000 (19:27 +0000)]
The FSF has moved (long ago).

Update some its postal address in some remaining places.

5 years agoFix log() error in multiple polylog G.
Stefan Weinzierl [Sun, 12 Oct 2014 18:30:41 +0000 (18:30 +0000)]
Fix log() error in multiple polylog G.

Tobias Huber reported the following bug:
> G({-0.18784426860496276*I,-0.1579006477353911*I,+0.18784426860496276*I,-0.18784426860496276*I},1);
log_eval(): log(0)

The problem is the sorting operation in G_do_trafo. This operation should
1) put the elements in increasing order of |x|
2) put equal elements next to each other (which then will avoid the log(0) problem).

The current code fails for goal 2) if we have complex numbers of equal absolute
value, one number occuring more than once, in an initial order like in the example
above:
Entries 1,3,4 of the list all have the same absolute value, entries 1 and 4 are
equal. In the sorting operation 1 and 4 should be put next to each other.
Previously, the sorting operation would give 2,1,3,4. What we would like to have
is either 2,1,4,3 or 2,3,1,4. It is clear that the key for the sorting operation
cannot be |x| alone. If |x1|=|x2| we have to use the phase as well.

This patch takes the phase into account in the sorting.

5 years agoFix evaluation of some G-polylogs.
Stefan Weinzierl [Sun, 12 Oct 2014 18:24:07 +0000 (18:24 +0000)]
Fix evaluation of some G-polylogs.

This patch corrects and supersedes the patches
97ef604e "G_numeric: fix numeric evaluation with trailing zeros and y != 1."
and
9e80b0d3 "G_numeric: fix evaluation with y == 1".

The original motivation for 97ef604e was to make sure that Hoelder convolution
is only used if there no trailing zeros.

Patch 97ef604e delegated the case of trailing zeros to G_do_trafo, which correctly
removes the trailing zeros, but in addition also performed the transformation
described in sect. 5.3 of hep-ph/0410259 ("convergence transformation").
The inappropriate call of the convergence transformation is the cause of the new bug
reported at http://www.cebix.net/pipermail/ginac-list/2014-September/002011.html

The patch 9e80b0d3 cures the symptons mentioned in the above bug report,
but fails for other cases, like evalf( G({-2,2,-2,0},2) ).

What should be done is the following: If trailing zeros are detected in G_numeric,
these should be removed and the result should be returned to G_numeric. The
routine G_numeric decides then what to do next: either calling the convergence
transformation, or Hoelder convolution or direct summation. What is needed is a
subroutine, which just removes trailing zeros, but does not perform the convergence
transformation.

With the present code the minimal modification to achieve this goal is to add an
additional boolean parameter flag_trailing_zeros_only to G_do_trafo (and its
dependent sub-routines), so G_do_trafo can be called for the removal of trailing
zeros only.

This patch implements this and uses G_do_trafo to remove trailing zeros only for
the case at hand.

5 years agoG_numeric: fix evaluation with y == 1
Alexei Sheplyakov [Fri, 12 Sep 2014 13:50:51 +0000 (17:50 +0400)]
G_numeric: fix evaluation with y == 1

Do apply Hoelder convolution if y == 1 even if there are trailing zeros.
Fixes the regression introduced by commit 97ef604e ("G_numeric: fix
numeric evaluation with trailing zeros and y != 1.")

5 years agoAdd more ex::is_polynomial() tests
Alexei Sheplyakov [Sun, 7 Sep 2014 18:56:02 +0000 (22:56 +0400)]
Add more ex::is_polynomial() tests

Improves commit 92da4c16 ('[bugfix] ex::is_polynomial(x): fix miscomputations')
a little bit.

5 years agoProviding default (un)archiving for cliffordunit class.
Vladimir V. Kisil [Mon, 18 Aug 2014 20:29:01 +0000 (21:29 +0100)]
Providing default (un)archiving for cliffordunit class.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
5 years ago[bugfix] ex::is_polynomial(x): fix miscomputations
Richard Kreckel [Fri, 25 Jul 2014 23:11:11 +0000 (23:11 +0000)]
[bugfix] ex::is_polynomial(x): fix miscomputations

The function power::is_polynomial(x) sometimes returned false,
even if x did not occur in the power object.

Thanks to Rubel Zilibowitz for reporting this bug.

Similarly, mul::is_polynomial(x) sometimes returned true, even
if x occurred only in the denominator of a rational function.

The function mul::is_polynomial(x) does a simpler version of
power::is_polynomial(x) on its factors. (It's simpler because the
exponents cannot be functions of x.)

5 years agoFix example of symmetrization in tutorial.
Richard Kreckel [Tue, 22 Jul 2014 07:48:25 +0000 (07:48 +0000)]
Fix example of symmetrization in tutorial.

The old example was illegal C++. Thanks to Rubel Zilibowitz for
reporting this error.

5 years ago[bugfix] log_series: avoid infinite recursion
Alexei Sheplyakov [Tue, 1 Jul 2014 18:46:11 +0000 (21:46 +0300)]
[bugfix] log_series: avoid infinite recursion

Check if the argument is on a branch cut check if it actually depends
on the expansion variable before trying to expand around a different
point in order to avoid the infinite recursion (or rather a segfault
due to a stack overflow).

Thanks to Mario Prausa for a bugreport.

5 years agoFix an infinite loop in factor_multivariate.
Alexei Sheplyakov [Sun, 18 May 2014 10:24:40 +0000 (13:24 +0300)]
Fix an infinite loop in factor_multivariate.

Make sure the leading coefficient is really factorized (take care of
the integer content).

5 years agoG_do_hoelder: fix the transformation of the imaginary part.
Stefan Weinzierl [Sat, 12 Apr 2014 11:32:20 +0000 (14:32 +0300)]
G_do_hoelder: fix the transformation of the imaginary part.

The G_do_hoelder function transforms the arguments as z -> 1-z.
If z has an imaginary part, the sign of the imagniary part transforms
as s -> -s.
In the special case where z is real and > 1, the transformed value is
real and < 0. For (transformed) real negative values of z the sign of
the imaginary part is not relevant (there are no branch cuts). The code
requires that in this case the sign takes the default value +1.
This is now fixed.

5 years agoG_numeric: fix numeric evaluation with trailing zeros and y != 1.
Stefan Weinzierl [Wed, 12 Feb 2014 20:07:40 +0000 (22:07 +0200)]
G_numeric: fix numeric evaluation with trailing zeros and y != 1.

Make sure G_numeric makes use of scaling relation (G_do_hoelder) only if
there are no traling zeros. Use G_do_trafo otherwise (which can handle
trailing zeros).

5 years ago[docs] remind users tho send EOF marker when doing input from cin.
Richard Kreckel [Mon, 3 Feb 2014 08:02:53 +0000 (08:02 +0000)]
[docs] remind users tho send EOF marker when doing input from cin.

The example program waiting infinitely for EOF has confused at least one
user: <http://www.ginac.de/pipermail/ginac-list/2014-January/001983.html>

5 years agoBinary compatibilty has been broken, update the library version.
Alexei Sheplyakov [Sun, 2 Feb 2014 17:55:22 +0000 (19:55 +0200)]
Binary compatibilty has been broken, update the library version.

commit 798d53ebb4da4e8e3865ed7bd7f31412fe2be3a7 (`Make it possible to override
info() for functions.') overrides the function::info() virtual method. This
breaks binary compatibility (adds a new entry in the middle of the vtable of
the `function' class).

The experimental proof of the above statement: ginsh linked with the previous
release of libginac segfaults if libginac.so is upgraded to the current
version.

Thereore bump the library version.

5 years ago[build] Document that Python is required for building GiNaC.
Alexei Sheplyakov [Sun, 2 Feb 2014 10:56:46 +0000 (12:56 +0200)]
[build] Document that Python is required for building GiNaC.

5 years ago[build] Fix `make pdf' for out of the source (auto* tools) build.
Alexei Sheplyakov [Sun, 2 Feb 2014 15:49:18 +0000 (17:49 +0200)]
[build] Fix `make pdf' for out of the source (auto* tools) build.

5 years ago[build] Include the generated sources (function.{h,cpp}) into the tarball.
Alexei Sheplyakov [Sun, 2 Feb 2014 15:47:38 +0000 (17:47 +0200)]
[build] Include the generated sources (function.{h,cpp}) into the tarball.

5 years ago[build] Include CMake related files into the tarball.
Alexei Sheplyakov [Sat, 1 Feb 2014 16:56:29 +0000 (18:56 +0200)]
[build] Include CMake related files into the tarball.

5 years ago[build] Include the helper scripts into the tarball.
Alexei Sheplyakov [Sat, 1 Feb 2014 16:50:37 +0000 (18:50 +0200)]
[build] Include the helper scripts into the tarball.

5 years agocheck: auto* tools build: compile and run check_mul_info.
Alexei Sheplyakov [Fri, 31 Jan 2014 19:46:26 +0000 (21:46 +0200)]
check: auto* tools build: compile and run check_mul_info.

5 years ago[build] ginsh: fix `make distcheck' failure.
Alexei Sheplyakov [Tue, 28 Jan 2014 06:59:48 +0000 (08:59 +0200)]
[build] ginsh: fix `make distcheck' failure.

5 years agolog_eval: don't apply the log(x^p) -> p*log(x) rule.
Alexei Sheplyakov [Sat, 18 Jan 2014 12:13:46 +0000 (14:13 +0200)]
log_eval: don't apply the log(x^p) -> p*log(x) rule.

Automatically transforming log(p^2) into 2 log(p) might be quite annoying.
Perhaps this transformation should be moved to expand() and applied only
if expand_options::expand_transcendental is specified.

5 years agoLi_eval(): avoid the "numeric::operator>(): complex inequality" exception.
Stefan Weinzierl [Tue, 28 Jan 2014 06:58:06 +0000 (08:58 +0200)]
Li_eval(): avoid the "numeric::operator>(): complex inequality" exception.

Basically the problem is that 1 + 0.0*I is equal to 1, but checking if
the former is positive results in the the "numeric::operator>(): complex
inequality" exception. This behavior is definitely inconsistent and should
be fixed.

As a work around teach Li_eval and convert_parameter_Li_to_H to explicitly
convert 1 + 0.0*I to 1 (and -1 + 0.0*I to -1, respectively).

[Alexei Sheplyakov: comment the code a little bit, otherwise it looks weird]

5 years agoFix S_num for arguments close to the sixth root of unity or its conjugate.
Stefan Weinzierl [Sun, 12 Jan 2014 22:31:22 +0000 (22:31 +0000)]
Fix S_num for arguments close to the sixth root of unity or its conjugate.

The method S_num within the Nielsen polylogs used to map the region
abs(x)<=1 && abs(x)>0.95 && abs(1-x)<=1 && abs(1-x)>0.95 infinitely many times
onto itself. This infinite recursion is now avoided.

This however reveals the next problem: The numerical convergence in this
region is very slow. Within the Nielsen polylogs there is no transformation
available to improve the convergence. However we can use the (1-x)/(1+x)
transformation within the harmonic polylogs. In order to avoid another
infinite recursion I have inserted a few hold()'s in the method H_evalf,
otherwise we would fall back immediately again to Nielsen polylogs. The hold()s
should have been there anyway.

5 years agoFix G3_evalf and G3_eval for real and negative x.
Stefan Weinzierl [Sun, 12 Jan 2014 22:19:56 +0000 (22:19 +0000)]
Fix G3_evalf and G3_eval for real and negative x.

The user supplied signs of the imaginary parts are only relevant for x real
and positive. A negative sign in the case of x real and negative is irrelevant
(there is no branch cut) and led to wrong results. This is now avoided.

5 years agoWithin mLi_numeric, set signs of the imaginary parts correctly for G_numeric.
Stefan Weinzierl [Sun, 12 Jan 2014 22:07:28 +0000 (22:07 +0000)]
Within mLi_numeric, set signs of the imaginary parts correctly for G_numeric.

5 years agoAvoid calling log(1-x) for x=1 in Li_projection.
Stefan Weinzierl [Sun, 12 Jan 2014 21:58:12 +0000 (21:58 +0000)]
Avoid calling log(1-x) for x=1 in Li_projection.

5 years agoFix evaluation of log(p^a) -> a*log(p), if p>0 and a is real.
Vladimir V. Kisil [Sat, 28 Dec 2013 23:58:40 +0000 (23:58 +0000)]
Fix evaluation of log(p^a) -> a*log(p), if p>0 and a is real.

This evaluation was broken with commit e5c76f659e2e882d.

5 years agoexpairseq::match(): no side effects if match failed. Fixes spurious match failures.
Matthias Dellweg [Tue, 10 Dec 2013 08:55:28 +0000 (10:55 +0200)]
expairseq::match(): no side effects if match failed. Fixes spurious match failures.

> match(sin(y)*exp(b)+sin(x)*exp(a), sin($0)*exp(a)+exp(b)*sin($1))
FAIL

The reason is that expairseq::match() might assign a wildcard even if
the match fails. The first attempted submatch is sin(y)*exp(b) with
sin($0)*exp(a). It fails (as it should) but $0 == y gets assigned as
a side effect (which is wrong). Next submatch is sin(x)*exp(a) with
sin($0)*exp(a) (the same pattern as in the first submatch). This one
fails because of spurious $0 == y assignment.

Due to the unpredicatable term ordering the sequence of submatches might
be different and the match might succeed (as it should). This makes
debugging a bit more funny.

Signed-off-by: Matthias Dellweg <dellweg@tp1.uni-duesseldorf.de>
[Alexei Sheplyakov: figure out the cause of the problem, make a test case]

5 years agoExpansion rules for exp(), log(), and abs().
Vladimir V. Kisil [Sun, 3 Nov 2013 20:21:00 +0000 (22:21 +0200)]
Expansion rules for exp(), log(), and abs().

exp(a + b) -> exp(a)*exp(b)
log(a*b) -> log(a) + log(b)
abs(z*w) -> abs(z)*abs(w)

log and exp are transformed only if expand_options::expand_transcendental
is given.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
5 years agoIntroduce expand_options::expand_transcendental.
Vladimir V. Kisil [Sat, 2 Nov 2013 19:06:53 +0000 (21:06 +0200)]
Introduce expand_options::expand_transcendental.

In general expand() treats the argument as a rational expression (and
leave transcendental functions as they are). However sometimes it's
convenient to expand transcendental functions too, like

log(a*b) = log(a) + log(b)
exp(a + b) = exp(a)*exp(b)

Applying such transformation by default doesn't seem to be a smart idea
(think of log(p^2/mu^2) transformed to 2*log(p) - 2*log(mu)). Therefore
introduce expand_options::expand_transcendental. As the name implies expand()
tries to transform transcendental functions only if this flag is set.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
5 years agoKeep CLang/libc++ happy.
Richard Kreckel [Sun, 3 Nov 2013 12:49:07 +0000 (12:49 +0000)]
Keep CLang/libc++ happy.

6 years agoabs() and conjugate() provide some info() now.
Vladimir V. Kisil [Wed, 11 Sep 2013 08:26:30 +0000 (09:26 +0100)]
abs() and conjugate() provide some info() now.

6 years agoMake it possible to override info() for functions.
Vladimir V. Kisil [Wed, 11 Sep 2013 08:26:30 +0000 (09:26 +0100)]
Make it possible to override info() for functions.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
6 years agoPower with a real base and even exponent reports that it's non-negative
Vladimir V. Kisil [Thu, 1 Aug 2013 13:37:45 +0000 (14:37 +0100)]
Power with a real base and even exponent reports that it's non-negative

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
6 years agoImprove abs_eval(): abs(conjugate(z)) => abs(z), ...
Vladimir V. Kisil [Thu, 1 Aug 2013 13:37:45 +0000 (14:37 +0100)]
Improve abs_eval(): abs(conjugate(z)) => abs(z), ...

... abs(step(z)) => step(z)

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
6 years agoFunctions can define a custom expand() now.
Vladimir V. Kisil [Mon, 7 Oct 2013 05:04:30 +0000 (08:04 +0300)]
Functions can define a custom expand() now.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
6 years agoMore evaluation rules: abs(x^n) => abs(x)^n (x > 0, n is real).
Vladimir V. Kisil [Wed, 31 Jul 2013 08:48:24 +0000 (09:48 +0100)]
More evaluation rules: abs(x^n) => abs(x)^n (x > 0, n is real).

A simple test is added as well.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
6 years agoTransform abs(x)^n => x^n if x is real and n is even.
Vladimir V. Kisil [Tue, 30 Jul 2013 15:40:38 +0000 (16:40 +0100)]
Transform abs(x)^n => x^n if x is real and n is even.

While at it add some .hold() to returns which cannot be processed further.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
6 years agomul::info(): cache the result of the positiveness/negativeness checks, ...
Alexei Sheplyakov [Sun, 13 Oct 2013 10:16:16 +0000 (13:16 +0300)]
mul::info(): cache the result of the positiveness/negativeness checks, ...

... and use the cached result if possible.

6 years agoIntroduce status_flags::{is_positive,is_negative,purely_indefinite}
Alexei Sheplyakov [Sat, 3 Aug 2013 14:01:42 +0000 (17:01 +0300)]
Introduce status_flags::{is_positive,is_negative,purely_indefinite}

Quite a number of transformations can be applied if the expression
is known to be positive (negative) (for instance, sqrt(x^2*y^2) = x*y
if x >= 0 and y >= 0). However the check itself might be quite expensive.
Hence a few status_flags are introduced to cache the result.

6 years agoAdd subdir-objects to Automake options.
Richard Kreckel [Fri, 11 Oct 2013 21:11:35 +0000 (23:11 +0200)]
Add subdir-objects to Automake options.

This option is needed to keep automake 1.14 happy.

6 years ago[build] fix ginsh build for automake <=1.11.
Richard Kreckel [Sun, 11 Aug 2013 11:16:15 +0000 (13:16 +0200)]
[build] fix ginsh build for automake <=1.11.

automake <=1.11 and automake >=1.12 have different conventions for naming
C++ header files made by yacc.  To work with both, we write our own rule
rather than using automake's.

6 years ago[build] auto* tools based build: fix `make dist'.
Alexei Sheplyakov [Sun, 11 Aug 2013 06:59:53 +0000 (09:59 +0300)]
[build] auto* tools based build: fix `make dist'.

6 years agoimprove mul::info(): the product of two negative terms is positive, ...
Vladimir V. Kisil [Mon, 29 Jul 2013 16:25:25 +0000 (17:25 +0100)]
improve mul::info(): the product of two negative terms is positive, ...

... and the product of a positive and non-negative terms is non-negative.

6 years agoFix build from git repository.
Richard Kreckel [Wed, 31 Jul 2013 21:33:44 +0000 (21:33 +0000)]
Fix build from git repository.

To make automake aware of lex and yacc files, they must be renamed.

6 years agoAdd support for Texinfo-5.0.
Richard Kreckel [Wed, 31 Jul 2013 20:42:16 +0000 (20:42 +0000)]
Add support for Texinfo-5.0.

Recent versions of Texinfo complained about misplaced @subsection.
Change them into @appendixsection.

6 years agoShut up recent texinfo warning.
Richard Kreckel [Tue, 30 Jul 2013 18:19:49 +0000 (18:19 +0000)]
Shut up recent texinfo warning.

It seems like dircategory has to come before the first node.

6 years agoShut up recent automake warning.
Richard Kreckel [Mon, 29 Jul 2013 08:05:22 +0000 (08:05 +0000)]
Shut up recent automake warning.

'INCLUDES' was the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS').

6 years agoAdd the case of c1=-1 and c2>0 to the rewriting rule of exponents: (x^c1)^c2 -> x...
Vladimir V. Kisil [Sun, 28 Jul 2013 22:25:01 +0000 (23:25 +0100)]
Add the case of c1=-1 and c2>0 to the rewriting rule of exponents: (x^c1)^c2 -> x^(c1 * c2)

6 years ago[bugfix] factor_univariate(): handle polinomials over rationals (no segfaults any...
Alexei Sheplyakov [Sun, 28 Jul 2013 15:43:06 +0000 (18:43 +0300)]
[bugfix] factor_univariate(): handle polinomials over rationals (no segfaults any more).

6 years agoAdd symbol::set_TeX_name(string) member function.
Richard Kreckel [Wed, 23 Jan 2013 08:19:26 +0000 (09:19 +0100)]
Add symbol::set_TeX_name(string) member function.

This allows setting a symbol's TeX-name after construction.