Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Twitter Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Request an Evaluation
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 15 Professional
Maple 15 Academic
Maple 15 Student Use
What's New in Maple 15
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes

Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Maple Home
Maple 15 Professional
Maple 15 Academic
Maple 15 Student Use
What's New in Maple 15
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes and
Connectors


Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
Maple Features
The Maple Reporter Online

Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] testeq

Search email archive for  

[MUG] testeq
Author: Bill Whiten    Posted: 16/08/2001 07:13:07 GDT
>> From: (Bill Whiten)

In Maple Vr5.1 Mac:

> ex1:=n*k!/n!/(k-n)!*p^n*(1 - p)^(k-n);

n (k - n)
n k! p (1 - p)
ex1 := ----------------------
n! (k - n)!

> ex2:=k*(k-1)!/(k-n)!/(n-1)!*p^(n-1)*(1 - p)^(k-n)*p;

(-1 + n) (k - n)
k (k - 1)! p (1 - p) p
ex2 := -------------------------------------
(k - n)! (-1 + n)!

> testeq(ex1,ex2);

false

> simplify(ex1-ex2);

0

> simplify(ex1/ex2);

1

>

-----------
Bill Whiten,
Julius Kruttschnitt Mineral Research Centre,
The University Of Queensland, Tel: int +61 7 3365 5888
Isles Rd, Indooroopilly, Fax: int +61 7 3365 5999
Brisbane Qld 4068, AUSTRALIA.


[MUG] Re: testeq
Author: Maple User Group    Posted: 22/08/2001 16:11:03 GDT
>> From: Maple User Group

|On Thu, 16 Aug 2001, Bill Whiten wrote:
|> In Maple Vr5.1 Mac:
|>
|> > ex1:=n*k!/n!/(k-n)!*p^n*(1 - p)^(k-n);
|> > ex2:=k*(k-1)!/(k-n)!/(n-1)!*p^(n-1)*(1 - p)^(k-n)*p;

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Fri, 17 Aug 2001 15:16:20 -0700 (PDT)
From: Robert Israel
To:
Subject: testeq


This bug seems to be fixed in Maple 6, to the extent that the result is
FAIL rather than "false". Note that the help for testeq does not mention
factorial:

- This function will succeed over expressions formed with rational constants,
independent variables, and I, combined by arithmetic operations,
exponentials, trigonometrics and a few others. It may also succeed with some
expressions involving radicals, Pi as an argument of trigonometrics, and
algebraic constants and functions. If the expressions do not fall in this
class, testeq returns FAIL. Testeq may also return FAIL if it cannot find an
appropriate modulus that works after seven trials.

So FAIL should be an acceptable result in this context. Still, it's
curious that Maple 6 does not come up with "true" here, because it does
produce "true" for testeq(k*(k-1)!, k!).

Robert Israel
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Fri, 17 Aug 2001 23:10:12 -0400 (EDT)
From: Carl DeVore
To:
Subject: testeq



You do not need such a complicated example to catch this bug. In Maple
5.1, try
> testeq(n*(n-1)!, n!);
and you still get "false".

There seems to be much flip-flopping among versions with how testeq
handles this expression. Maple 6 returns "true". Maple 7 returns "FAIL".
FAIL is not incorrect per se, but if Maple 6 can find the answer, why not
Maple 7?

The testeq command does not try to simplify the difference. Therefore, I
think that testeq is intended for expressions where the simplify command
would take too long.

To verify equality, first try simplifying the difference.

--
Carl Devore
Maple programs written for hire. Maple advisor for hire.




-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Sun, 19 Aug 2001 16:24:13 +0100 (BST)
From: J H Davenport
To:
Subject: testeq

Maple 6 returns 'FAIL' for me, which is not the same as false.

The HELP for testeq in Maple 6 says:
This function will succeed over expressions formed with rational
constants, independent variables, and I, combined by arithmetic
operations, exponentials, trigonometrics and a few others. It may also
succeed with some expressions involving radicals, Pi as an argument of
trigonometrics, and algebraic constants and functions. If the expressions
do not fall in this class, testeq returns FAIL. Testeq may also return
FAIL if it cannot find an appropriate modulus that works after seven
trials.

