Application Center - Maplesoft

App Preview:

Solving and Displaying Inequalities

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

InequalityGraphics.mw

A Maple Package for Solving and
Displaying Inequalities

Robert Ipanaqu Chero
Peruvian Applied & Computational Mathematical Society (Member), Per

E-mail: robertchero@hotmail.com

Introduction

Solving inequalities is a very important topic in computational algebra. In fact, the most important computer algebra systems include sophisticated tools for solving different kinds of inequalities in both symbolic and graphical ways. This worksheet presents a new Maple package, InequalityGraphics, for displaying the two-dimensional solution sets of several inequalities. The package also deals with inequalities involving complex variables by displaying the corresponding solutions on the complex plane. The output obtained is consistent with Maple's notation. The performance of the package is discussed by means of several illustrative and interesting examples.

The Package InequalityGraphics: Some Illustrative Examples

Loading the package plots:

> with(plots):
libname:="c:\\mylib\\InequalityGraphics",libname;

libname :=

Loading the package developed by the author:

> with(InequalityGraphics);

[complexinequalityplot, inequalityplot]

Help messages:

> inequalityplot();

Error, (in InequalityGraphics:-inequalityplot) expecting 3 arguments, got 0.
          This commmand also incorporates the options:

           (1) exludedcolor=yellow,

           (2) feasiblecolor=red,

           (3) linespoints=350,

           (4) feasiblepoints=15 and

           (5) thickness=1.

          Examples:

           <1> inequalityplot(x^2+y^2<1,x=-1..1,y=-1..1),

           <2> inequalityplot(x^2+y^2<1,x=-1..1,y=-1..1,

                  excludedcolor=white,feasiblecolor=cyan)

> complexinequalityplot();

Error, (in InequalityGraphics:-complexinequalityplot) expecting 2 arguments, got 0.
          This commmand also incorporates the options:

           (1) exludedcolor=yellow,

           (2) feasiblecolor=red,

           (3) linespoints=350,

           (4) feasiblepoints=15,

           (5) linescolor=black and

           (6) thickness=1.

          Examples:

           <1> complexinequalityplot(abs(z)<1,z=(-1..1,-1..1)),

           <2> complexinequalityplot(abs(z)<1,z=(-1..1,-1..1),

                  excludedcolor=white,feasiblecolor=cyan)

Example of inequality solution: x+y <= 1 on the square [-2, 2]*[-2, 2]

> inequalityplot(x+y<=1,x=-2..2,y=-2..2);

[Plot]

Using the options

> inequalityplot(x+y<=1,x=-2..2,y=-2..2,
feasiblecolor=cyan,excludedcolor=white,

color=red,thickness=3,title=`Inequaliy solution: x+y<=1`);

[Plot]

Example of inequality solution: x^2-y < 1 on the rectangle [-3, 3]*[-2, 3]

> inequalityplot(x^2-y<1,x=-3..3,y=-2..3);

[Plot]

Example of inequality solution: x^2-y < 1 and y <= x on the square [-2, 3]*[-2, 3]

> inequalityplot(
x^2-y<1 and y<=x,x=-2..3,y=-2..3,

feasiblepoints=40,thickness=3);

[Plot]

Example of inequality solution: 1 < abs(x)+abs(y) and abs(x)+abs(y) < 4 on the square [-3, 3]*[-3, 3]

> inequalityplot(
1<abs(x)+abs(y) and abs(x)+abs(y)<=2,

x=-3..3,y=-3..3,linespoints=400);

[Plot]

Example of inequality solution: 1 < x^2+y^2 and x^2+y^2 < 4 on the square [-3, 3]*[-3, 3]

> inequalityplot(1<x^2+y^2 and x^2+y^2<4,x=-3..3,y=-3..3);

[Plot]

Example of inequality solution: 0 < (4-sqrt((sqrt(x^2+y^2)-4)^2+y^2)-4)^2 on the rectangle [-10, 10]*[-6, 6]

> inequalityplot(
4-(sqrt((sqrt(x^2+y^2)-4)^2+y^2)-4)^2>0,

x=-10..10,y=-6..6);

[Plot]

Example of inequality solution: sin(2*x)+cos(3*y) < 1 on the square [-4, 4]*[-4, 4]

> inequalityplot(
sin(2*x)+cos(3*y)<1,

x=-4..4,y=-4..4,linespoints=800,feasiblepoints=25);

[Plot]

Example of inequality solution for `in`(z, C) such that `in`(Re(z), [-Float(12, -1), 1]) and `in`(Im(z), [-1, 1]) :
abs(z^3+3*z^2-(1+2*I))^2 <= abs(z+I)^2

> complexinequalityplot(
abs(z^3+3*z^2-(1+2*I))^2<=abs(z+I)^2,

z=(-1.2..1.,-1...1.),

linespoints=450,feasiblepoints=25);

[Plot]

Example of inequality solution for `in`(z, C) such that `in`(Re(z), [-2, 3]) and `in`(Im(z), [-3, 3]) :1 < abs(z^2-z+1) and abs(z^2-z+1) < 4

> complexinequalityplot(
1<abs(z^2-z+1) and abs(z^2-z+1)<4,

z=(-2...3.,-3...3.),

feasiblepoints=25);

[Plot]

Example of inequality solution for `in`(z, C) such that `in`(Re(z), [-2, 3]) and `in`(Im(z), [-3, 3]) :1 < abs(z^2-2*z)/abs(z^2+3) and abs(z^2-2*z)/abs(z^2+3) < 4

> complexinequalityplot(
1<abs(z^2-2*z)/abs(z^2+3) and abs(z^2-2*z)/abs(z^2+3)<4,

z=(-2...3.,-3...3.),

linespoints=550,feasiblepoints=25);

[Plot]

>

>

Conclusions

In this worksheet a new Maple package, InequalityGraphics, to solve real and complex inequalities and display their associated two-dimensional solution sets is introduced. The performance of the package has been illustrated by means of several interesting examples. In all the cases, the output obtained is consistent with Maple's notation.

Source

Heiko Feldmann: 3D Plots of Discontinuous Functions. Institute for theoretical physics, University of Wrzburg, Germany. 2000.