0 Up votes0 Down votes

302 views4 pagesNumerical optimisation methods using Excel VBA.

Jul 21, 2013

© Attribution Non-Commercial (BY-NC)

PDF, TXT or read online from Scribd

Numerical optimisation methods using Excel VBA.

Attribution Non-Commercial (BY-NC)

302 views

Numerical optimisation methods using Excel VBA.

Attribution Non-Commercial (BY-NC)

- The Woman Who Smashed Codes: A True Story of Love, Spies, and the Unlikely Heroine who Outwitted America's Enemies
- Steve Jobs
- NIV, Holy Bible, eBook
- NIV, Holy Bible, eBook, Red Letter Edition
- Hidden Figures Young Readers' Edition
- Cryptonomicon
- Console Wars: Sega, Nintendo, and the Battle that Defined a Generation
- Make Your Mind Up: My Guide to Finding Your Own Style, Life, and Motavation!
- The Golden Notebook: A Novel
- Alibaba: The House That Jack Ma Built
- Hit Refresh: The Quest to Rediscover Microsoft's Soul and Imagine a Better Future for Everyone
- Hit Refresh: The Quest to Rediscover Microsoft's Soul and Imagine a Better Future for Everyone
- Autonomous: A Novel
- The 10X Rule: The Only Difference Between Success and Failure
- Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are
- Life After Google: The Fall of Big Data and the Rise of the Blockchain Economy

You are on page 1of 4

Newtons Algorithm

