
Antwort1
Hier ist ein Anfang mitpgfplots
\documentclass[border=1cm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ymin=0,
ymax=7,
xmin=0,
xmax=100,
domain=0:100,
samples=200,
axis lines=left,
clip=true,
clip mode=individual]
\addplot [black] {ln(x) + 1} node (plot1) {};
\node [right] at (plot1) {$\ln(n) + 1$};
\addplot [black] {ln(x) +(1/x)} node (plot2) {};
\node [right] at (plot2) {$\ln(n) + \frac{1}{n}$};
\end{axis}
\end{tikzpicture}
\end{document}
Antwort2
Beachten Sie, dass es hier nur eine Teilsumme gibt.
Dies ist eine Darstellung mit Asymptote. Ich denke, dass ein kleiner Wert eine n
bessere Visualisierung ermöglicht.
Für eine Folge reeller Zahlen a[i]
können wir eine zugehörige Folge von Partialsummen berechnen H[i]
mit
real[] H=partialsum(a);
und nehmen Sie dann eine Reihe pointsH
von entsprechenden Punkten (i,H[i])
und verbinden Sie diese dann durch gerade Linien, operator--
wie vom OP gewünscht
path pH=operator--(...pointsH);
wobei drei Punkte ...pointsH
alle Punkte von bedeuten pointsH
.
Vollständiger Code
// http://asymptote.ualberta.ca/
usepackage("amsmath");
unitsize(1cm,2.5cm);
size(8cm);
import graph;
import math;
int n=10;
real[] a; a[0]=0;
for(int i=1; i<n; ++i) a[i]=1/i;
real[] H=partialsum(a);
pair[] pointsH; // points of the partial sum
for(int i=1; i<H.length; ++i) pointsH.push((i,H[i]));
path pH=operator--(...pointsH); // joining by straight segments
draw(Label("$H_n=\sum\limits_{k=1}^n\dfrac{1}{k}$",align=3E,EndPoint),pH);
real f(real x){return log(x) + 1;} // the upper function
real g(real x){return log(x) + 1/x;} // the lower function
real s=.25;
path pf=graph(f,s,n-1);
path pg=graph(g,s,n-1);
draw(Label("$1+ \ln x$",EndPoint,align=NE),pf,blue);
draw(Label("$\dfrac{1}{x}+ \ln x$",EndPoint,align=SE),pg,purple);
dot(pointsH,red);
axes("$x$","$y$");
draw((1,1)--(1,0)^^(1,1)--(0,1),dashed+gray);
label("$1$",(1,0),S);
label("$1$",(0,1),W);
//label("$1+\ln n <1+\dfrac{1}{2}+\dfrac{1}{3}+\codts + \dfrac{1}{n}<\dfrac{1}{n}+\ln n$",truepoint(S)+(0,-1));
Eine andere Möglichkeit zur Veranschaulichung:
// http://asymptote.ualberta.ca/
usepackage("amsmath");
unitsize(1cm,3cm);
size(8cm);
import graph;
import math;
real f(real x){return log(x) + 1;} // the upper function
real g(real x){return log(x) + 1/x;} // the lower function
int n=20;
real[] h,A,B; h[0]=0; A[0]=0; B[0]=0;
for(int i=1; i<n; ++i) {
h[i]=1/i;
A[i]=f(i);
B[i]=g(i);
}
real[] H=partialsum(h);
pair[] pointsH, pointsA, pointsB; // points of the partial sum
for(int i=1; i<H.length; ++i){
pointsH.push((i,H[i]));
pointsA.push((i,A[i]));
pointsB.push((i,B[i]));
}
path pH=operator--(...pointsH); // joining by straight segments
path pA=operator--(...pointsA);
path pB=operator--(...pointsB);
draw(Label("$H_n=\sum\limits_{k=1}^n\dfrac{1}{k}$",align=3E,EndPoint),pH);
draw(Label("$\ln n+1$",align=3NE,EndPoint),pA);
draw(Label("$\ln n+\dfrac1x$",align=3SE,EndPoint),pB);
dot(pointsH,red);
dot(pointsA,blue);
dot(pointsB,purple);
axes("$x$","$y$");
draw((1,1)--(1,0)^^(1,1)--(0,1),dashed+gray);
label("$1$",(1,0),S);
label("$1$",(0,1),W);