This file has been superseded by Image:Convex Function.svg.
It is recommended that the other file be used.
Reason: SVG version available.
|
Description |
graph of a convex function (which? see the source code)
|
Source |
created with GNU R, see source below. I tried somehow to replicate the image mentioned in "other versions"
|
Date |
14 nov. 2006
|
Author |
Thomas Steiner
|
Permission
(Reusing this image) |
Thomas Steiner put it under the CC-by-SA 2.5.
|
Other versions |
,
|
Read at User_talk:AtonX#SVG_of_convex_function, why I prefer the .png to the .svg
R-source code:
from=-0.9
to=2.05
a=seq(from,to,length=100)
con<-function(p) {
p^2+0.1
}
png(filename="Convex_Function.png", width=1200, height=800, pointsize=12)
par(lwd=2,bg="whitesmoke",font=3)
plot(a,con(a),type="l",col="navy",lwd=3,xlab="",ylab="", axes=FALSE)
st=par("usr")[1]+0.06
ady=c(-0.2,-0.5)
adx=c(1.25,-0.75)
x=-0.7
y=1.98
t=0.3
z=x*t+y*(1-t)
m=((con(y)-con(x))/(y-x))*z + con(x)-((con(y)-con(x))/(y-x))*x
sz=3.2
##gerade
lines(c(x,y),c(con(x),con(y)),col="magenta",lwd=3)
## x
lines(c(x,x),c(0,con(x)),type="l",lty=2,col="grey")
text(x,0,labels="x",adj=adx,cex=sz)
lines(c(st,x),c(con(x),con(x)),col="darkgrey",lty=2)
text(st,con(x),labels="f(x)",adj=ady,cex=sz)
lines(x,con(x),type="p",lwd=3,col="red")
## y
lines(c(y,y),c(0,con(y)),type="l",lty=2,col="grey")
text(y,0,labels="y",adj=adx,cex=sz)
lines(c(st,y),c(con(y),con(y)),col="darkgrey",lty=2)
text(st,con(y),labels="f(y)",adj=ady,cex=sz)
lines(y,con(y),type="p",lwd=3,col="red")
## zwischenstelle z
lines(c(z,z),c(0,con(z)),type="l",lty=2,col="grey")
text(z+0.2,0,labels="tx+(1-t)y",adj=adx,cex=sz)
lines(c(st,z),c(con(z),con(z)),col="darkgrey",lty=2)
lines(c(z,z),c(0,m),type="l",lty=2,col="darkgrey")
lines(c(st,z),c(m,m),col="grey",lty=2)
text(st-0.13,con(z),labels="f( tx+(1-t)y )",adj=ady,cex=sz)
text(st-0.13,m,labels="t f(x) + (1-t) f(y)",adj=ady,cex=sz)
lines(z,con(z),type="p",lwd=3,col="red")
lines(z,m,type="p",lwd=3,col="red")
arrows(st-0.05,0.05,par("usr")[2]-0.05,0.05)
arrows(st,0,st,par("usr")[4])
dev.off()
Click on a date/time to view the file as it appeared at that time.
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):