<commit_before><commit_msg>Added Plot for Monte-Carlo paths.<commit_after>package net.finmath.experiments.montecarlo.assetderivativevaluation;

import net.finmath.montecarlo.BrownianMotionFromMersenneRandomNumbers;
import net.finmath.montecarlo.assetderivativevaluation.models.BlackScholesModel;
import net.finmath.montecarlo.process.EulerSchemeFromProcessModel;
import net.finmath.plots.DoubleToRandomVariableFunction;
import net.finmath.plots.PlotProcess2D;
import net.finmath.time.TimeDiscretizationFromArray;

public class BlackSchoesModelPathsPlot {

	public static void main(String[] args) {
		double modelInitialValue = 100.0;	// S(0)
		double modelRiskFreeRate = 0.05; 	// r
		double modelVolatility = 0.20;		// σ

		// Create a model
		var model = new BlackScholesModel(modelInitialValue, modelRiskFreeRate, modelVolatility);

		// Create a corresponding MC process from the model
		var td = new TimeDiscretizationFromArray(0.0, 300, 0.01);
		var brownianMotion = new BrownianMotionFromMersenneRandomNumbers(td, 1, 10000, 3231);
		var process = new EulerSchemeFromProcessModel(model, brownianMotion);

		// Create a function, plotting paths t -> S(t)
		DoubleToRandomVariableFunction paths = time -> process.getProcessValue(td.getTimeIndex(time), 0 /* assetIndex */);

		// Plot 100 of paths against the given time discretization.
		var plot = new PlotProcess2D(td, paths, 100);
		plot.setTitle("Black Scholes model paths").setXAxisLabel("time").setYAxisLabel("value");
		plot.show();
	}
}
{'fraction_non_alphanumeric': 0.09746328437917223, 'fraction_numerical': 0.025367156208277702, 'mean_word_length': 5.574561403508772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4447214', 'n_tokens_mistral': 521, 'n_tokens_neox': 451, 'n_words': 106}