I *think* the problem is that maple isn't happy with things of the form
simplify((x^3)^(1/3));
and so
testeq( x = (x^3)^(1/3) );
FAILs.
Because the functions I have are the results of several steps of algebra and
then using subs, I'd rather not retype them for each case.
Is there a way to help maple recognise that x = (x^3)^(1/3) ? (where x may be
a long expression)
Many thanks, Chris.
Explicitly assume that x is real. The simplification isn't valid
otherwise.
Colin Percival
I get the same problem, no?
> assume(x,real);
> is(x::real);
true
> testeq( x = (x^3)^(1/3) );
FAIL
Possibly I'm being stupid here and need to specify that x is real another way?
C.
> I get the same problem, no?
Oops. Assume that x is positive. The branch which Maple chooses doesn't
work for negative x.
Colin Percival
> Chris W. <chris....@lshtm.ac.uk> wrote:
> > Colin Andrew Percival <cper...@sfu.ca> writes:
> >> Explicitly assume that x is real. The simplification isn't valid
> >> otherwise.
>
> > I get the same problem, no?
>
> Oops. Assume that x is positive. The branch which Maple chooses doesn't
> work for negative x.
still the same...
> assume(x,real, x>0);
> is(x::real);
true
> is(x>0);
true
> testeq( x = (x^3)^(1/3) );
FAIL
but the above property should hold for x<0 also, no?
Thanks for continuing help, C. (PS, using Maple 8, if that's important)
Works for me:
> assume(x,real,x>0);
> testeq(x=(x^3)^(1/3));
true
But I'm using Maple V Release 4. Evidently someone broke this between
versions.
> but the above property should hold for x<0 also, no?
In Maple V r4:
> assume(x,real,x<0);
> simplify((x^3)^(1/3));
1/2
- 1/2 x~ (1 + I 3 )
Colin Percival
On 2 Dec 2002, Chris W. wrote:
> still the same...
>
> > assume(x,real, x>0);
> > is(x::real);
> true
> > is(x>0);
> true
> > testeq( x = (x^3)^(1/3) );
> FAIL
>
> but the above property should hold for x<0 also, no?
> Thanks for continuing help, C. (PS, using Maple 8, if that's important)
FAIL does not mean false. It just means that testeq gave up. If you look
at lines 44-46 of testeq, you'll see that it gives up immediately for
expressions with fractional exponents. testeq is a nondeterministic test
performed by evaluating the expression for some large values of the
variables over a finite field. I don't think that it makes any use of
assumptions.
I think the easiest way to show that two expressions are equal is to
simplify their difference and see if you get zero.
> assume(x>0);
> simplify(x - (x^3)^(1/3));
0
> On 2 Dec 2002, Chris W. wrote:
> > still the same...
> >
> > > assume(x,real, x>0);
> > > is(x::real);
> > true
> > > is(x>0);
> > true
> > > testeq( x = (x^3)^(1/3) );
> > FAIL
> >
>
> FAIL does not mean false. It just means that testeq gave up. If you look
> at lines 44-46 of testeq, you'll see that it gives up immediately for
> expressions with fractional exponents. testeq is a nondeterministic test
> performed by evaluating the expression for some large values of the
> variables over a finite field. I don't think that it makes any use of
> assumptions.
>
> I think the easiest way to show that two expressions are equal is to
> simplify their difference and see if you get zero.
>
> > assume(x>0);
> > simplify(x - (x^3)^(1/3));
> 0
I knew FAIL meant fail not false, I was using testeq to show that maple 8
wouldn't simplify (x^3)^(1/3). But it does, with
simplify((x^3)^(1/3), symbolic);
as pointed out to me by email. Which solves my problems.
Many thanks to all who took time to answer.
C.
> Chris W. <chris....@lshtm.ac.uk> wrote:
> > but the above property should hold for x<0 also, no?
>
> In Maple V r4:
> > assume(x,real,x<0);
> > simplify((x^3)^(1/3));
> 1/2
> - 1/2 x~ (1 + I 3 )
surely simplify((x^3)^(1/3)) should give x _and_ both roots with imaginary
parts or give none? Maybe this is why the 'fix' (that simplify((x^3)^(1/3))
doesn't) was introduced between our differing versions.
My original problem is now fixed (see other reply). Thanks for taking the time
to reply, C.
|>FAIL does not mean false. It just means that testeq gave up. If you look
|>at lines 44-46 of testeq, you'll see that it gives up immediately for
|>expressions with fractional exponents. testeq is a nondeterministic test
|>performed by evaluating the expression for some large values of the
|>variables over a finite field. I don't think that it makes any use of
|>assumptions.
It certainly can't use assumptions such as positivity, because it's not
working in an ordered field.
In general, I'd be very cautious about using testeq. In some
circumstances it is prone to producing false positive results. For
example, in anything involving a symbolic exponent:
> for i from 1 to 15 do testeq(a^n[i] = (-a)^(n[i])) od;
About half the results will be true, the others false.
What happens basically is that testeq ends up testing
(A^N - (-A)^N) mod p, where A and N are "random"
integers mod p and p-1 respectively, and p is the
prime 979073763359. Of course, the result will be 0
(and testeq will return true) if and only if N is even.
And this will happen with probability 1/2.
Robert Israel isr...@math.ubc.ca
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
simplify(..., symbolic) is a dangerous last-ditch effort at
simplification, just like testeq is a last-ditch effort at equality
testing. It may perform invalid simplifications. The following works in
this case, and is safe:
simplify((x^3)^(1/3)) assuming x>0;
assign('n'=3),(allvalues@readlib(`convert/RootOf`))(x =
(x^n)^(1/n)),assign('n'='n');
Chris