A quick use of printlevel shows that it is the second case (no modulus)
which is happening, essentially because Maple is refusing to work out the
factorials (which are converted into Gamma) since the arguments are too
large.

James Davenport



-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Tue, 21 Aug 2001 11:02:23 +0200
From: Helmut Kahovec
To:
Subject: testeq

Well, this weakness of testeq() is present in the Windows version of
MapleV/Release5.1, too. It can be easily removed by changing the third
and fourth source code line of testeq() from

testeq := proc(a, b)
local expr, e1, e2, i, ig, preverror, s, t;
1 if nargs = 1 and type(a,algebraic) then
2 expr := a
elif nargs = 1 and type(a,`=`) and type(op(1,a),algebraic)
and type(op(2,a),algebraic) then
3 expr := op(1,a)-op(2,a)
elif nargs = 2 and type(a,algebraic) and type(b,algebraic)
then
4 expr := a-b
else
5 ERROR(`invalid arguments`)
fi;

...

to

testeq := proc(a, b)
local expr, e1, e2, i, ig, preverror, s, t;
1 if nargs = 1 and type(a,algebraic) then
2 expr := a
elif nargs = 1 and type(a,`=`) and type(op(1,a),algebraic)
and type(op(2,a),algebraic) then
3 expr := simplify(op(1,a)-op(2,a))
elif nargs = 2 and type(a,algebraic) and type(b,algebraic)
then
4 expr := simplify(a-b)
else
5 ERROR(`invalid arguments`)
fi;

...

Then we get:

> restart;

> ex1:=n*k!/n!/(k-n)!*p^n*(1-p)^(k-n);
> ex2:=k*(k-1)!/(k-n)!/(n-1)!*p^(n-1)*(1-p)^(k-n)*p;

> testeq(ex1,ex2),testeq(ex1=ex2);

true, true


With kind regards,

Helmut


[MUG] Re: testeq
Author: Carl DeVore    Posted: 23/08/2001 20:53:48 GDT
>> From: Carl DeVore

> Date: Tue, 21 Aug 2001 11:02:23 +0200
> From: Helmut Kahovec
>
> Well, this weakness of testeq() is present in the Windows version of
> MapleV/Release5.1, too. It can be easily removed by changing the third
> and fourth source code line of testeq()
> to
> 3 expr := simplify(op(1,a)-op(2,a))
> elif nargs = 2 and type(a,algebraic) and type(b,algebraic)
> then
> 4 expr := simplify(a-b)


My assumption is that the testeq command was intended to be used on
expressions that would take a very long time to simplify.

Previous by date: [MUG] Re: Bell command, Helmut Kahovec
Next by date: [MUG] labelling on plots, Richard Patterson
Previous thread: [MUG] Some Algebraic Manipulations with Radicals, Les Wright
Next thread: [MUG] labelling on plots, Richard Patterson



Ready to buy?

For more pricing information:
Visit our webstore, call us on +1 800 724 8380 or email us at info@adeptscience.com

Featured Downloads

Maple 15 & MapleSim 5 Professional Brochure
Maple 15 Academic Datasheet
Maple 15 & MapleSim 5 Brochure - Academic Brochure
Maple 15 New Features data sheet
Maple 15 New Features - Flyer
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper: Technological Superiority in Multi-Domain Physical Modeling and Simulation

Latest Downloads

Maple Case Study: The Changing Face of Robotics
Maple Application Brief - Analyse the Path of a Liquid-Handling Robot
Maple Player for iPad - App
Maple Player for iPad - Datasheet
Case Study - Multi-Domain Modelling Critical to Unmanned Vehicle Designs

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks

Latest News

NASA’s Jet Propulsion Laboratory begins widespread adoption of Maplesoft technology
NASA’s Jet Propulsion Laboratory begins widespread adoption of Maplesoft technology
Latest release marks the 10th anniversary of Maple T.A.
Maple Case Study: The Changing Face of Robotics
Maple Application Brief - Analyse the Path of a Liquid-Handling Robot
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2012, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055