% Description: This file contains a long list of examples demonstrating the abilities of % the translator. These examples are only the most representative of OpenMath % expressions. Many more were used during implementation and testing. They all % correctly translate to MathML2 or MathML1 % % Type: on demo; in "examples.om"; then press return to see each expression % being translated % % Date 17 April 2000 % % Author: Luis Alvarez Sobreviela % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The examples in this file attempt to test: % % - Simple operators % - Lambda expressions % - Quantifiers % - Matrices % - Extensibility: symbols with no mapping % - Limits % - Symbols with different names in both standards % - Symbols which only map to MathML2 and not MathML1 % - Elements with bound variables % + Calculus elements % + Sum, product % - Relational Operators % - Set operators % - Variables Type Assignement % - Selectors % - Complex numbers % - Intervals % - Different Interval closures % - Symbols with same name. % - Various general expressions % - Long and complex Expressions % Simple operators om2mml(); om2mml(); 1 om2mml(); % Examples demonstrating proper parsing of lambda expressions om2mml(); om2mml(); % Quantifiers. om2mml(); om2mml(); om2mml(); 2 om2mml(); om2mml(); % The following two examples show how the translator % can deal with matrices represented either in columns % or rows. The translator then converts matrices % represented in columns into ones represented in % rows. Mapping to MathML is then possible. om2mml(); 1 2 3 4 5 6 om2mml(); 1 0 0 1 om2mml(); 0 1 2 3 0 2 1 3 % The following examples test how the translator % performs with OpenMath symbols without MathML % equivalent. The extension mechanism es testes % bigfloat om2mml(); % rowcount, identity, columncount om2mml(); % rowcount, identity om2mml(); % apply_to_list, make_list, identity om2mml(); 1 1 2 % Parsing of limits. It is important that the % translator understands the method of % approach to the limit: above, below or % both sides. om2mml(); om2mml(); om2mml(); % The following examples show how the translator % recognizes valid symbols coming from different % different CDs but with the same name. % In the two examples: notsubset is in CDs: set1 and multiset1 om2mml(); 2 3 3 1 2 3 om2mml(); 2 3 3 1 2 3 % Examples of symbols which have MathML equivalents % but with different names. We must make sure the % translator maps these to the correct name. %unary_minus om2mml(); 1 %true, false om2mml(); % zero om2mml(); % one om2mml(); % The following elements use MathML2 elements. % If output mode is MathML1, these elements % should be translated as functions om2mml(); 3 6 9 3 6 9 om2mml(); 3 6 9 3 6 9 % The integral symbols defint and int are ambigious as defined % in the CDs. They do not specify their variable of integration % explicitly. The following shows that when the function % to integrate is defined as a lambda expression, then the % bound variable is easily determined. However, in other % cases, it is not possible to determine the bound variable. om2mml(); % In this example the bound variable is impossible % to determine and so x is assumed to be the % variable of integration. This is more often % than not going to produce incorrect answers. om2mml(); % Some calculus om2mml(); % Must make sure partialdiff translates correctly. It % is a tricky element. om2mml(); 1 3 % Operators taking bound variables. % It is important to ensure that % the bound variables is correctly % extracted from the lambda expression. % product om2mml(); 1 om2mml(); % Use of relational operators. Make sure % the MathML output depends on the output % mode: MathML2 is different than MathML1 % for relational operators % It is important to note that % relational operators can come from % various CDs. Some exist in two CDs % such as those in set1 and multiset1. % implies om2mml(); % eq om2mml(); 1 9 5 9 % implies, and, in om2mml(); % and, subset om2mml(); % Functions used on sets. om2mml(); om2mml(); om2mml(); om2mml(); 4 1 1 2 3 om2mml(); 2 3 2 2 3 om2mml(); 2 3 3 1 2 3 om2mml(); 1 2 1 1 2 1 % Examples ensuring that basic types % are correctly translated. % MathML has a very different way of % representing types, so we must make % sure this works om2mml(); 8 8 10 om2mml(); 1 2 om2mml(); om2mml(); 2 om2mml(); om2mml(); om2mml(); om2mml(); % Statistic functions om2mml(); 1 2 3 3 om2mml(); om2mml(); om2mml(); % Examples of assigning types to variables. OpenMath % has a different way of doing this. % We must check it is done properly om2mml(); om2mml(); om2mml(); % These examples show the use of attributions within OpenMath % expressions. om2mml(); 1 2 3 om2mml(); om2mml(); 0 om2mml(); % Selectors om2mml(); 2 3 6 9 om2mml(); 2 0 1 0 om2mml(); 1 om2mml(); 1 1 % Testing of complex numbers. Real and Img % part are variables or real values om2mml(); om2mml(); om2mml(); om2mml(); 4 2 om2mml(); 4 2 om2mml(); 4 2 % Testing of intervals. om2mml(); 4 2 om2mml(); 4 2 om2mml(); 4 2 om2mml(); 4 2 % Both following examples show the use of a % symbol with the same name but from different CDs. om2mml(); om2mml(); % A variety of expressions to make sure all % works put to together om2mml(); om2mml(); om2mml(); om2mml(); 1 0 0 1 0 1 0 2 0 0 1 3 om2mml(); % Complex expressions. The translator % should perform correctly om2mml(); om2mml(); 2 om2mml(); 4 4 om2mml(); om2mml(); % The following two examples were produced by REDUCE in MathML with the % MathML interface, then translated to OpenMath. It is now possible to % translate them back to MathML. om2mml(); om2mml(); 1 2