Also available:

Using finance

by: Maple

Ibragimova Evelina, 6 class,
school № 57, Kazan

The manual with examples
( templates for the solution of )

The solution of problems on simple interest

> restart:
> with(finance);

[amortization, annuity, blackscholes, cashflows, effectiverate,

futurevalue, growingannuity, growingperpetuity, levelcoupon,

perpetuity, presentvalue, yieldtomaturity]

Team futurevalue (the first installment, rate, period) - the total calculation for a given down payment, interest rate, payments and number of periods.

Example 1. To the Bank account, the income of which is 15% per annum, has made 24 thousand rubles. How many thousands of rubles will be in this account after a year if no transactions on the account will not be carried out? (The answer: 27.60 thousand rubles.)

> futurevalue(260,0.40,1);

364.00

> evalf(1000/216);

> 364*3;

1092

> u:=fsolve(presentvalue(1e6,x,1250)=950,x)*950;

u := 5.303626495

>

Team presentvalue (future amount, rate, period) - the calculation of the initial input to obtain a specified final amount at an interest rate of charges and the number of periods.

Example 2. How much you need to put money in the Bank today, so that when the rate of 27% per annum have in the account after 10 years 100000 thousand rubles? (The answer: 9161.419934 rubles.)

> presentvalue(680,-0.20,1);

850.0000000

The solution of problems in compound interest

The solution of problems
Using commands <futurevalue> и <presentvalue >
> restart;
> with(finance):
> futurevalue(,0.,);
`,` unexpected
The inverse problem
> presentvalue(,0.,);
`,` unexpected

I. Case with the same interest rate every period

Using the universal formula F = P*(1+r)^n; , where:
F - the future value (final amount).
P - the initial payment (current amount).
r - the interest rate period.
n - the number of periods.
This formula for the case with the same interest rate every period

> restart:
The task of the formula
> y:=F=P*((1+r)^n):
> y;

n
F = P (1 + r)

The job parameters are known quantities
The interest rate

> r:=;
`;` unexpected
The number of years (periods)
> n:=3;

n := 3

The initial payment (present value)
> P:=;
`;` unexpected
The final amount
> F:=2.16;

F := 2.16

The solution of the equation - the calculation of unknown values (in decimal form)
> `Unknown`;fsolve(y);

Unknown

0

>

II. The case of different interest rates for each period

Formula An = A*(1+1/100*p1)*(1+1/100*p2)*(1+1/100*p3); ... %?(1+1/100*pn); , where
An - the final amount
A - the initial payment (current amount at the moment)
p1, p2, p3, .... pn - interest rate periods
n - the number of periods

> restart:
The task of the formula (need to be adjusted based on the number of periods)
> y:=An=A*(1+1/100*p1)*(1+1/100*p2)*(1+1/100*p3):
> y;

An = A (1 + 1/100 p1) (1 + 1/100 p2) (1 + 1/100 p3)

The task of the parameters of the known values
The initial payment (present value)
> A:=;
`;` unexpected
Interest rate periods
p1:=0.30;
p2:=0.10;
p3:=0.15;

p1 := .30

p2 := .10

p3 := .15

The final amount
> An:=;
`;` unexpected
The solution of the equation - the calculation of unknown values (in decimal form)
> `Unknown`;fsolve(y);

Unknown

0

>

HTTP:-Get and NASDAQ...

I want to extract all the symbols and last trade from

http://finance.yahoo.com/q/cp?s=%5EIXIC

I have tried:

status, data, headers := HTTP:-Get("http://finance.yahoo.com/q/cp?s=%5EIXIC");
data;

but it just gives me a bunch of jiberish! Any ideas?

How are SDEs integrated?...

This question is probably for maple devs...

I was wondering if it would be possible to outline what algorithm is used to generate replications (realizations) for various processes by the Finance:-SamplePath command (and friends). For example in the code like this:

with(Finance):

X := WienerProcess();
A := SamplePath(X(t), t = 0 .. 1, timesteps = 100, replications = 20);

Is it the Euler-Maruyama method?

Alternatively maybe you can show the portion of the code that is responsible for the integration of the SDE that the Wiener process defines.

