Thursday, March 7, 2013

Friday, February 22, 2013

C++ Coding - Euler's Method


Consider an initial value ODE of the following form

dx = f (x,y),
x ∈ [a,b] and y (a ) = α
write a function to return the value of y at x=b given
f (x, y) = xe  −  2y,
a = 0,   b = 1, and α = 0

Thursday, February 7, 2013

C++ - Coding - Deterministic Coupon Bond Pricer

Question You must price a coupon bond with a principle of $100 maturing in 2 years time. Two coupons of $5 are paid at the end of year one and year two, and the continuous compound interest rate is a constant 10%. Extend your code to price a coupon bond with any specification.

C++ - Coding Black Scholes Formula

Question: Write a C++ code to calculate the option values for a call C(t = 0,S), and a put P(t = 0,S) using the Black-Scholes formula:
C(t = 0,S ) = SN (d1) − Xe −r(T−t)N (d2),

P (t = 0,S ) = Xe − r(T− t)N (− d2) − SN (− d1 )

Wednesday, February 6, 2013

C++ Examples - Cumulative Normal Distribution Function

Write a function to calculate N(x) the cumulative normal distribution with mean zero and variance one given by the formula
          1   ∫ x    2
N (x) =  √----    e−t ∕2dt
          2 π  −∞

C++ Examples - Functions Loops

Question: Write a function to calculate sin(x) using the first N terms of the power expansion

Thursday, January 31, 2013

C++ Examples - Logic

Question: Write a function that takes the arguments a, b and c, computes and then displays the roots of the quadratic equation.

C++ Examples - Basic Syntax

Write a program to calculate the area and circumference of a circle of radius

Visual Studio 2010 at UoM

Getting started on Visual Studio 2010
On windows one of the best IDEs (Integrated Development Environment) to use on Windows is Visual Studio 2010. Visual Studio is primarily written for developers to build complex applications using graphics, audio and interactions with the user. However, during this course we are only interested in coding mathematics, so will not really touch on the many things that Visual Studio can do for you. You will need to know how to edit, compile and run simple Win32 console applications.
The following "How To" is for the Windows network at the University of Manchester. First click on the start menu and type "visual", you should see Visual Studio 2010 appear to select.