The Mathematica Journal
Download This Issue
Feature Articles
Graphics Gallery
Tricks of the Trade
In and Out
The Mathematica Programmer
New Products
New Publications
News Bulletins
Editor's Pick
Write Us
About the Journal
Staff and Contributors
Back Issues

Future Extensions


Now that the functions of the Semantica package have been introduced and illustrated, and the construction techniques behind the package have been sketched, we can turn our attention to the future possibilities with a critical eye.

First, some obvious shortcomings of Semantica should be noted. Often it is possible to set up equations that look perfectly reasonable but are insolvable. This means Semantica can lull one into a false sense of ease. For instance, consider the following simple pricing formula from finance, that of a bond of par value [Graphics:../Images/index_gr_304.gif] paying interest [Graphics:../Images/index_gr_305.gif] with a time to maturity of n.


It would be nice to be able to calculate the implied interest rate [Graphics:../Images/index_gr_307.gif] given the value of a bond.


Even though this is conceptually a reasonable thing to do, there is no closed form solution for [Graphics:../Images/index_gr_309.gif] in terms of [Graphics:../Images/index_gr_310.gif], [Graphics:../Images/index_gr_311.gif], and n. It would be desirable for Semantica to give more warning when it is not possible to solve the underlying system of equations. Furthermore, since this is easily numerically solvable, it might be nice if Semantica switched to a numerical model when [Graphics:../Images/index_gr_312.gif], [Graphics:../Images/index_gr_313.gif], and n were numerically specified. This does not happen, although this feature could be added.

More importantly, the issue of assumptions and how Semantica deals with them should be addressed. Mathematica has no uniform support for assumptions outside simplification and integration. Let us examine how we would modify Semantica if and when such support becomes available.

Let us revisit the previous example for foo.


If an assumptions mechanism were present, it would be desirable to allow the user to ask and receive answers to questions like "Assuming a<0 and [Graphics:../Images/index_gr_315.gif], what is foo[z]?" To answer this, let us re-examine the underlying rules that Semantica generates for foo.


As mentioned previously, in general it is difficult to determine if the conditions imposed on the original semantic assignment, such as [Graphics:../Images/index_gr_323.gif], are sufficient to be able to eliminate all but one of the solutions before the specific input is known. However, there are sometimes ways around this which also allow simplification of the rules generated and are consistent with a future uniform assumptions mechanism. For our example, let us examine an equivalent set of reductions to the set Semantica generates. We generate this new set by using the experimental implementation of the cylindrical algebraic decomposition algorithm which is present in Mathematica 4. (For more information on cylindrical algebraic decomposition see [1, 6, 11].)


Examining the rather complicated equations above we can see that there are three solutions if 0<a<1 but only one solution if a<0. Internally we can work out the answers on each of these branches by introducing the final left hand side as a variable, say [Graphics:../Images/index_gr_326.gif], in an equation, in this case [Graphics:../Images/index_gr_327.gif], then solve for [Graphics:../Images/index_gr_328.gif] while eliminating [Graphics:../Images/index_gr_329.gif] and [Graphics:../Images/index_gr_330.gif]. Finally, we include the conditions on the other variables to get the solutions and their regions of validity.


In this way we can see that we have found solutions where the conditions on the solutions are only dependent on the semantic variables, in this case a and b, and the matched input [Graphics:../Images/index_gr_333.gif]. We did not have to use any of the pattern matching symbols, which in this case are [Graphics:../Images/index_gr_334.gif] and [Graphics:../Images/index_gr_335.gif]. If we had a general assumptions mechanism, it would be a simple matter to determine which branches of the solution structure satisfy the assumptions and then return the appropriate solutions. As one can see, the form of the solution is also nicer than the rules generated by Semantica.

Implementing a general routine that incorporates this behavior is sometimes possible, as has been demonstrated. It is fairly easy to imagine generalizations of the above. However, there are some obvious consequences. Due to the diverse nature of the structure of the solution set, one has to be much more careful in the implementation. Also, the experimental implementation of cylindrical algebraic decomposition found in Mathematica 4 only works for polynomial systems at the time of the writing of this article. At present Mathematica does not have a more generalized assumptions mechanism, so it does not help to simplify the conditions to a set which only involves the semantic variables. One cannot use them for deductions involving assumptions in any case. Future versions of Semantica may incorporate more advanced rule generation. Because of the above reasons, this version of Semantica does not make use of the experimental cylindrical algebraic decomposition algorithm found in Mathematica 4.

Converted by Mathematica      September 30, 1999

[Prev Page][Next Page]