Skip to content

Instantly share code, notes, and snippets.

@tschager
Last active August 29, 2015 14:09
Show Gist options
  • Save tschager/94a8c204bbc046112f05 to your computer and use it in GitHub Desktop.
Save tschager/94a8c204bbc046112f05 to your computer and use it in GitHub Desktop.
Kostenvergleich Südtirolpass
tarif_old <- function(x) {
min(x,1000) * 8 + min(max(x-1000,0),9000) * 4 + min(max(x-10000,0),10000) * 2
}
tarif_new <- function(x) {
min(x,1000) * 12 + min(max(x-1000,0),1000) * 8 + min(max(x-2000,0),8000) * 3 + min(max(x-10000,0),10000) * 2
}
par(mfrow=c(1,2))
plot(1:11000,sapply(1:11000,tarif_old)/100,type='l',col='blue',ylab='Euro',xlab='km pro Jahr', main='Kostenvergleich Südtirol Pass')
lines(1:11000,sapply(1:11000,tarif_new)/100,col='red')
legend("topleft", legend = c("old", "new"), col=c('red','blue'),lty = c(1, 1))
plot(1:11000,sapply(1:11000,tarif_new)/100-sapply(1:11000,tarif_old)/100,type='l',ylab='Euro',xlab='km pro Jahr', main='Mehrkosten Südtirol Pass')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment