| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/ArashPartow/exprtk/master/exprtk_simple_example_21.cpp | [Back] [Original] |
/*
**************************************************************
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 21 *
* Author: Arash Partow (1999-2025) *
* URL: https://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
* Free use of the Mathematical Expression Toolkit Library is *
* permitted under the guidelines and in accordance with the *
* most current version of the MIT License. *
* https://www.opensource.org/licenses/MIT *
* SPDX-License-Identifier: MIT *
* *
**************************************************************
*/
#include
#include
#include "exprtk.hpp"
template
void binomial_option_pricing_model()
{
typedef exprtk::symbol_table symbol_table_t;
typedef exprtk::expression expression_t;
typedef exprtk::parser parser_t;
const std::string european_option_binomial_model_program =
" var dt := t / n; "
" var z := exp(r * dt); "
" var z_inv := 1 / z; "
" var u := exp(v * sqrt(dt)); "
" var p_up := (z * u - 1) / (u^2 - 1); "
" var p_down := 1 - p_up; "
" "
" var option_price[n + 1] := [0]; "
" "
" for (var i := 0; i = 0; j -= 1) "
" { "
" for (var i := 0; i
| Web Proxy Viewer | New URL | Original Page |