precision - Composing two functions in R gives different result than a new function enclosing both -


i tried @ logistic map

logmap <- function(x){ r <- 0.5 4*r*x*(1-x)} 

and compositions such as:

logmap2_a <- function(x){   logmap(logmap(x))} 

of course, can directly write new function composes logmap itself:

logmap2 <- function(x){ r <- 0.5 16*r*r*x*(1-x)*(1-16*r*r*x*(1-x))} 

now, plotting 2 things not show same curve:

curve(logmap2, from=0, to=1) curve(logmap2_a, from=0, to=1) 

the first figure shows result of logmap2, second of logmap2_a.

this picture wanted have, power of 2 of logistic map (function logmap2)

this curve of composition should yield same curve power of 2 of logistic map (function logmap2_a)

my first idea problem arises due precision of returned data, cannot imagine problem reasonably large numbers. idea going on?

logmap2 <- function(x){ r <- 0.5 16*r*r*x*(1-x)*(1-4*r*x*(1-x))} 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -