Dosiero:Convex Function.png
El Vikipedio
| | Tiu dosiero elĉerpiĝas de la Vikimedia Komunejo, kolekto de libere uzeblaj bildoj. Vidu ĝian paĝon ĉe la Komunejo por permesinformo kaj historio de redaktado. |
| 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 | |
| Permission |
Thomas Steiner put it under the CC-by-SA 2.5. |
| Other versions | Image:Convex-function-graph-1.png by en:User:CSTAR, uploaded by User:Maksim |
| This file is licensed under the Creative Commons Attribution ShareAlike 2.5 License |
R-source code:
from=0.6
to=2.05
a=seq(from,to,length=100)
con<-function(p) {
exp(p)^2
}
png(filename="Convex_Function.png", width=1024, height=768, pointsize=12)
par(cex=1.3,lwd=2,bg="whitesmoke")
plot(a,con(a),type="l",col="navy",lwd=3,xlab="",ylab="", axes=FALSE)
st=par("usr")[1]+0.1
ady=c(-0.1,-0.5)
adx=c(-0.25,-1.1)
x=0.75
y=2.03
t=0.44
z=x*t+y*(1-t)
m=((con(y)-con(x))/(y-x))*z + con(x)-((con(y)-con(x))/(y-x))*x
##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)
lines(c(st,x),c(con(x),con(x)),col="darkgrey",lty=2)
text(st,con(x),labels="f(x)",adj=ady)
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)
lines(c(st,y),c(con(y),con(y)),col="darkgrey",lty=2)
text(st,con(y),labels="f(y)",adj=ady)
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,labels="xt+y(1-t)",adj=adx)
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,con(z),labels="f(xt+y(1-t))",adj=ady)
text(st,m,labels="t f(x) + (1-t) f(y)",adj=ady)
lines(z,con(z),type="p",lwd=3,col="red")
lines(z,m,type="p",lwd=3,col="red")
arrows(st,con(st),par("usr")[2],con(st))
arrows(st,con(st),st,par("usr")[4])
dev.off()
Ligiloj al la dosiero
La jenaj paĝoj ligas al ĉi tiu dosiero:

