Frequently Asked Questions (FAQ)Derivatives ExpertTM for Mathematica®IntroductionSome of this information may first be relevant to you after you have experimented with Derivatives Expert, but please skim the text so that you have an idea of the contents. Tips and Techniques
FAQ
Tips & TechniquesRunning the ExamplesNote when, running the examples in the different notebooks, it may be important to run some of the examples in the correct order, i.e. from top to bottom, because there may be intermediate or temporary results with the same names or because some examples depend on previous results. Financial Day Counting ConventionsDerivatives Expert can accomodate probably all financial day counting conventions. Please refer to e.g. YearsInPeriod in the CalendarTools.nb notebook about how to set the day counting optionals appropriately. Compounding -> ContinuousUnless you need the unlimited precision, then set (CompiledDF->True) because the execution is much faster. This is the case for all functions that discount or compound cash flows. SetOptionsNever use the Mathematica SetOptions with functions and/or objects from Derivatives Expert because this may spoil the consistency of the Derivatives Expert system. In any case, it is often not possible to change the default settings because they have been locked. This is a current design choice in Derivatives Expert. The internal design may change in later versions. Note that the general use of SetOptions with optionals from the standard Mathematica system can be reasonable in given situations. Options[...]Options[ object] has been added to relevant objects in addition to the Options[ function] already present. Because there often are several versions of "object" to a function available, the actual optionals that have effect are documented in the respective notebooks. Please refer to these. Getting information on symbols
Only Linux: System Time IssueYou may have to change your system time. NotationYou may want to stick to ISO-89*-1 characters and American/British notation i.e. "." as decimal divider. With e.g. the Link for Excel and with certain databases, there may be issues of notation. Often it is most "safe" to work with the American/British notation standard. J/LinkThe part handling the connection to Java in "~/.Mathematica/4.1/Kernel/init.m" may be moved to the main "/.../mathematica/Configuration/Kernel/init.m" file. This removes all remaining Java objects.
Displaying TablesMany of the results in the Derivatives Expert documentation are in the form of list of list i.e. tables. Below is a way to display these tables more nicely. This is a table of random numbers.
This formats table tbl using TableForm.
This is one way to format the numbers of table tbl using PaddedForm.
This defines a function dsp1 to format the table. Also refer to the Mathematica functions GridBox, StyleBox, and DisplayForm.
This applies the functions fun2 and dsp1 to the table.
This prepends a table header to tbl.
This defines a function dsp2 to format a table with header.
This applies the function dsp2 to the table with header.
This applies the functions fun2 and dsp2 to the table.
FAQ
|
![]() |
You can often make the functions automatically change all non-workdays to workdays, by setting the optionals correctly. Remember to set: ToWorkdaysQ -> Yes. Refer to the optionals of the specific object and function. See also the notebook CalendarTools.nb.
Cash flows are generally viewed from a buyer´s point of view unless otherwise stated.
In the documentation these amounts are just referred to as the principal as a matter of simplicity.
Many examples in the documentation have a principal of 100, but that can be changed to any number (which of course normally changes the result of the specific evaluation). Market rates of financial instruments are often quoted in amounts of nominally 100, e.g. most bond market prices.
The currency symbols used in Derivatives Expert are the ISO codes. You may use any symbols you like as the currency symbols (except reserved symbols for other purposes in Derivatives Expert, Mathematica and other packages), as long as you use the symbols consistently, but these are the recommended ones. Many symbols can be found here.
When talking about "optionals" in Derivatives Expert we actually mean "options" in the sense defined by standard Mathematica. The reason for this is to distinguish optionals from financial options contracts.
A list of optionals are sometimes written as e.g.:
{LengthMonth -> Actual, ..., Options[FindRoot]}
The thing to note is the Options[FindRoot] part. If you execute Options[FindRoot] in Mathematica it will return the list of optionals and their default settings for the function FindRoot. So Options[FindRoot] is just a shorthand notation for the full list of optionals and their default settings.
If an alien optional (but otherwise correctly specified optional) is passed to a function, then the optional should be ignored by the function, or the function should return unevaluated or return $Failed together with a message.
Note that many of the optionals that may apply to a function, may not apply to another version of the same function because there are many methods of the same function that do not all take the same optionals.
If an optional, that is usable for a function, has a non-valid value then it will normally terminate the evaluation of the function. Thus either the function should return unevaluated or return $Failed together with a message.
You can change the default settings of optionals that do not have the attribute Locked. This is done via the function SetOptions.
The functions UnProtect and SetOptions cannot be used on symbols that have the attributes: {Protected, ReadProtected, Locked}. These symbols cannot be changed or read. This is to protect you from changing important characteristics of these symbols.
In the documentation the format of the result is often changed from an
exact format to a numerical result using the function ToN or the
Mathematica function N.
In addition the number of returned lines are sometimes shortened by
using the Mathematica function Short.
A function that is given false input should either return unevaluated, return a value together with a warning or return $Failed and a message.
This will not always be the case in this version of Derivatives Expert. Sometimes you will get a long list of output because you have e.g. some missing arguments or entered some wrong arguments.
Many functions are "overloaded" which means that they can take different sets of arguments and/or optionals, and thereby have different properties. This is done:
Some functions return a rational number (e.g. 2/3). In some cases it is convenient to transform the result to a real number (e.g. 0.666667). This can often be done by using ToN or the Mathematica function N. If you want the highest degree of precision then always use the rational numbers where possible.
Note that the transformation to a real number can result in loss of precision. This should especially be noted when using results in further calculations. Please refer to the sections in the main Mathematica book ("A System for Doing Mathematics by Computer" by Steven Wolfram) about N, numbers and precision.
Running the functions using faster machines will speed up the timing compared to that reported in the documentation.
There are different ways to terminate a calculation that is running. Please refer to the standard Mathematica documentation about e.g. Abort, Interrupt and Exit.
See also: $RecursionLimit, $IterationLimit, MemoryInUse[].
See e.g. the Mathematica function MemoryInUse[].
|
Updated 2 August 2009 |