Introduction to “Numerical Methods and Optimization in Finance”

[This article was first published on Portfolio Probe » R language, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The book is by Manfred Gilli, Dietmar Maringer and Enrico Schumann.  I haven’t actually seen the book, so my judgement of it is mainly by the cover (and knowing the first two authors).

The parts of the book closest to my heart are optimization, particularly portfolio optimization, and particularly particularly portfolio optimization via heuristic algorithms.  However, the book covers several other topics as well.

R Package

There is an accompanying R package for the book, which can be installed via:


I have only just glanced through the package, so I don’t know much about it either.  In addition to the optimization functions discussed below there are a few functions concerning options.

Optimization functions

There are functions in the package for optimization via:

  • a traditional genetic algorithm (GAopt)
  • a differential evolution algorithm (DEopt)
  • a particle swarm algorithm (PSopt)
  • a threshold accepting algorithm (TAopt)
  • a stochastic local search algorithm (LSopt)
  • grid search (gridSearch)

Here is my take on why the traditional genetic algorithm is horrible. The Portfolio Probe computing engine includes something similar to the differential evolution algorithm.

Programming note

One rather non-”R”ish thing that I noted was in function tfTrefethen (“tf” as in “test function”).  The function just has x as an argument and it starts with:

y <- x[2L]
x <- x[1L]

That is, it is not vectorized and the single argument contains the value of both logical arguments.  One way to make this look more typically R would be:

function(x, y=NULL) {
   if(!length(y)) {
      y <- x[,2]
      x <- x[,1]

Then the way to get the behavior of the original function would be to say:


instead of:


Subscribe to the Portfolio Probe blog by Email

To leave a comment for the author, please follow the link and comment on their blog: Portfolio Probe » R language. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)