[Maxima] Packages to solve domain, equations and inequalities, interval arithmetic functions.

mihail22 mihail22 mihail22 at nigma.ru
Wed Nov 25 06:40:39 CST 2009

Thank you for attention to my letter.

This simple project is related to modification of Maxima's solver (equations
and inequalities).
Using domain function in the solver to eliminate wrong roots from the final
result of the function.

I have developed new functions:
  1) module that computes domain of superposition of elementary functions;
  2) interval arithmetics module;
  3) module to solve equations and inequalities.

Modules to solve inequalities ond compute domain are located in the same
file "ineq_domain.mac".
Module to solve equations is located in the "solve_equation.mac".
Interval arithmetics functions are written in the

1), (inequality 3)) Package to solve inequalities is based on idea of
"solve_rat_ineq" and
package "fourier_elim". It can solve polynomial and rational inequalities,
and linear
inequalities with functions abs(), max(), min() and simple cases that can be
reduced to linear ones.
This package produces answer - internal representation of lists of
intervals. It uses
package "interval_arithmetic" to perform basic operations with intervals and
lists of intervals:
intersect, combine, exclude, etc. (comments on internal arithmetic functions
are written in source
file "interval_arithmetic.mac".)
Internal representation from the function 'solve_ineq' is used to compute
domain of mathematical
expressions. It process superposition of functions and accumulate list of
all sub-domains for
subexpressions. Basic points to compute domain are functions:
f(x)/g(x), log(f(x)), (f(x)^(g(x)), tan(x), cot(x), sec(x), csc(x), asin(x),
acos(x),f(x)^(negative exponent).

Functions: domain_return(expr, var), solve_ineq(ineq, var) --- produces
result in
the internal representation of lists of intervals, single points, periodic
results and
unsolved expressions.

Functions: solve_inequality(ineq, var), domain_solve(expr, var) --- produces
result in
 the TeX-form. It can be used to output results as images or .pdf and .ps

2) Internal arithmetics package is used in solving domain, equality and
 Description of basic functions is located in the file
 If the function does not include in its name suffix _strict_, it handles
input parameters
 as the set of segments (The boundary points of intervals are included). If
a function
name contains the suffix _strcit_, then the input and output values of
intervals, and
segments should be interpreted as follows:
  Internal representation    ||||    Mathematical representation

  |     [a,b]                           ->
(a,b)              |
  |     [[a,a],[a,b]]                ->
[a,b)              |
  |     [[a,b],[b,b]]                ->
(a,b]              |
  |     [[a,a],[a,b],[b,b]]        ->
[a,b]              |


3) Package to solve equations. It uses functions 'solve' and
'to_poly_solve'. Some steps of the
solution are displayed. Before solution of the equation it does
preprocessing to check domain of
expression, check some classes of equations and special processing.
Result contains roots from real domain only (Russian school's program does
not contain imaginary domain
and this packages will be used for special school program).
This module catches errors of 'to_poly_solve' (if it can not solve) and
produces corresponding result
without error message.

This module is written to solve single equations with one variable (mainly).
But it has some processing
of systems of equations (in that case it calls 'solve' function to solve the
system of equations).

After solving of equation this module does post-processing to discard roots
that are not in the domain of
initial equation.
Result is the list of explicit roots (or intervals:  x/x=1 => (minf, 0), (0,
inf)), periodic roots, unsolved

In some cases solver have to turn off Maxima's simplifier: it is necessary
to compute domain for some
expressions before simplification stage. For example: asin(x)/asin(x)=1. If
simplifier is turned on then result
is [minf, inf]. Else if simplifier is turned off then result is [-1, 0), (0,
1]. For equation
((x+1)/(x+1)+(2*x+3)/(2*x+3))/((x^2-4)/(x^2-4))=2 result is (minf, -2),(-2,
-3/2),(-3/2, -1), (-1, 2), (2, inf)

(or in TeX-form $$x\in\left( -\infty
\cup\left(-1,2\right)\cup\left(2,\infty \right)$$)

Interesting example of using simp:false.

If simp:true then function solve(1.3^x=6, x) and function
to_poly_solve(1.3^x=6, x) can not solve it.
If simp:false then solve produces correct result - correct root
$$x={{\log 6}\over{\log \left({{13}\over{10}}\right)}}$$

Function: solve_equation(equation, vars) --- produces result in TeX-form
Before using of these modules You should do:

All functions of the above-mentioned packages should process some cases when
simplifier is turned off.
Instruction for usage of functions:
 1. before each function call you should do simp:false;
 2. then function call: solve_equation(expr, var),
                        solve_inequality(expr, var),
                        domain_solve(expr, var),
                        solve_ineq(expr, var),
                        domain_return(expr, var);
 3. after function call you should do simp:true. It is necessary due to
correct working of other Maxima's functions.








I work at solve_inequality package to add processing of new cases:
      /* TODO: Inequality preprocessor
       * Analyze type of the equation:
       *  - with abs function,
       *  - with square roots,
       *  - with exponentiation,
       *  - with logarithms,
       *  - with trigonometric and arc-trigonometric functions
Also I am going to add special processing of periodic solutions --- correct
intersection, combination, output.

If it would be possible for You, please, try to test these packages.

Best regards,
Mihail Denisenko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20091125/8d4ce697/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_strings
Type: application/octet-stream
Size: 3671 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20091125/8d4ce697/attachment-0004.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solve_equation.mac
Type: application/octet-stream
Size: 19090 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20091125/8d4ce697/attachment-0005.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interval_arithmetic.mac
Type: application/octet-stream
Size: 19495 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20091125/8d4ce697/attachment-0006.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ineq_domain.mac
Type: application/octet-stream
Size: 28838 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20091125/8d4ce697/attachment-0007.obj 

More information about the Maxima mailing list