« M42: The Orion Nebula | Main | FAS Newsletter #1 »

Integration in R

A reminder to myself of something I did quite a while go, how to do integration with [R].

dj <- c(6.8543973e+00,6.0742026e+00, 5.1180908e+00, 6.8335044e+00, 5.5119610e+00, 5.5103389e+00, 4.8272714e+00, 6.3162468e+00, 4.9450749e+00, 6.0684488e+00, 3.9246411e+00, 5.1356979e+00, 5.3176933e+00, 5.0402740e+00)

integrand <- function(i) {sum(dj[i] - i - 5 )^2}
integrate(Vectorize(integrand), lower = 0, upper = 10)

Of course the [R documentation] is of great use too.


TrackBack

TrackBack URL for this entry:
http://krioma.net/cgi-bin/MT-3.38/mt-tb.cgi/568

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on January 26, 2012 8:45 AM.

The previous post in this blog was M42: The Orion Nebula.

The next post in this blog is FAS Newsletter #1.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.38