Adept Scientific - English
The world's best software 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  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

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

Learn More

Maple Home
Maple 12 Professional
Maple 12 Academic
Maple 12 Student Use
Recorded Online Seminars
FREE Training Resources
Maple Application Briefs
Maple Adoption Program

MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


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] Curious simplification

Search email archive for  

[MUG] Curious simplification
Author: Greg Gamble    Posted: Thu, 5 Dec 2002 17:23:15 +0800

>> From: "Greg Gamble" "gregg"

Hi again,

Apologies for the last inane request. My real query was based on trying
to find a general way to treat student inequality responses to check their
equivalence with a correct response e.g.

x < 2 or x > 2

is treated as different to

2 < x or 2 > x

In Maple:

> evalb((x < 2 or x > 2) = (2 < x or 2 > x));
false

> evalb({solve(x < 2 or x > 2)} = {solve(2 < x or 2 > x)});
true

... so this suggests using {solve(...)} to compare such expressions.
However, if one tries this with <> one gets:

> solve(x<>2);
x
(which means `any value' as I interpret it) and differs from:

> solve(x < 2 or x > 2);
RealRange(-infinity, Open(2)), RealRange(Open(2), infinity)

I'm using Maple 7 and, looking at the docs, <> is not included as a
an operator for expressions of form solve(ineq). Anyway, I'm wondering if
anyone can see a nice way to uniformly recognise domains and ranges written
in inequality form.

Regards,
Greg Gamble


> -----Original Message-----
> From: Greg Gamble "mailto:gregg"
> Sent: Thursday, 5 December 2002 4:51 PM
> To: "maple-list"
> Subject: Curious simplification
>
>
> Hi,
>
> Can anyone explain the following Maple evaluation?
>
> > x<>2 or x>3;
> true
>
> Regards,
> Greg Gamble
>
> // Greg Gamble, Dept. of Maths & Stats //
> // Curtin University, Bentley WA 6102 //
> // Mailto: "gregg" //
> // WWW: http://www.maths.curtin.edu.au/~gregg //
>

[MUG] Re: Curious simplification
Author: Carl Devore    Posted: Wed, 11 Dec 2002 01:37:12 -0500

>> From: Carl Devore "devore"

On Thu, 5 Dec 2002, Greg Gamble wrote:
> ... so this suggests using {solve(...)} to compare such expressions.
> However, if one tries this with <> one gets:
> > solve(x<>2);
> x
> (which means `any value' as I interpret it) and differs from:
>
> > solve(x < 2 or x > 2);
> RealRange(-infinity, Open(2)), RealRange(Open(2), infinity)

Because of complex numbers, 'x<>2' is not the same as 'x>2 or x<2'. But
if you include a trivial directional inequality in the solve, it will
"reduce" the inequalities:

> solve( {x<>2, x<infinity} );
{x<2}, {2<x}

[MUG] Re: Curious simplification
Author: Greg Gamble    Posted: Fri, 13 Dec 2002 10:48:19 +0800

>> From: "Greg Gamble" "gregg"

On Wednesday, 11 December 2002 2:37 PM, Carl Devore wrote:
> On Thu, 5 Dec 2002, Greg Gamble wrote:
> > ... so this suggests using {solve(...)} to compare such expressions.
> > However, if one tries this with <> one gets:
> > > solve(x<>2);
> > x
> > (which means `any value' as I interpret it) and differs from:
> >
> > > solve(x < 2 or x > 2);
> > RealRange(-infinity, Open(2)),
> RealRange(Open(2), infinity)
>
> Because of complex numbers, 'x<>2' is not the same as 'x>2 or x<2'.

Thanks Carl ... I keep forgetting about Complex Numbers!!

After sending the email, I found that by defining a function
SolveInequality, I could map inequality expressions (of the type I was
expecting from students) uniformly to a set of RealRange expressions. My
function, however, replaced
expressions of form 'x <> a' by their 'x < a or x > a' equivalent,
explicitly,
by a call to a ReplaceNEQ function I defined. ...

> But if you include a trivial directional inequality in the solve, it will
> "reduce" the inequalities:
>
> > solve( {x<>2, x<infinity} );
> {x<2}, {2<x}

... Thus my code, of course, had precisely the sort of implied assumption
that Maple tries to avoid (I assumed I was working over the Real numbers).
So
I really should define a function SolveRealInequality (instead of
SolveInequality)
defined as follows:

SolveRealInequality := proc(ineq::boolean, var)::set;
description
"Returns the solution of the inequality ineq as a set of ",
"RealRange expressions";
local i;
{ seq( solve( op(i) ),
i = { solve({subs(var = `x`, ineq), x < infinity}) }
) };
end;

In this way, SolveRealInequality returns a canonical representation for
equivalent inequalities representing Real intervals, e.g.

> SolveRealInequality(x<>2, x);
{RealRange(-infinity, Open(2)), RealRange(Open(2), infinity)}

> SolveRealInequality(x>2 or x<2, x);
{RealRange(-infinity, Open(2)), RealRange(Open(2), infinity)}

> SolveRealInequality(2>x or 2<x, x);
{RealRange(-infinity, Open(2)), RealRange(Open(2), infinity)}

... so that seems to achieve what I was after (the first arguments of each
of these when tested pairwise for equality, Maple returns false).

However, there really seems to be a bug (I am using Maple 7) ...

> solve(x<2 or x>2 or x=2);
RealRange(-infinity, Open(2)), RealRange(Open(2), infinity)

whereas:

> solve(x<=2 or x>2);
x

Is there a reason for this behaviour? I'm a little troubled also by the
return
of x here also. It's not documented anywhere that I can see, what it's
supposed
to mean ... even looking through the code of `solve` there is no comment
indicating the reason for this return value. I interpret it as `any x', i.e.
`no restriction
on x', but if that's the case why do you also get ...

> solve(x<>2);
x

? I don't find this sensible. Can someone please explain it?

Regards,
Greg Gamble

// Greg Gamble, Dept. of Maths & Stats //
// Curtin University, Bentley WA 6102 //
// Mailto: "gregg" //
// WWW: http://www.maths.curtin.edu.au/~gregg //

Previous by date: [MUG] Goodstein sequence,  Joe
Next by date: [MUG] Re: HOWTO solve system where solution is piecewise?, Maple User Group
Previous thread: [MUG] Import RTF files into maple., Aldrovando Azeredo Araujo
Next thread: [MUG] HOWTO solve system where solution is piecewise?



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

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
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

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