I can't find any details related to this information in the help, and it would be very helpful to know this (and more importantly have it in the help section).

Thanks!

Ito transformation...

Hi,

I tried to use the Finance package and got:

with(Finance):
Warning, some commands in the Finance package may not work on this platform
Y := ItoProcess(1.0, mu, sigma, x, t);

Error, (in Finance:-ItoProcess) external linking: error loading external library finance.dll: The specified module could not be found.

Is it me or my pc that is causing this?

Thank you.

Murray

how to convert euler scheme or convert to SDE from...

http://www.math.uni-frankfurt.de/~numerik/maplestoch/

Sigma := `<,>`(`<|>`(1.0, .5), `<|>`(.5, 1.0));
V := WienerProcess(Sigma);
Z := t -> exp(a*t+b*V(t)[1]+c*V(t)[2]);
drift1 := simplify(Drift(Z(t))/Z(t));
diffusion1 := simplify(Diffusion(Z(t))/Z(t));
with(stochastic);
linearsde(drift1, diffusion1[1][1]);
Euler(x[1],drift1,diffusion1[1][1]);

1.what are a, b, and c?

2. how to convert SDE for monte carlo for this ito formula?

3. how to convert to euler scheme with this ito formula

ImpliedVolatilitySurface(...) not working in with(...

I was using the Finance package and used the command ImpliedVolatilitySurface(...). But it is showing the following error

A little financial math with recursion and plotting...

by:
 Consider the problem of borrowing \$250,000 to buy a house.  You borrow the money at a fixed interest rate of 4.8% compounded monthly.  The term of the mortgage is for 20 years....

Multi-Dimensional Geometric Brownian Motion...

Trying to create multi-dimensional geometric brownian motion by using:

W := GeometricBrownianMotion(Vector(N, 1), Vector(N), B.B^%T);

but receive the following error message:

Error, (in Finance:-GeometricBrownianMotion) invalid input: ProcessOptions expects its 1st argument, x0, to be of type realcons, but received Vector(2, {(1) = 1, (2) = 1})

The vectors and B.B' matrix are fine, because

W := BrownianMotion(Vector(N, 1), Vector(N), B.B^%T);

Missing finance.dll in Maple16 (64bit)...

... is finance.dll missing in Maple16 (64 bit), as it was in Maple15 (64 bit), so you have to install the 32 bit version instead?

Is it possible to move the finance.dll-file from Maple16(32-bit) to Maple16(64-bit)?

Jestrup

i want to write a program to simulate a walk of a drunken sailor who walks out of a bar at the centre of a city. the city has a regular pattern of 24\24 square blocks. the sailor doesnt know where he is going and how to exist teh city. the question is how many blocks will he have to walk to exit the city?

let him start at the centre of the city and assume that he exists the city when he reaches either north, east, south or western borders. it can happen that he wlks...

I am confused - LSSolve and QP...

I am confused by the below results.

Why does LSSolve (given an arbitrary expected return) produce a higher risk
adjusted return than QPSolve which explicity is given an objective to maximize
risk adjusted returns? ie minimize Transpose(W).Cov.W-Transpose(W).ev
This to me seems very strange?!

Also, how do you specify in the objective function for LSSolve to maximize
risk adjusted returns? Now we have simply provide LSSolve with some user specified

python script, wget and Maple...

This guy Giorges is using Python and wget inorder to do parrallel downloading
and he is arguing that it is very fast.

Now my questions become

1) Does there exist a simple way that I can use wget without installing it ?
I dont want to bother users of my Maple application with installing a 3:rd party software.
A simple file in a specific location would be ok though

Maple Toolbox for MATLAB...

MATLAB has this Index extracting symbol function for yahoo finance (which works well in MATLAB)

How do I retrieve data from google data....

I want to retrieve data from google finance to do some analysis. Since the amount of data pieces are very huge. To aviod a huge amount of copy and past operations, I need to do it automatically in maple. So my question is how can I reduce the work in Maple as much as possible? I know google offers some APIs for retrieving data. Can I utilize that in Maple?