       Re: AlgebraicRules

• To: mathgroup at smc.vnet.net
• Subject: [mg127485] Re: AlgebraicRules
• From: Andrzej Kozlowski <akozlowski at gmail.com>
• Date: Sun, 29 Jul 2012 03:03:01 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <20120728063859.B94706847@smc.vnet.net>

```Yes, you can use it in exactly the same way but AlgebraicRules is a lot
more compact and does certain things for you. (On the other hand it's
much harder to know what is gong on). Here are two equivalent examples:

Using AlgebraicRules:

Sin[x]^3 + Cos[x]^2 /.
AlgebraicRules[{Sin[x]^2 + Cos[x]^2 == 1,
TrigExpand[Sin[3*x]] == 1/2}]

Sin[x]^2 + (3*Sin[x])/4 + 7/8

Using PolynomialReduce and GroebnerBasis:

Last[
PolynomialReduce[Sin[x]^3 + Cos[x]^2,
GroebnerBasis[{Sin[x]^2 + Cos[x]^2 - 1, -Sin[x]^3 +
3*Sin[x]*Cos[x]^2 - 1/2},
{Cos[x], Sin[x]}], {Cos[x], Sin[x]}]]

-Sin[x]^2 + (3*Sin[x])/4 + 7/8

Note that if you omit GroebnerBasis you will get a different answer:

Last[
PolynomialReduce[
Sin[x]^3 +
Cos[x]^2, {Sin[x]^2 + Cos[x]^2 - 1, -Sin[x]^3 +
3*Sin[x]*Cos[x]^2 - 1/2}, {Cos[x], Sin[x]}]]

Sin[x]^3 - Sin[x]^2 + 1

Under the assumption Sin[3x]==1/2 both answers are equivalent:

FullSimplify[-Sin[x]^2 + (3*Sin[x])/4 + 7/8 ==
Sin[x]^3 - Sin[x]^2 + 1]

2*Sin[3*x] == 1

Andrzej Kozlowski

On 28 Jul 2012, at 08:38, Murray Eisenberg wrote:

> In a very recent post by Fred Simons, he cited his paper "Computer
> algebra in service courses", available as:
>
>   http://alexandria.tue.nl/openaccess/Metis217845.pdf
>
> In it, he proves a certain trig identity. He begins by using TrigExpand
> to obtain a certain polynoial, call it "expanded", in Sin[x] and Cos[x].
> Then he uses the function AlgebraicRules:
>
>    expanded/.AlgebraicRules[{
>       Sin[x]^2 + Cos[x]^2 == 1, TrigExpand[Sin[3x]] == 1/2}]
>
> I only vaguely recall having seen AlgebraicRules back in Version 2.2 but
> have not come across it since.
>
> Although AlgebraicRules persists in the current version of Mathematica,
> the docs say that since Version 3.0, Algebraic Rules has been superseded
> by PolynomialReduce.
>
> Can PolynomialReduce in fact be used _directly_ on an expression that is
> not a polynomial in, say, a single variable x but rather in the pair of
> functions Sin[x] and Cos[x]?
>
> Or must one revert to the artifice of replacing Sin[x] and Cos[x] by new
> variable names, use PolynomialReduce, and finally reverse the
> replacement to get back to the original variable x?
>
> --
> Murray Eisenberg                     murray at math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305
>

```

• References:
• Prev by Date: Re: Mathematica as a New Approach to Teaching Maths
• Next by Date: Re: mac new OS "mountain lion", compile function, C compiler (vrs. 8.0.4)