Re: Rule-based integration

112 views
Skip to first unread message
Message has been deleted
Message has been deleted

clicl...@freenet.de

unread,
Jun 4, 2010, 10:23:25 PM6/4/10
to

Albert schrieb:
>
> I would like to announce the launch of the website
>
> www.apmaths.uwo.ca/RuleBasedMathematics
>
> It is dedicated to dedicated to demonstrating the numerous advantages
> of the rule-based approach to automating mathematics. In systems
> implemented using this approach, rules are expressed as elegant
> mathematical formulas, rather than embedded in conventional program
> code.
>
> As proof-of-concept, I have implemented an efficient and robust Rule-
> based Integrator, nicknamed Rubi. Not only can Rubi compute the
> antiderivative for a broad class of integrands, but the results are
> often significantly superior to those produced by the commercial
> computer algebra systems.
>
> The 1500 or so integration rules Rubi uses are freely available on the
> website in both human and machine readable form. Also available is a
> test suite of over 9400 integration problems developed in conjunction
> with the rules. After reviewing the homepage, I recommend clicking on
> "Highlights of the Indefinite Integration Test Results" for an eye-
> opening comparison of the rule-based integrator (Rubi) with
> Mathematica's and Maple's built-in integrators.
>
> Also if you have access to Mathematica 6 or better, there is a link
> near the bottom of the homepage to download Rubi so you can verify the
> results for yourself. Rubi also provides the option to show the rules
> required to integrate expressions, along with the intermediate
> results. I think this show-step ability has great potential
> pedagogical and research value.
>
> Currently the website is pretty Spartan in format, and limited to
> indefinite integration. However with the help of the computer algebra
> community, I hope it evolves into a true repository of mathematical
> knowledge.
>

Thanks for your announcement. I have a few questions and comments:

1500 rules for indefinite integration amount to 2.5 times the number
implemented in Derive 6.10. A large part of the new rules probably
involve special functions unknown to the Derive kernel, like exponential
integrals, sine and cosine integrals, Fresnel integrals, the Lambert W
function, elliptic integrals, polylogarithms, incomplete gamma
functions, and perhaps even general hypergeometric functions. But there
seem to be additions in the original Derive area of elementary functions
as well (Derive 6.10 knows about ERF, DIGAMMA, DILOG, and Hurwitz ZETA
only).

Does this imply that Rubi can do more elementary antiderivatives than
Derive 6.10 can? That would require that the Rubi tries about as many
integrand transformations, including various substitutions, partial
fraction decomposition and integration by parts, as Derive 6.10 does.
For example, Derive succeeds on INT(x*(x^2+3)/(2*a^2+b^2*(x^2+1))^
(5/2)*LN((SQRT(2)*x*SQRT(2*a^2+b^2*(x^2+1))-2*x*a+b*(x^2+1))/x),x), but
the task is obviously hard - and Derive's answer is characteristically
incomplete. Does Rubi do better on this one?

Derive 6.10 can do INT(1/SQRT(1-a*x),x), of course, but produces an
incorrect result for the equivalent INT((LN(a*x-1)-2*LN(-SQRT(a*x-1)))/
(2*pi*SQRT(a*x-1)),x), as a graphic comparison of the antiderivatives
will show. Has this bug been repaired in Rubi?

In my feeling, the choice to base Rubi on Mathematica may seriously
impede a pedagogical mission. What capabilities of MMA are actually used
in the implementation of Rubi? How many man-years would it take to move
Rubi to a freely available programming language like LISP or Python?

Martin.

Message has been deleted

clicl...@freenet.de

unread,
Jun 7, 2010, 2:01:00 AM6/7/10
to

Albert schrieb:
>
> [...]
>
> Rubi is unable to integrate
>
> x*(x^2+3)/
> (2*a^2+b^2*(x^2+1))^(5/2)*log((sqrt(2)*x*sqrt(2*a^2+b^2*(x^2+1))-2*x*a
> +b*(x^2+1))/x)
>
> and Mathematica returns a huge, multipage result...
>

I wonder why Rubi fails here. Integration by parts produces an algebraic
integrand containing SQRT(b^2*x^2 + 2*a^2 + b^2) and no other root.
Derive 6.10 discovers this route, but then does not fully succeed on the
algebraic problem. Yet this algebraic integral would obviously yield to
one of Euler's substitutions, for example. In particular, Derive's
result contains the following three unevaluated integrals:

INT(SQRT(b^2*x^2+2*a^2+b^2)/(b^3*x^4+4*a*b^2*x^3+2*a^2*b*x^2+4*a~
*x*(2*a^2+b^2)-b*(2*a^2+b^2)),x)

INT(SQRT(b^2*x^2+2*a^2+b^2)/(b^3*x^6+4*a*b^2*x^5+b*x^4*(2*a^2+b^~
2)+8*a*x^3*(a^2+b^2)-b^3*x^2+4*a*x*(2*a^2+b^2)-b*(2*a^2+b^2)),x)

INT(x/((b^2*x^2+2*a^2+b^2)*((b*x^2-2*a*x+b)*SQRT(b^2*x^2+2*a^2+b~
^2)+SQRT(2)*b^2*x^3+SQRT(2)*x*(2*a^2+b^2))),x)

However, Derive can evaluate these too, once they are rewritten as:

INT(SQRT(b^2*x^2+2*a^2+b^2)*(-a*b^2*x/((9*a^4+6*a^2*b^2+b^4)*(b^~
2*x^2+2*a^2+b^2))-b*(a^2+b^2)/(2*(9*a^4+6*a^2*b^2+b^4)*(b^2*x^2+~
2*a^2+b^2))+a*b*x/((9*a^4+6*a^2*b^2+b^4)*(b*x^2+4*a*x-b))+(9*a^2~
+b^2)/(2*(9*a^4+6*a^2*b^2+b^4)*(b*x^2+4*a*x-b))),x)

INT(SQRT(b^2*x^2+2*a^2+b^2)*(b^4*x/(2*a*(9*a^4+6*a^2*b^2+b^4)*(b~
^2*x^2+2*a^2+b^2))+b^3*(a^2+b^2)/(4*a^2*(9*a^4+6*a^2*b^2+b^4)*(b~
^2*x^2+2*a^2+b^2))+a*b*x*(9*a^2+2*b^2)/(2*(4*a^2+b^2)*(9*a^4+6*a~
^2*b^2+b^4)*(b*x^2+4*a*x-b))+(72*a^4+21*a^2*b^2+b^4)/(4*(4*a^2+b~
^2)*(9*a^4+6*a^2*b^2+b^4)*(b*x^2+4*a*x-b))-x/(2*a*(x^2+1)*(4*a^2~
+b^2))-b/(4*a^2*(x^2+1)*(4*a^2+b^2))),x)

INT((SQRT(b^2*x^2+2*a^2+b^2)-SQRT(2)*x)*(b*x*(a^2+1)*(b^2-2)^2/(~
4*(2*a^2+b^2)*(a^4*(3*b^2-4)+a^2*b^4+b^2)*(x^2*(b^2-2)+2*a^2+b^2~
))+a*(b^2-2)^2/(4*(a^4*(3*b^2-4)+a^2*b^4+b^2)*(x^2*(b^2-2)+2*a^2~
+b^2))-b^3*x/(4*(2*a^2+b^2)*(3*a^2+b^2)*(b^2*x^2+2*a^2+b^2))-b^2~
/(4*a*(3*a^2+b^2)*(b^2*x^2+2*a^2+b^2))),x)+INT((SQRT(b^2*x^2+2*a~
^2+b^2)-SQRT(2)*x)*(b^2*x*(a^2-b^2+3)/(4*(3*a^2+b^2)*(a^4*(3*b^2~
-4)+a^2*b^4+b^2)*(b*x^2-2*a*x+b))+b*(2*a^2*(2*b^2-3)+b^2)/(4*a*(~
3*a^2+b^2)*(a^4*(3*b^2-4)+a^2*b^4+b^2)*(b*x^2-2*a*x+b))),x)