Newton's algorithm, alternately called the Newton-Raphson method, is a numerical method for solving equations of the type f(x)=0. It has numerous applications in finance, and we will use it to determine the volatility surface for a call option using the Black Scholes VBA function. The method applies when we have a close approximation for a solution to the equation. The method assumes that the tangent to the graph at our approximation intersects the x-axis closer to the solution of the equation, i.e. closer to where the line we are evaluating intersects the x-axis. By solving for where the tangent intersects the xaxis, and repeating the process from that point, we get closer and closer to the actual solution of the equation. Let's say we're at our approximate solution, x0. The value of y-axis at this point is y = f(x0). We know that the tangent has gradient f'(x) - the same gradient as the line, from the definition of a tangent. We also know that a univariate linear function takes the form f(x) = mx + c, where m is the gradient, x is the horizontal displacement from the starting point, and c is the vertical displacement from the starting point. As such, we have y = f'(x0)(x-x0) + f(x0) as the line of the tangent. We solve this for y = 0 in order to get the next guesstimate of the solution to f(x) = 0. The above is the simpler method of interpretation, but the statement f(x) = mx+c is actually derived from the more generalised Taylor's series expansion where a continuous, differentiable function f may be expanded about a point c as follows: f(x) =f(c)+f'(c)(x-c)+f''(c)/2!*(xc)^2+... This is the univariate version of the Taylor expansion, but it will suffice for finding, for example, volatility smiles since we assume that all other variables remain constant. Since the equation is linear, no second order derivatives exist so these fall away, leaving f(x) =f(c)+f'(c)(x-c). In our example, x0=c, giving y = f'(x0)(x-x0) + f(x0) The equation of the intersection of the tangent with the y-axis is given by the following: 0 = f'(x0)(x1-x0) + f(x0) We then solve for x1 x1 = x0 - (f(x0)/f'(x0) From this we can induce (though actual proof is out of scope here), that xn+1 = xn - f(xn)/f'(xn) , which is the formula for Newton's method. The formula for Newton's method works in cases where the function is differentiable, and where the gradient is not equal to zero.

VBA implementation of Newton's algorithm

Here is an implementation of Newton's algorithm for a simple function, f(x) = x2 - 3. For the volatility surface version, func(x_n) will be replaced by the Black Scholes VBA pricing function, and func_dash(x_n) will be replaced by the VBA function for calculating vega, the first derivative of the option price with respect to volatility. Function Newton(Seed As Double, Precision As Double) As Double Dim x_next As Double, x_n As Double, error_val As Double Dim ctr As Integer x_n = Seed ctr = 0 Do x_next = x_n - func(x_n) / func_dash(x_n) error_val = x_next - x_n x_n = x_next ctr = ctr + 1 Loop Until (Abs(error_val) <= Precision Or ctr = 1000) Newton = x_next End Function Function func(x_n) As Double func = x_n ^ 2 - 3 End Function Function func_dash(x_n) As Double func_dash = 2 * x_n End Function

You can get complete Excel apps from VBA Develeoper.net containing the code in this document, customisation, VBA development of any Excel, Access and Outlook apps, as well as C# and C++ add-ins and technical documentation.

How to build a Black Scholes VBA Option Pricer

How to build a Black Scholes C# Option Pricer How to build a Black Scholes VBA Option Pricer for FX Options How to build a Black Scholes VBA Option Pricer for Equity Options How to build a Black Scholes VBA Option Pricer using Monte Carlo Simulation How to build a Black Scholes VBA Option Pricer for Binary Options How to build a Black Scholes VBA Option Pricer for Equity Barrier Options How to build a Black Scholes VBA Option Pricer for Exotic Asian Options How to build a Black Scholes VBA Option Pricer for Exotic Lookback Options How to build an Equity Option Pricer using the Binomial Tree in Excel VBA How to code a Choleskey Decomposition in VBA (Numerical Methods for Excel) 3 ways to sort in VBA How to Code a Multivariate Value at Risk (VaR) VBA Monte Carlo Simulation How To Code the Newton-Raphson Method in Excel VBA How to Model Volatility Smiles, Volatility Term Structure and the Volatility Surface in Excel VBA How To Write Use Cases for a Portfolio Reporting VBA Tool How To Write a User Interface Model For a Portfolio Reporting VBA Tool How To Create a Semantic Object Model For a Portfolio Reporting VBA Tool How To Normalise a Database For VBA Apps How To Create a Database using SQL Scripts for a Portfolio Reporting VBA App How to Write Stored Procedures in SQL/Access/VBA for a Portfolio Reporting VBA App How to Use Cursors in SQL for a Portfolio Reporting VBA Tool How to Move Data from Access to Excel with SQL for a Portfolio Reporting VBA App

Portfolio Reporting VBA Tool: Inserting Data into SQL/Access Databases from Excel Portfolio Reporting VBA Tool: Connecting Excel with SQL & Access Databases How To Design Classes For an Option Pricer in VBA: UML Concepts How To Design Classes for Object Orientated VBA Programming

- Newton-Raphson Method in Excel VBAUploaded byMagno Felipe Teixeira
- Levenberg Marquardt in Excel Excel VBAUploaded bypaul_fredric3173
- TTS Turbo Macros v14!0!2Uploaded byJack Jacinto
- Excel Dashboards & ReportUploaded bylan_cruzz@yahoo.com
- Motivation at MicrosoftUploaded byshazarafia
- ExcelIsFun![1]Uploaded byAirish Sashidharan
- 30 Most Useful Excel Keyboard ShortcutsUploaded byasif usman
- (IOP concise physics) Liengme, Bernard V - Excel VBA for physicists a primer-IOP Publishing (2016).pdfUploaded byJoaquin Sanchez JS
- Rewards and Recognisation Practise Followed in Modern CompaniesUploaded byalukkaa
- AsrUploaded byYona
- (IOP Concise Physics) Liengme, Bernard v - Excel VBA for Physicists a Primer-IOP Publishing (2016)Uploaded byDwinaRahmayani
- VBA IntiUploaded bykprdeepak
- Computer Excel, Power PointUploaded byAsjad Jamshed
- Excel Shortcut KeysUploaded bySidhartha Sethi
- Spreadsheet-DSS-Cover-Pages.pdfUploaded bymartito12345
- Chapter 5Uploaded byHiếu Nguyễn Minh Hoàng
- Static Replication of Barrier OptionsUploaded byalex1035
- vba syllabusUploaded byvasusree
- Rockwell Software RSView32 FactoryTalk Migration Guide en 0811Uploaded byWilliam Navas
- MCTP 70-178 MS Project 2010 Study PlanUploaded byIhab Salem
- Tips and Tricks for Oracle FsgsUploaded byssunils7
- Copy of Excelx2-Waterfall_v2_5.xlsUploaded byLiew Chee Kiong
- excel_exercise2.xlsxUploaded byTon Delfinado
- Format Macro Guide 02aUploaded byRox31
- acessUploaded by2009tamer6138
- Excel-Formulas-A-Quick-List.pdfUploaded byIrfan Abbasi
- EPW Help GuideUploaded byToletol3
- 2001 Excel Design Audit TipsUploaded bycoolmanz
- Fengler Implied Vol SmoothingUploaded bykyleleefake
- oficcwnUploaded byLola hrnz

- Life and researchUploaded byStefano Cicco
- registros OPCUploaded byJose Mamani
- 7.Simple ClassificationUploaded byironchefff
- 2001 Executive SummaryUploaded byjoeborderline
- Sample Audit Report 2012.pdfUploaded byengrrahman3135
- Org. Stress-coping StrategiesUploaded byrkbaai
- ESA 1st Elimination QuestionsUploaded byJimmyorajay
- Gargi YadavUploaded bysk9125770027
- Social Networks in Later LifeUploaded byCornel
- Quis Home CareUploaded byAdam Kostradam
- Q4 Structural EngineerUploaded bypaul macharia
- Marko Tarabar Školski RadUploaded byNermina Kereš
- BI Modelling in Visual ComposerUploaded byRajesh Rai
- kindergarten open disclosure document 2017-18Uploaded byapi-280356559
- Communication System Lab ManualUploaded byFawad Hassan
- Epm-xp Standard 1.0.7.8Uploaded byCalandrasReyCalandrasrey
- International-Relations-Theory-E-IR.pdfUploaded byJoão Costa
- Blackboard Learn 9.1 Installation GuideUploaded bygesn
- Contoh kerangka JURNALUploaded byDike Bayu Magfira
- Energyplus vs EquestUploaded byAbdry50
- SID Theorem_Pham Kim HungUploaded byneversaynever99
- GU-611 - PDO Guide to Engineering Standards and Procedures (2012)Uploaded byLivingstone Arjunan
- Marshall McLuhan in DetailUploaded byasirovina
- Wittgenstein and AnthropologyUploaded byVineet Rathee
- Journal of Bio MetricsUploaded byshvmkushwah55
- qmap.pdfUploaded byAlvaro Bastidas
- Astronomical Significance of NiluralluUploaded byAganooru Venkateswarulu
- Practical Exam Instructions 178.1 and 178.2Uploaded byMurray Peart
- GEAS Mar2014 TH2 - SolutionsUploaded byLeoneil Angelo Abreu
- Recovering the US Hispanic Literary Heritage, Vol VII edited by Gerald E. Poyo and Tomas Ybarra-FraustoUploaded byArte Público Press

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.