In the first two cases, the rational part has simply been expanded into
partial fractions. In the third case the denominator has been
rationalized, the rational part subsequently been expanded into partial
fractions, and the single integral then split into two. The latter step
seems to be necessary if you want Derive to evaluate the third integral
in reasonable time.

I conclude that, on Rubi too, work remains to be done in this area.

Martin.

Vladimir Bondarenko

unread,
Jun 9, 2010, 8:14:21 AM6/9/10
to
There is much to say about the Rubi.

One tiny example.

The VM machine says:

Mathematica 7.0.1.0 returns

Integrate[1/(Sqrt[2] + Sin[z] + Cos[z]), z]

unevaluated (!).

Rubi returns

-(2/(1 + (-1 + Sqrt[2]) Tan[z/2]))

which is a correct answer.


Best wishes,

Vladimir Bondarenko

VM and GEMM architect
Co-founder, CEO, Mathematical Director

http://www.cybertester.com/ Cyber Tester, LLC
http://maple.bug-list.org/ Maple Bugs Encyclopaedia
http://www.CAS-testing.org/ CAS Testing

-----------------------------------------------------

"We must understand that technologies
like these are the way of the future."

-----------------------------------------------------

> Aloha from Hawaii,
> Albert D. Rich

Message has been deleted

David Bernier

unread,
Jun 10, 2010, 3:31:15 AM6/10/10
to
Albert wrote:
>
> For most integrands of the form 1/(a+b*Sin[x]+c*Cos[x]) Mathematica
> can use the rule
>
> Integrate[1/(a+b*Sin[x]+c*Cos[x]), x] -->
> 2 ArcTan[(b+(a-c)*Tan[x/2])/Sqrt[a^2-b^2-c^2]] / Sqrt[a^2-b^2-c^2]
>
> Obviously this rule cannot be used when a^2-b^2-c^2 equals 0, which is
> probably the reason Mathematica 7 cannot integrate 1/(Sqrt[2]+Sin[x]
> +Cos[x]). But, interestingly Mathematica is able to integrate 1/
> (5+4*Sin[x]+3*Cos[x])...
>
> When a^2-b^2-c^2 equal 0, Rubi uses the rule
>
> Integrate[1/(a+b*Sin[x]+c*Cos[x]), x] --> -2/(b+(a-c)*Tan[x/2])
>
> which gives the simple answer Vladimir reports.

This is quite interesting.

Suppose we add real coefficients h and k for sin(2x)
and cos(2x) respectively.

Then, in the Mathematica notation, I arrive at this:

Integrate[1/(a+b*Sin[x]+c*Cos[x]+h*Sin[2x]+k*Cos[2x]), x]

Of course, there could be quite a few special cases here.

David Bernier

Peter Pein

unread,
Jun 12, 2010, 6:17:22 PM6/12/10
to

Hi Vladimir,
nice to read you again :-))

my solution involves "PetSie.nb" which can be found at
http://dl.dropbox.com/u/3030567/Mathematica/PetSie.nb
In[3]:= <<PetSie`
In[6]:=
Assuming[Pi>x>0,ChangeVar[Tan[z/2]==t,Integrate[1/(Sqrt[2]+Sin[z]+Cos[z]),{z,0,x}],t]]
Out[6]= (2 (-1+Sqrt[2])Sin[x/2])/(Cos[x/2]+(-1+Sqrt[2]) Sin[x/2])

there is a difference between the usage of a cas and simply asking a
cas.

Greetings, Peter


Am Wed, 9 Jun 2010 05:14:21
-0700 (PDT) schrieb Vladimir Bondarenko <v...@cybertester.com>:

jakubi

unread,
Jun 15, 2010, 11:19:00 PM6/15/10
to
On Jun 4, 12:18 am, Albert <Albert_R...@msn.com> wrote:
> I would like to announce the launch of the website
>
>    www.apmaths.uwo.ca/RuleBasedMathematics
>
> It is dedicated to dedicated to demonstrating the numerous advantages
> of the rule-based approach to automating mathematics.  In systems
> implemented using this approach, rules are expressed as elegant
> mathematical formulas, rather than embedded in conventional program
> code.
>[..]

>
> The 1500 or so integration rules Rubi uses are freely available on the
> website in both human and machine readable form.  

Very interesting. I wonder how have you checked that these O(10^3)
rules are mutually exclusive. And how would newly contributed rules be
checked against previous ones.

Regards, Alejandro Jakubi

Message has been deleted
Message has been deleted
Message has been deleted

clicl...@freenet.de

unread,
Jun 20, 2010, 11:47:43 AM6/20/10
to

Albert schrieb:
>
> [...]
>
> Mutual exclusivity of rules (or conversely missing rules) for
> integrands of a particular form can be determined by examining the
> application conditions on those rules. For example, the following is
> an excerpt of the rational function integration rules posted on the
> website:
>
> http://www.apmaths.uwo.ca/~arich/RuleRepository/MathematicalNotation/x^m(a+bx)^nRules.pdf
>
> It shows 7 rules required to integrate expressions of the form x^m (a
> +b x)^n, where m and n are integers. Their mutual exclusivity can be
> verified by examining the application conditions given before each
> rule. Polynomial expansion or partial fraction expansion is used to
> expand those integrands for which none of these 7 rules apply. For
> example, x^4/(a+b x)^10 is expanded using pfe.
>

So there are two kinds of rules: "ordinary" rules where mutual
exclusivity is desirable (otherwise the result would depend on the order
of application by the pattern matcher), and "super" rules that recast
the problem when the pattern matcher has failed to find a match. Then
the ordinary rules are traversed again, and perhaps this cycle is
iterated with the same or a different super rule. I suppose
trigonometric transformations and (very importantly) integration by
parts are also included among the super rules.

If not included already, I propose to add the rationalization of
algebraic denominators to this group, where integrands of the type
C(x)/(A(x)*SQRT(F(x))+B(x)*SQRT(G(x))) are replaced by
C(x)*(A(x)*SQRT(F(x))-B(x)*SQRT(G(x))) / (A(x)^2*F(x)-B(x)^2*G(x)). The
fairly common functions C(x)/P(x,SQRT(F(x))), where P(x,y) is a
polynomial in two variables, represent just a special case of this (with
G(x)=1).

Here is a small gallery of fairly simple algebraic integrands on which I
have found Derive 6.10 to fail (as in an earlier example, more or less
obvious transformations on part of the operator help it succeed though):

INT(1/(SQRT(x^2+1)+2*x)^2,x)

INT(1/(SQRT(x^2-1)*(3*x^2-4)^2),x)

INT(1/(2*SQRT(x)+SQRT(x+1))^2,x)

INT(SQRT(x^2-1)/(x-#i)^2,x)

INT(1/(SQRT(x^2-1)*(x^2+1)^2),x)

INT(1/(SQRT(x-1)*(SQRT(x-1)+2*SQRT(x))^2),x)

INT(1/(SQRT(x^2-1)*(SQRT(x^2-1)+SQRT(x))^2),x)

INT(SQRT(SQRT(x^4+1)+x^2)/((x+1)^2*SQRT(x^4+1)),x)

INT(((x-1)^(3/2)+(x+1)^(3/2))/((x+1)^(3/2)*(x-1)^(3/2)),x)

Martin.

Richard Fateman

unread,
Jun 20, 2010, 2:30:37 PM6/20/10
to
At some point this technology overlaps with conventional programming.

If you use a program that looks like this:

toplevel(integrand, var) :=

repeat until no more changes {


if match(super_pattern1,integrand,var)
then
integrand := apply(super-rhs1, run_some_algorithm(integrand), var);
else
if match(.....)

}

If the run_some_algorithm includes much of the traditional computer
algebra repertoire, it is not surprising that the integration
program would be at least as successful. An important but tricky
optimization is ordering the matching so that no time is wasted
on rules that cannot possibly match.

An advantage of the rule-based approach is that it is possible,
though not necessarily as easy as it might seem, to insert an
"optimal patch". This would be a rule that adds a new capability, but
does it in such a way as to interfere with nothing else. And to not
slow down anything else. Finding a place to put an optimal patch
in a conventional program requires tracking down where some critical
decision is made and putting in an extra test.

Ordering the rules automatically so that all possibly applicable rules
are tried, and the ruleset converges, are challenges.

There was period during which people wrote rule-based expert
systems (and meta-systems), and tried various things to keep correctness
and cost under control as the systems were scaled up in size.
(1980's?) I think people had enough bad experiences to sour them
on "Artificial Intelligence" for a few decades.

Nevertheless, if Albert's stuff works, there is no arguing with
success!

RJF

Axel Vogt

unread,
Jun 20, 2010, 2:36:05 PM6/20/10
to
clicl...@freenet.de wrote:
> Albert schrieb:
...
> Here is a small gallery of fairly simple algebraic integrands on which I
> have found Derive 6.10 to fail (as in an earlier example, more or less
> obvious transformations on part of the operator help it succeed though):
>
> INT(1/(SQRT(x^2+1)+2*x)^2,x)
>
> INT(1/(SQRT(x^2-1)*(3*x^2-4)^2),x)
>
> INT(1/(2*SQRT(x)+SQRT(x+1))^2,x)
>
> INT(SQRT(x^2-1)/(x-#i)^2,x)
>
> INT(1/(SQRT(x^2-1)*(x^2+1)^2),x)
>
> INT(1/(SQRT(x-1)*(SQRT(x-1)+2*SQRT(x))^2),x)
>
> INT(1/(SQRT(x^2-1)*(SQRT(x^2-1)+SQRT(x))^2),x)
>
> INT(SQRT(SQRT(x^4+1)+x^2)/((x+1)^2*SQRT(x^4+1)),x)
>
> INT(((x-1)^(3/2)+(x+1)^(3/2))/((x+1)^(3/2)*(x-1)^(3/2)),x)
>
> Martin.

Side remark: Maple 12 finds them directly, except the one
before the last (though I neither checked the answers nor
want to / can to judge the 'simplicity' of the results).

Nasser M. Abbasi

unread,
Jun 20, 2010, 3:56:40 PM6/20/10
to

That is good.

I just did a quick test on the above 9 integrations posted by Martin,
using Mathematica 7 and Rubi, and numbers 7 and 8 in the list did not
evaluate.

To compare the result from Matematica and Rubi, I cheated, I just
plotted the difference over some range, and in all cases I get a zero
plot. So numerically the result is the same. Not the best way to check
equivalence of the 2 analytical results, but a quick and dirty way for now.

If someone wants to see the output, here is a link

http://12000.org/my_notes/rubiTest/rubi_1/rubi.html

and the notebook is here

http://12000.org/my_notes/rubiTest/rubi_1/rubi.nb

--Nasser

clicl...@freenet.de

unread,
Jun 20, 2010, 4:40:00 PM6/20/10
to

"Nasser M. Abbasi" schrieb:

> On 6/20/2010 11:36 AM, Axel Vogt wrote:
> > clicl...@freenet.de wrote:
> >>
> >> Here is a small gallery of fairly simple algebraic integrands on which I
> >> have found Derive 6.10 to fail (as in an earlier example, more or less
> >> obvious transformations on part of the operator help it succeed though):
> >>
> >> INT(1/(SQRT(x^2+1)+2*x)^2,x)
> >>
> >> INT(1/(SQRT(x^2-1)*(3*x^2-4)^2),x)
> >>
> >> INT(1/(2*SQRT(x)+SQRT(x+1))^2,x)
> >>
> >> INT(SQRT(x^2-1)/(x-#i)^2,x)
> >>
> >> INT(1/(SQRT(x^2-1)*(x^2+1)^2),x)
> >>
> >> INT(1/(SQRT(x-1)*(SQRT(x-1)+2*SQRT(x))^2),x)
> >>
> >> INT(1/(SQRT(x^2-1)*(SQRT(x^2-1)+SQRT(x))^2),x)
> >>
> >> INT(SQRT(SQRT(x^4+1)+x^2)/((x+1)^2*SQRT(x^4+1)),x)
> >>
> >> INT(((x-1)^(3/2)+(x+1)^(3/2))/((x+1)^(3/2)*(x-1)^(3/2)),x)
> >>
> >
> > Side remark: Maple 12 finds them directly, except the one
> > before the last (though I neither checked the answers nor
> > want to / can to judge the 'simplicity' of the results).
>
> That is good.
>
> I just did a quick test on the above 9 integrations posted by Martin,
> using Mathematica 7 and Rubi, and numbers 7 and 8 in the list did not
> evaluate.
>
> To compare the result from Matematica and Rubi, I cheated, I just
> plotted the difference over some range, and in all cases I get a zero
> plot. So numerically the result is the same. Not the best way to check
> equivalence of the 2 analytical results, but a quick and dirty way for now.
>
> If someone wants to see the output, here is a link
>
> http://12000.org/my_notes/rubiTest/rubi_1/rubi.html
>
> and the notebook is here
>
> http://12000.org/my_notes/rubiTest/rubi_1/rubi.nb
>

In the case of MMA the effect is called "Risch integration (not fully
implemented)". Could someone perhaps try them on Maxima and on FriCAS
too?

Martin.

Message has been deleted

clicl...@freenet.de

unread,
Jun 21, 2010, 12:58:43 PM6/21/10
to

Albert schrieb:
>
> Maple 13 is able to simplify to 0 the integrand minus the derivative
> of the huge antiderivative it returns for problem 7 in Martin's list.
> So Maple beats Mathematica 7 and Rubi on this problem! However, I
> would be willing to bet there is a much simpler antiderivative...
>
> However, none of these systems can integrate problem 8. Therefore it
> seems to me the challenger (i.e. Martin) is now obligated to provide
> us with a closed-form antiderivative...
>

I do accept this obligation. But note that the performance statistics
for the venerable Lady Maxima and for the renowned Sir Axiom, also
performing under the alias of FriCAS, are not yet in. In fact, I expect
the latter to be able to relieve me from my obligation. Hence only this
much for now: compact (though not optimized) forms of the
antiderivatives 7 and 8 are roughly 350 and 500 Bytes in size.

I realize that the advance that Rubi represents over Derive 6.10 is
truly substantial!

Martin.

Waldek Hebisch

unread,
Jun 21, 2010, 2:24:28 PM6/21/10
to
clicl...@freenet.de wrote:
>
> "Nasser M. Abbasi" schrieb:
> > On 6/20/2010 11:36 AM, Axel Vogt wrote:
> > > clicl...@freenet.de wrote:
> > >>
> > >> Here is a small gallery of fairly simple algebraic integrands on which I
> > >> have found Derive 6.10 to fail (as in an earlier example, more or less
> > >> obvious transformations on part of the operator help it succeed though):
> > >>
> > >> INT(1/(SQRT(x^2+1)+2*x)^2,x)
> > >>
> > >> INT(1/(SQRT(x^2-1)*(3*x^2-4)^2),x)
> > >>
> > >> INT(1/(2*SQRT(x)+SQRT(x+1))^2,x)
> > >>
> > >> INT(SQRT(x^2-1)/(x-#i)^2,x)
> > >>
> > >> INT(1/(SQRT(x^2-1)*(x^2+1)^2),x)
> > >>
> > >> INT(1/(SQRT(x-1)*(SQRT(x-1)+2*SQRT(x))^2),x)
> > >>
> > >> INT(1/(SQRT(x^2-1)*(SQRT(x^2-1)+SQRT(x))^2),x)
> > >>
> > >> INT(SQRT(SQRT(x^4+1)+x^2)/((x+1)^2*SQRT(x^4+1)),x)
> > >>
> > >> INT(((x-1)^(3/2)+(x+1)^(3/2))/((x+1)^(3/2)*(x-1)^(3/2)),x)
> > >>
> > >
> > > Side remark: Maple 12 finds them directly, except the one
> > > before the last (though I neither checked the answers nor
> > > want to / can to judge the 'simplicity' of the results).
> >
> > That is good.
> >
> > I just did a quick test on the above 9 integrations posted by Martin,
> > using Mathematica 7 and Rubi, and numbers 7 and 8 in the list did not
> > evaluate.
> >
>
> In the case of MMA the effect is called "Risch integration (not fully
> implemented)". Could someone perhaps try them on Maxima and on FriCAS
> too?
>

1-5 and 9 evaluate quickly (I did not check correctness). 6, 7, 8
are slow. In my experience integrals like 6 and 7 worked but
needed a lot of time (days or weeks). I left nr 8 running, will
report about result.

--
Waldek Hebisch
heb...@math.uni.wroc.pl

Axel Vogt

unread,
Jun 21, 2010, 2:26:17 PM6/21/10
to
problem 8:

((x^4+1)^(1/2)+x^2)^(1/2)/(x+1)^2/(x^4+1)^(1/2) =

1/2*2^(1/2)/(x+1)^2/(x^2+I)^(1/2) +
1/2*2^(1/2)/(x+1)^2/(x^2-I)^(1/2)

and for that Maple finds anti-derivatives (though they
lengthy and involve ln and sqrt, but they are real and
obey the problem in x=-1 and can be simplified):

((-1-I)*(2*x^2-2*I)^(1/2)+(-1+I)*(2*x^2+2*I)^(1/2)+
(-I*(1-I)^(1/2)*ln((-2*I-2*x+2*(1-I)^(1/2)*(x^2-I)^(1/2))/
(x+1))+I*(1+I)^(1/2)*ln((2*I-2*x+2*(1+I)^(1/2)*
(x^2+I)^(1/2))/(x+1)))*(x+1)*2^(1/2))/(4*x+4)

I did cross checking by differentiation against the task
only by plotting or a (finite) Taylor series (seems some
work is needed to convince Maple to proof it).

Message has been deleted

Axel Vogt

unread,
Jun 21, 2010, 4:10:13 PM6/21/10
to
Albert wrote:

> On Jun 21, 8:26 am, Axel Vogt <&nore...@axelvogt.de> wrote:
>
>> problem 8:
>>
>> ((x^4+1)^(1/2)+x^2)^(1/2)/(x+1)^2/(x^4+1)^(1/2) =
>>
>> 1/2*2^(1/2)/(x+1)^2/(x^2+I)^(1/2) +
>> 1/2*2^(1/2)/(x+1)^2/(x^2-I)^(1/2)
>
> Rubi easily finds relatively simple antiderivatives for these two
> terms. Unfortunately, however, the above identity is not valid for
> all x. For example, when x=1+2*I, the left and rights sides evaluate
> to 0.00779279 - 0.00161297 I and -0.0714979 - 0.0344563 I,
> respectively.

Agreed, there is a brunch cut problem (term1 - term2 would be
correct, but I do not want to correct it by paper and pencil).

Fine, if your system finds it without pain!

Message has been deleted

Vladimir Bondarenko

unread,
Jun 23, 2010, 5:04:18 AM6/23/10
to
A simple case. Derive 6.10 cracks INT(TAN(z)/(SIN(2*z)+COS(2*z)^2),
z)
while Rubi fails to handle Tan[z]/(Sin[2 z] + Cos[2 z]^2)...

I wonder how the Derive 6.10 and Rubi indefinite integrators compare
on
the elementary function integrands?

Do you expect with Rubi to surpass the Derive 6.10 indefinite
integration
facility?

Do you expect to reinforce the Rubi so it would be stronger in
indefinite
integration than the Mathematica 7 integrator?

On Jun 4, 6:18 am, Albert <Albert_R...@msn.com> wrote:
> I would like to announce the launch of the website
>
>    www.apmaths.uwo.ca/RuleBasedMathematics
>
> It is dedicated to dedicated to demonstrating the numerous advantages
> of the rule-based approach to automating mathematics.  In systems
> implemented using this approach, rules are expressed as elegant
> mathematical formulas, rather than embedded in conventional program
> code.
>

> As proof-of-concept, I have implemented an efficient and robust Rule-
> based Integrator, nicknamed Rubi.  Not only can Rubi compute the
> antiderivative for a broad class of integrands, but the results are
> often significantly superior to those produced by the commercial
> computer algebra systems.
>

> The 1500 or so integration rules Rubi uses are freely available on the

Message has been deleted

Daniel Lichtblau

unread,
Jun 23, 2010, 6:26:22 PM6/23/10
to
Can be done by finding "simple" quadratics used in zeros of the denominator, and using them as an algebraic extension for factoring the expression.

In[12]:= expr = y(y^2+1)/(y^4+2y^3-2y^2+2y+1);

In[13]:= solns = y /. Solve[Denominator[expr]==0, y];

In[14]:= quadratics = Union[Cases[solns, Power[_Integer,1/2], Infinity]];

In[15]:= InputForm[Apart[Factor[expr, Extension->quadratics]]]
Out[15]//InputForm=
((-1 + Sqrt[5])*y)/(2*Sqrt[5]*(1 + y - Sqrt[5]*y + y^2)) +
((1 + Sqrt[5])*y)/(2*Sqrt[5]*(1 + y + Sqrt[5]*y + y^2))

Daniel Lichtblau
Wolfram Research

Message has been deleted
Message has been deleted

clicl...@freenet.de

unread,
Jun 25, 2010, 10:57:37 AM6/25/10
to

Axel Vogt schrieb:

Your transformation is valid for Re(x^2) > 0, and so your result will be
valid in this region (which includes the positive and negative real
axis); but because the transformation is invalid outside this region, so
should be your result.

However, there is a indeed a clean way of splitting the factor
SQRT(SQRT(x^4+1) + x^2) / (SQRT(x^4+1)) in the integrand, namely as
1/SQRT(2) (SQRT(#i)/SQRT(1 + #i*x^2) + SQRT(-#i)/SQRT(1 - #i*x^2)).
Subsequent integration by Rubi, Maple, or Mathematica should be no
problem. But can the systems be instructed to remove the imaginary units
from the antiderivative? Can Maple and Mathematica verify the result for
the entire complex plane?

This complex splitting method of solving integral no 8 is simple and
elegant; I therefore propose to include the most general version of the
transformation that can be worked out and all possible variants of it
(such as the case resulting for x = #i*y) with Rubi's set of integration
rules.

Martin.

Axel Vogt

unread,
Jun 25, 2010, 3:22:47 PM6/25/10
to
...
>

Aha, one has to care only for the radicals and uses 1/(x+1)^2 later
(and then Maple finds an antiderivative).

I could not convince Maple to proof your identity A=B directly
(where I assume there is a multiplication after 1/SQRT(2), yes?).

# translate Derive to Maple notation, saves typing ...

"SQRT(SQRT(x^4+1) + x^2) / (SQRT(x^4+1)) = 1/SQRT(2) *
(SQRT(#i)/SQRT(1 + #i*x^2) + SQRT(-#i)/SQRT(1 - #i*x^2))";
StringTools[SubstituteAll]( %, "INT", "Int" ):
StringTools[SubstituteAll]( %, "SQRT", "sqrt" ):
StringTools[SubstituteAll]( %, "#i", "I" ):
A,B:=lhs(%), rhs(%);

Now

(A/B); # this should be 1, we only take the square
simplify(%): simplify(%, size); # simplify it
%^2;

numer(%) - denom(%); # should be 0
expand(%):
C:=combine(%): # simplified, show C=0
RootOf(%, x); # solve this algebraic equation
[allvalues(%)]; # and show all solutions

(1/4)
[_X, -I (-1) ]

This says: _any_ x is a solution. And the second value as well.
(if one trusts the system ...).

Both MultiSeries:-limit(A/B, x=-I*(-1)^(1/4), complex)
and MultiSeries:-limit(C, x=-I*(-1)^(1/4), complex) give
what the should give (1 and 0).

Now I am too lazy to care for +-1 = sqrt(1) ...

Axel Vogt

unread,
Jun 25, 2010, 3:51:32 PM6/25/10
to
clicl...@freenet.de wrote:
> Axel Vogt schrieb:
>> problem 8:
...

> Your transformation is valid for Re(x^2) > 0, and so your result will be
> valid in this region (which includes the positive and negative real
> axis); but because the transformation is invalid outside this region, so
> should be your result.
>
> However, there is a indeed a clean way of splitting the factor
...

> This complex splitting method of solving integral no 8 is simple and
> elegant; I therefore propose to include the most general version of the
> transformation that can be worked out and all possible variants of it
> (such as the case resulting for x = #i*y) with Rubi's set of integration
> rules.

I think I should sketch (in a _polished_ way) how one can come across
it (since just looking at the (corrected) result does not give it),
may be it is a kind of recipe as well.

The integrand is algebraic and univariate, hence it satisfies a DE
with polynomial coefficients (have no reference).

In that case (a standard attack with 'dpolyform' fails) one can use
the package 'gfun' to find first a polynomial equation, which is
satisfied by the integrand by 'algfuntoalgeq').

In a second step the package has 'algeqtodiffeq' to give the DE for
the problem and 'dsolve' two linear independent solutions; they do
involve integrand(0) and the 2nd derivative of it in 0.

I got my coefficients by trusting that and using the known values
for that (hence there might be a bug in the used routines).


However it is *much* more simple to try a splitting method directly,
if having that in mind. Just thought it might be worth to sketch a
way, how to get a different view on such integrands.

Message has been deleted

clicl...@freenet.de

unread,
Jun 26, 2010, 12:31:16 PM6/26/10
to

Albert schrieb:
>
> [...]
>
> The Rubi result differentiates back to the expanded form of the
> original integrand. So it is a valid antiderivative for problem 7,
> assuming your expansion is valid for all real and complex x. It
> satisfies all numerical tests I have run, but I am unable to get
> Mathematica to symbolically confirm it. You wrote

>
> > This complex splitting method of solving integral no 8 is simple and
> > elegant; I therefore propose to include the most general version of the
> > transformation that can be worked out and all possible variants of it
> > (such as the case resulting for x = #i*y) with Rubi's set of integration
> > rules.
>
> Please describe the "simple and elegant" procedure for deriving such
> expansion identities, preferably in the form of transformation rules
> like those posted on the rule-based integration website. Then they
> can be directly incorporated into Rubi.
>

Some clarifications first: I was not aware that this kind of splitting
is possible until I saw the post by Axel Vogt. As Axel explained, he
discovered (a somewhat incorrect version of) the formula by deriving and
solving a differential equation for the entire integrand using Maple.
When you pointed out the branch-cut problem with his transformation, my
intuition told me that a correct version should exist; the problem thus
remained on my mind until three days later (while awaking in the
morning) I "saw" the necessary correction, and later that day confirmed
it graphically and posted it here. I also used it to integrate problem 8
on Derive 6.10, and (with some massaging) obtained the simple
antiderivative:

INT(SQRT(SQRT(x^4+1)+x^2)/((x+1)^2*SQRT(x^4+1)),x)

(LN(-SQRT(#i-1)*SQRT(1-#i*x^2)-x+#i)/(2*SQRT(#i-1))+LN(-SQRT(-#i~
-1)*SQRT(1+#i*x^2)-x-#i)/(2*SQRT(-#i-1)))-SQRT(SQRT(2)-1)*LN(x+1~
)/2-SQRT(SQRT(x^4+1)+1)/(SQRT(2)*(x+1))

As regards a manual derivation of the splitting relation, I can only
offer what you are probably aware of already:

SQRT(SQRT(1+x^4) + x^2) / SQRT(1+x^4)

SQRT(SQRT((1 - #i*x^2)*(1 + #i*x^2)) + x^2) /
SQRT((1 + #i*x^2)*(1 - #i*x^2))

SQRT(SQRT(1 - #i*x^2)*SQRT(1 + #i*x^2) + x^2) /
(SQRT(1 + #i*x^2) * SQRT(1 - #i*x^2))

SQRT(#i*(1 - #i*x^2) + 2*#i*SQRT(1 - #i*x^2)*(-#i)*SQRT(1 + #i*x^2) +
(-#i)*(1 + #i*x^2)) / (SQRT(2) * SQRT(1 + #i*x^2) * SQRT(1 - #i*x^2))

(SQRT(#i)*SQRT(1 - #i*x^2) + SQRT(-#i)*SQRT(1 + #i*x^2)) /
(SQRT(2) * SQRT(1 + #i*x^2) * SQRT(1 - #i*x^2))

1/SQRT(2) * (SQRT(#i)/SQRT(1 + #i*x^2) + SQRT(-#i)/SQRT(1 - #i*x^2))

I am in doubt whether this derivation should be called "simple and
elegant"; the validity of the numerator transformation may not be
obvious to many.

As regards possible generalizations needed for a good Rubi rule, I
suspect that SQRT(1+x^4) and SQRT(1 +- #i*x^2) in the formula can be
replaced by SQRT(a+x^4) and SQRT(SQRT(a) +- #i*x^2), respectively, where
RE(a) must probably be > 0 or perhaps only >= 0 (as I haven't looked
into this, the range of values actually allowed in the complex plane may
also be a smaller "wedge" only). For pattern matching, x should
presumably be generalized to b*x+c. I don't know if a separate rule
based on SQRT(SQRT(1+x^4) - x^2) / SQRT(1+x^4) = 1/SQRT(2) *
(SQRT(-#i)/SQRT(1 + #i*x^2) + SQRT(#i)/SQRT(1 - #i*x^2)) would still be
needed then; this variant is obtained upon replacing x by #i*x.

Martin.

Message has been deleted

Axel Vogt

unread,
Jun 27, 2010, 3:32:35 PM6/27/10
to
Albert wrote:

> On Jun 26, 6:31 am, cliclic...@freenet.de wrote:
>
>> I am in doubt whether this derivation should be called "simple and
>> elegant"; the validity of the numerator transformation may not be
>> obvious to many.
>
> An audacious derivation of which Euler would be proud! As you
> suggested, I generalized your identity to
>
> sqrt(z+sqrt(a+z^2))/sqrt(a+z^2) =
> sqrt(-I)/(sqrt(2)*sqrt(sqrt(a)-I*z)) +
> sqrt(I)/(sqrt(2)*sqrt(sqrt(a)+I*z))
>
> which appears to be valid for all z provided a>0. Its derivation
> tracks yours as follows
...
But that follows from special case a=1 if one uses x=z/sqrt(a)
and then multiplies the identity by (sqrt(a))^2, since for 0<a
one has sqrt(a)*sqrt(w) = sqrt(a*w), no?

> sqrt(a+z^2) = sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z)
> which is valid for all z provided a>0.
...
Just for the records (as you certainly do not have the 'obvious
and false proof' in mind): sqrt(1-x)*sqrt(1+x)=sqrt(1-x^2) is
shown in Davenport & Corless, Reasoning about the Elementary
Functions of Complex Analysis (2000). Now using z=x/sqrt(a)*I
and multiplying by a gives it (Maple does not know that, it
even states it as false for a=1).
...
> Aloha,
> Albert

Another way to look at these identities is 'denesting radicals'
(as you did with Jeffrey in 'Simplifying square roots of square
roots by denesting').


Is there a way to make use of Rubi's abilities calling it from
Maple?

Message has been deleted

Nasser M. Abbasi

unread,
Jun 29, 2010, 12:38:08 AM6/29/10
to
On 6/20/2010 12:56 PM, Nasser M. Abbasi wrote:

>
> If someone wants to see the output, here is a link
>
> http://12000.org/my_notes/rubiTest/rubi_1/rubi.html
>

fyi,

I added Maple 14 output to the above. The link to Maple output is
contained in the above, near the top.

Maple 14 did them all, except for Martin's number 8 problem.

--Nasser

Message has been deleted

Vladimir Bondarenko

unread,
Jun 30, 2010, 12:45:18 AM6/30/10
to
Hello Albert,

The Cyber Tester's team is interested in improvements along
the direction you offer, rule-based approach to automating
mathematics.

As you know, we do not test software ourselves; instead, this
work is done by our VM machine.

It is important to learn how much we could help you and the
community in reinforcing Rubi as the very first step of your
project.

To know this, it would be nice and fair to learn, before we
start presenting the results by the VM machine,

1) how much time have you spent writing the Rubi?
2) how much time you and your beta testers spent for QA?
3) is there a list of known bugs in the Rubi?

About the time, ANY estimation however approximate is good.

Best wishes from algorithmic Simferopol,

Vladimir

Message has been deleted

clicl...@freenet.de

unread,
Jul 1, 2010, 8:12:29 AM7/1/10
to

Albert schrieb:

>
> On Jun 26, 6:31 am, cliclic...@freenet.de wrote:
>
> > I am in doubt whether this derivation should be called "simple and
> > elegant"; the validity of the numerator transformation may not be
> > obvious to many.
>
> An audacious derivation of which Euler would be proud! As you
> suggested, I generalized your identity to
>
> sqrt(z+sqrt(a+z^2))/sqrt(a+z^2) =
> sqrt(-I)/(sqrt(2)*sqrt(sqrt(a)-I*z)) +
> sqrt(I)/(sqrt(2)*sqrt(sqrt(a)+I*z))
>
> which appears to be valid for all z provided a>0. Its derivation
> tracks yours as follows
>
> 1) sqrt(z+sqrt(a+z^2))/sqrt(a+z^2)
>
> 2) sqrt(z+sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))/
> (sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))
>
> 3) sqrt(2*z+2*sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))/
> (sqrt(2)*sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))
>
> 4) sqrt(-I*(sqrt(a)+I*z) +
> 2*sqrt(-I)*sqrt(sqrt(a)+I*z)*sqrt(I)*sqrt(sqrt(a)-I*z) +
> I*(sqrt(a)-I*z))/
> (sqrt(2)*sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))
>
> 5) sqrt((sqrt(-I)*sqrt(sqrt(a)+I*z) + sqrt(I)*sqrt(sqrt(a)-I*z))^2)/
> (sqrt(2)*sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))
>
> 6) (sqrt(-I)*sqrt(sqrt(a)+I*z) + sqrt(I)*sqrt(sqrt(a)-I*z))/
> (sqrt(2)*sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z))
>
> 7) sqrt(-I)/(sqrt(2)*sqrt(sqrt(a)-I*z)) +
> sqrt(I)/(sqrt(2)*sqrt(sqrt(a)+I*z))
>
> Expression 2) above is based on the identity
>
> sqrt(a+z^2) = sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z)
>
> which is valid for all z provided a>0. The only questionable step
> above is from 5) to 6). It assumes sqrt(u^2) equals u, which is only
> true if the real part of u is positive. So without loss of
> generality, all that remains to be proved is that the real part of
>
> sqrt(-I)*sqrt(1+I*z) + sqrt(I)*sqrt(1-I*z)
>
> is positive for all z. If any reader can prove it, please let me
> know.
>
> Substituting sqrt(b)*x^2 for z in the generalized identity above
> yields the special case
>
> sqrt(sqrt(b)*x^2+sqrt(a+b*x^4))/sqrt(a+b*x^4) =
> sqrt(-I)/(sqrt(2)*sqrt(sqrt(a)-I*sqrt(b)*x^2)) +
> sqrt(I)/(sqrt(2)*sqrt(sqrt(a)+I*sqrt(b)*x^2))
>
> which is valid provided a>0. Integrating both sides and translating
> it into Mathematica syntax yields the nice new rule
>
> Int[u_.*Sqrt[c_.*x_^2+Sqrt[a_.+b_.*x_^4]]/Sqrt[a_.+b_.*x_^4],x_] :=
> Sqrt[-I]/Sqrt[2]*Int[u/Sqrt[Sqrt[a]-I*c*x^2],x]] +
> Sqrt[ I]/Sqrt[2]*Int[u/Sqrt[Sqrt[a]+I*c*x^2],x]] /;
> FreeQ[{a,b,c},x] && Sqrt[b]===c && a>0
>
> So now Rubi is able to integrate Martin’s problem 8, and a lot more.
> For example,
>
> sqrt(2*x^2+sqrt(3+4*x^4))/((c+d*x)*sqrt(3+4*x^4))
>
> and
>
> sqrt(2*x^2+sqrt(3+4*x^4))/((c+d*x)^2*sqrt(3+4*x^4))
>
> This whole exercise has been typical of the way knowledge is added to
> a rule-based system, like Rubi: Generalizing the procedure required to
> solve a specific problem, yields a general rule able to handle a whole
> class of problems. I hope you have found it instructive.
>

Experiments of mine confirm that SQRT(a^2+z^2) = SQRT(a + #i*z) * SQRT(a
- #i*z) requires a > 0, and doesn't permit a larger domain. I think this
particular relation (in suitably generalized form) should be available
both ways, to help matching a given integrand to rules in Rubi's
collection. The same applies to SQRT(a^2-z^2) = SQRT(a+z) * SQRT(a-z),
provided this was indeed needed as a separate rule (where again a > 0).

It appears that Rubi's newly crafted rule involving the fourth power x^4
covers the case resulting for x <- #i*x automatically. But does it also
cover the simpler quadratic case for x^2 <- x and x^2 <- -x (unless
never needed), or that of arbitrary functions x^2 <- f(x) (unless
completely useless)? How about related root splitting or denesting
rules? Some candidate relations:

SQRT(SQRT(1+z^2) + 1) = (SQRT(1 + #i*z) + SQRT(1 - #i*z)) / SQRT(2)

1 / SQRT(SQRT(1+z^2) + 1) = (SQRT(1 + #i*z) - SQRT(1 - #i*z)) /
(SQRT(2)*#i*z)

SQRT(SQRT(1+z^2) - 1) = SQRT(z^2) (SQRT(1 + #i*z) - SQRT(1 - #i*z)) /
(SQRT(2)*#i*z)

1 / SQRT(SQRT(1+z^2) - 1) = (SQRT(1 + #i*z) + SQRT(1 - #i*z)) /
SQRT(2*z^2)

Needless to say, these can be generalized in similar ways (z <- x^2,
z <- #i*x, z <- #i*x^2, z <- SQRT(#i)*x, z <- SQRT(#i)*x^2, etc.).

Finally, wouldn't it be more profitable to concentrate on the (suitably
generalized) true root splitting (or denesting) step

SQRT(SQRT(1+z^2) + z) = 1 / SQRT(SQRT(1+z^2) - z) =
(SQRT(-#i)*SQRT(1 + #i*z) + SQRT(#i)*SQRT(1 - #i*z)) / SQRT(2),

as a new Rubi rule, and let everything else follow automatically via
other rules? But I haven't looked at your code.

Martin.

PS: If you want sci.math.symbolic readers to suggest new rules, it would
be helpful if your site could present the tests with unsatisfactory or
missing Rubi answers in a form readable without access to MMA (or
some MMA "player"). Or perhaps you could post a selection of the more
"promising" failures here?

PPS: I didn't know that the Risch integrator of Axiom (or FriCAS) was
this abysmally slow (it's been running for _ten_ days now). In 1984 (the
year of Trager's thesis), the code must have been near impossible to
debug even on a Cray!

Waldek Hebisch

unread,
Jul 1, 2010, 12:57:27 PM7/1/10
to
clicl...@freenet.de wrote:
>
> PPS: I didn't know that the Risch integrator of Axiom (or FriCAS) was
> this abysmally slow (it's been running for _ten_ days now). In 1984 (the
> year of Trager's thesis), the code must have been near impossible to
> debug even on a Cray!

Axiom code is mostly due to Manuel Bronstein in 1990-1994 (I do not
think is make much difference, in 1984 Axiom team should have access
to 30 MIPS mainframe (maybe better) and in 1994 Bronstein probably
had 30-100 MIPS workstation).

Actually, the Risch integrator itself runs reasonably fast. The
problem is arithmetic with expressions containing two square
roots. Risch integrator creates intermediate expressions which are
significantly larger than input expression -- not very large but
enough to make arithmetic very slow. I think that all routines
were debugged using single algebraics (in such case arithmetic is
reasonably fast).

BTW1: Arithmetic on algebraic expression can be done much faster
then currently in FriCAS. New routines are under developement.

BTW2: Currently Risch integrator makes some shortcuts for case
of roots (as opposed to general algebraics). But I think that
in case of two roots it is possible to make shortcut doing
only slightly more computatins as for single root, while
current code treats roots in sequence doing much more
expensive operations.

--
Waldek Hebisch
heb...@math.uni.wroc.pl

Message has been deleted

clicl...@freenet.de

unread,
Jul 1, 2010, 5:33:47 PM7/1/10
to

Albert schrieb:
>
> Is it your desire to have the Mathematica and Rubi test suite results
> expressed in a form readable without Mathematica? If so, I can also
> make them available as pdf files.
>

This is what I was getting at. These files are awfully hard to read
without access to Mathematica; even Euler would have despaired. Wide
dissemination of Rubi's failures could help increase feedback in the
form of suggestions, which might lead to improved rules.

Martin.

Message has been deleted
Message has been deleted

Nasser M. Abbasi

unread,
Jul 3, 2010, 3:18:14 AM7/3/10
to

Fyi;

I've added Sage 4.4.4 (downloaded on july 2,2010) result to the above
page (the link to Sage worksheet output can be found near the top of the
above page) it is an HTML page.

Sage did only integral #9.

I am not a Sage user, so may be someone with more Sage experience can
try some other tricks or commands to get a better result than what I
got. I used sage integral() command with no assumptions. Run sage from
inside VM machine on windows.

--Nasser

Message has been deleted

Nasser M. Abbasi

unread,
Jul 3, 2010, 4:22:26 AM7/3/10
to
On 7/3/2010 12:59 AM, Albert wrote:

> On Jul 2, 9:18 pm, "Nasser M. Abbasi"<n...@12000.org> wrote:
>
>> Sage did only integral #9.
>
> Perhaps Sage could take advantage of an open-source rule-based
> integrator...

Sage itself is open source, so adding open source code to it should not
be a problem.

For integration, using integral(), it seems to use Maxima interface
based on my reading of the top of this page:

http://www.sagemath.org/doc/constructions/calculus.html

>Does it support a pattern-matching programming language?
>
> Albert

Some pattern commands on expressions can be seen here:

http://www.sagemath.org/doc/reference/sage/symbolic/expression.html

Since sage is phython based, I also assume that any pattern matching
functionality in python or sympy can be used from within sage as well.

I know very little about sage, every once in a while I download the
latest version and play with it a little and that is all.

--Nasser


clicl...@freenet.de

unread,
Jul 3, 2010, 9:57:05 AM7/3/10
to

"Nasser M. Abbasi" schrieb:

>
> > On Jul 2, 9:18 pm, "Nasser M. Abbasi"<n...@12000.org> wrote:
> >
> >> Sage did only integral #9.
> >
>
> [...]

>
> For integration, using integral(), it seems to use Maxima interface
> based on my reading of the top of this page:
>
> http://www.sagemath.org/doc/constructions/calculus.html
>

That Maxima is used seems to follow from the output for problem #4 as
well:

#4 f=sqrt(x^2-1)/(x-I)^2 f.integral(x)
Traceback (click to the left of this block for traceback)
...
Is (I-1)*(I+1) zero or nonzero?

This kind of question to the operator is typical of the Maxima
integrator. Nobody will be surprised to learn that Derive 6.10
simplifies IDENTICAL?((#i-1)*(#i+1), 0) to FALSE automatically, no
questions asked. Perhaps your "I" was not really #i, the imaginary unit
- in spite of the definition at the top of your page?

Martin.

Richard Fateman

unread,
Jul 3, 2010, 10:41:43 AM7/3/10
to
clicl...@freenet.de wrote:

I too understand that Sage uses Maxima for integration, if so, if you
want to test integrals, you can just download and use Maxima.

Maxima uses %i for sqrt(-1), not I.
and (%i-1)*(%i+1) expands to -2, as expected.

And if you want to add rules to the integration procedure in Maxima,
you can do so using procedures or patterns in Maxima. There are
several pattern matchers, but the one that is only incompletely
accessible in Maxima is the one probably of most interest, which is the
one from MockMMA -- it looks like Mathematica's.

I think that Sage and Python are, in this case, merely a distraction.

You might try one of the Axiom variants, too.

As for the possibility of expressing integrals without algebraic
extensions, I think that Barry Trager's MIT thesis describes the
conditions under which this works. It looks like one direction
to head is to encode the Risch algorithm as a side-light to certain
rules.

RJF

Nasser M. Abbasi

unread,
Jul 3, 2010, 1:09:51 PM7/3/10
to
On 7/3/2010 6:57 AM, clicl...@freenet.de wrote:

> Perhaps your "I" was not really #i, the imaginary unit
> - in spite of the definition at the top of your page?
>
> Martin.

Thanks. It looks like you are correct. I corrected #4 and just used
sqrt(-1), and now sage does this problem. So sage does #4 and #9 now.

I updated the page

http://12000.org/my_notes/rubiTest/rubi_1/rubi.html

#4
I=sqrt(-1)
x=var('x')
f=sqrt(x^2-1)/(x-I)^2
f.integral(x)

(answer below)

I also plotted difference of sage answer against Mathematica's answer
Zero plot. good. at least numerically same answer.

Btw, for this problem, sage (or maxima really) has the smallest leaf
count. Using Mathematica LeafCount on sage answer, Rubi and Mathematica
own answers, I get

LeafCount[sageAnswer]
69

LeafCount[mmaAnswer]
154

LeafCount[rubiAnswer]
136


sageAnswer = (1/2)*I*Sqrt[2]*ArcSin[I*(x/Sqrt[x^2 + 1]) - 1/Sqrt[x^2 +
1]] - Sqrt[x^2 - 1]/(x - I) + Log[2*x + 2*Sqrt[x^2 - 1]];


mmaAnswer = (1/4)*(-((4*(-1 + x^2)^(1/2))/(-I + x)) -
2*I*2^(1/2)*ArcTan[(1/2)*(-I + x - 2^(1/2) - 1 + x^2^(1/2))] +
4*ArcTanh[(2*x)/(I - x + (-1 + x^2)^(1/2))] - 2^(1/2)*Log[-I + x]
+ 2^(1/2)*Log[2*I + 6*x - 4*2^(1/2) - 1 + x^2^(1/2)] +
2*Log[-4 + 8*x^2 - 8*I - 1 + x^2^(1/2) + 8*x*(-I - 1 + x^2^(1/2))]);

rubiAnswer = 4/(1 - 2*I*(x + Sqrt[-1 + x^2]) + (x + Sqrt[-1 + x^2])^2) -
(I*(-2*I + 2*(x + Sqrt[-1 + x^2])))/(1 - 2*I*(x + Sqrt[-1 + x^2]) +
(x + Sqrt[-1 + x^2])^2) + I*Sqrt[2]*ArcTan[(-2*I + 2*(x + Sqrt[-1 +
x^2]))/ (2*Sqrt[2])] + Log[x + Sqrt[-1 + x^2]];

--Nasser

Message has been deleted

clicl...@freenet.de

unread,
Jul 4, 2010, 8:31:01 AM7/4/10
to

Albert schrieb:

>
> On Jul 1, 2:12 am, cliclic...@freenet.de wrote:
>
> >> Expression 2) above is based on the identity
> >> sqrt(a+z^2) = sqrt(sqrt(a)+I*z)*sqrt(sqrt(a)-I*z)
> >> which is valid for all z provided a>0.
> >
> > Experiments of mine confirm that
> > SQRT(a^2+z^2) = SQRT(a + #i*z) * SQRT(a - #i*z)
> > requires a > 0, and doesn't permit a larger domain. I think this
> > particular relation (in suitably generalized form) should be available
> > both ways, to help matching a given integrand to rules in Rubi's
> > collection. The same applies to
> > SQRT(a^2-z^2) = SQRT(a+z) * SQRT(a-z),
> > provided this was indeed needed as a separate rule (where again a > 0).
> >
> > It appears that Rubi's newly crafted rule involving the fourth power x^4
> > covers the case resulting for x <- #i*x automatically. But does it also
> > cover the simpler quadratic case for x^2 <- x and x^2 <- -x (unless
> > never needed), or that of arbitrary functions x^2 <- f(x) (unless
> > completely useless)?
>
> That's a good idea, and leads to the even simpler rule:
>
> Int[u_.*Sqrt[v_+Sqrt[a_+w_]]/Sqrt[a_+w_],x_Symbol] :=
> (1-I)/2*Int[u/Sqrt[Sqrt[a]-I*v],x]] +
> (1+I)/2*Int[u/Sqrt[Sqrt[a]+I*v],x]] /;
> FreeQ[a,x] && w==v^2 && a>0
>
> It is based on the previously discussed identity
>
> sqrt(z+sqrt(a+z^2))/sqrt(a+z^2) =
> (1-I)/(2*sqrt(sqrt(a)-I*z)) + (1+I)/(2*sqrt(sqrt(a)+I*z))
>
> modified to use the fact that sqrt(I/2)=(1+I)/2. Since replacing z
> with I*z yields
>
> sqrt(I*z+sqrt(a-z^2))/sqrt(a-z^2) =
> (1-I)/(2*sqrt(sqrt(a)+z)) + (1+I)/(2*sqrt(sqrt(a)-z)),
>
> there is no need to have a separate rule for the sqrt(a^2-z^2) case.
>
> This rule also covers "the simpler quadratic case" like you
> requested. However, Rubi already uses Euler's substitution for this
> case. Unlike the above algebraic expansion, Euler's substitution does
> not introduce the imaginary unit, but it does make for a more
> difficult derivation and a bigger antiderivative. The pdf file
>
> http://www.apmaths.uwo.ca/~arich/SubstitutionVsExpansion.pdf
>
> provides examples of this by showing the steps Rubi uses to integrate
>
> sqrt(2*x+sqrt(3+4*x^2))/sqrt(3+4*x^2)
> and
> sqrt(2*x+sqrt(3+4*x^2))/((c+d*x)*sqrt(3+4*x^2))
>
> first using Euler's substitution, and then using algebraic expansion.

I have difficulties matching the "Euler substitution" displayed in the
pdf file with what seems to be actually going on. Could the wrong rule
be displayed for both integrands? Or am I having a bad day? I think
there is only one way of matching SQRT(a+b*x+c*x^2) with the integrand,
which should result in a=3, b=0, c=4. The actual transformation,
however, apparently just takes the argument of the outer root as the new
integration variable. This procedure works with problem #8 as well: it
is the solution I was originally aware of (I believe it was once shown
on this group by Oleksandr at WRI), where the resulting antiderivative
is larger but doesn't involve the imaginary unit. For the general user,
this would often be preferable, I think.

>
> Euler's ability to avoid introducing the imaginary unit makes me
> wonder whether there is an analogous substitution for integrands
> having subexpressions of the form sqrt(a+b*x^4), thus obviating the
> need for our algebraic expansion rule. If anyone knows of such a
> substitution, please let me know.
>

All that seems to be needed would be to extend the range of
applicability of your secret substitution rule to a larger class of
integrands, namely those involving the denestable radicands
SQRT(1+x^4)+x^2, SQRT(1+x^4)+1, SQRT(1+x^4)-1 (all of them suitably
g