Created
February 13, 2026 10:04
-
-
Save santhoshtr/8f6cf638662be8f48a417584bb6259b2 to your computer and use it in GitHub Desktop.
Untitled Metapost Sample #metapost-sandbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| u := 1cm; | |
| path curve; | |
| curve := (0,-1.5u) .. controls (2u,-1.2u) and (4u,0) .. (5.5u,2.5u); | |
| % РИСУНОК 1 | |
| beginfig(1); | |
| drawarrow (-0.5u,0)--(6.5u,0); | |
| label.bot("x", (6.5u,0)); | |
| draw curve withpen pencircle scaled 1.5bp; | |
| pair A, B; | |
| A := point 0 of curve; | |
| B := point length(curve) of curve; | |
| draw (0,0)--A dashed evenly; | |
| draw (5.5u,0)--B dashed evenly; | |
| label.top("a", (0,2bp)); | |
| label.bot("b", (5.5u,2bp)); | |
| label.bot("A", A - (0, 2bp)); | |
| label.top("B", B + (0, 2bp)); | |
| pair An; | |
| An := point 0.25 of curve; | |
| fill fullcircle scaled 3.5bp shifted An; | |
| draw (xpart An, 0)--An dashed evenly; | |
| label.top(btex $x_n$ etex, (xpart An, 2bp)); | |
| label.bot(btex $A_n(x_n; f(x_n))$ etex, An - (0, 5bp)); | |
| draw An--B withpen pencircle scaled 0.7bp; | |
| pair Xnext; | |
| Xnext = whatever[An, B]; | |
| ypart Xnext = 0; | |
| fill fullcircle scaled 3.5bp shifted Xnext; | |
| label.top(btex $x_{n+1}$ etex, Xnext + (-2bp, 2bp)); | |
| endfig; | |
| % РИСУНОК 2 | |
| beginfig(2); | |
| path box; | |
| box := (-1u, -2u) -- (7u, -2u) -- (7u, 4u) -- (-1u, 4u) -- cycle; | |
| drawarrow (-0.5u,0)--(6.5u,0); | |
| label.bot("x", (6.5u,0)); | |
| draw curve withpen pencircle scaled 1.5bp; | |
| label.top(btex $y=f(x)$ etex, point 0.2 of curve + (-10bp,10bp)); | |
| pair A, B; | |
| A := point 0 of curve; | |
| B := point length(curve) of curve; | |
| draw (0,0)--A dashed evenly; | |
| draw (5.5u,0)--B dashed evenly; | |
| label.top("a", (0,2bp)); | |
| label.bot("b", (5.5u,2bp)); | |
| label.bot("A", A - (0, 2bp)); | |
| label.top("B", B + (0, 2bp)); | |
| pair C; | |
| C := point 0.58 of curve; | |
| ypart C := 0; | |
| fill fullcircle scaled 3.5bp shifted C; | |
| label.top("C", C + (0,3bp)); | |
| pair Bzero; | |
| Bzero := point 0.90 of curve; | |
| fill fullcircle scaled 3.5bp shifted Bzero; | |
| label.top(btex $B_0$ etex, Bzero + (0,3bp)); | |
| draw (xpart Bzero,0)--Bzero dashed evenly; | |
| label.bot(btex $x_0$ etex, (xpart Bzero, 0)); | |
| pair tangent_dir; | |
| tangent_dir := direction 1 of curve; | |
| pair Xone; | |
| Xone = whatever[Bzero, Bzero + tangent_dir]; | |
| ypart Xone = 0; | |
| draw Bzero--(Xone - 0.2 * (Bzero - Xone)) withpen pencircle scaled 0.7bp; | |
| fill fullcircle scaled 3.5bp shifted Xone; | |
| label.bot(btex $x_1$ etex, Xone - (0,3bp)); | |
| pair Bone; | |
| path vert_line; | |
| vert_line = (Xone -- Xone + (0, 10u)); | |
| Bone = curve intersectionpoint vert_line; | |
| fill fullcircle scaled 3.5bp shifted Bone; | |
| label.ulft(btex $B_1$ etex, Bone + (-2bp,2bp)); | |
| draw Xone--Bone dashed evenly; | |
| numeric t_one; | |
| (t_one) = xpart (curve intersectiontimes vert_line); | |
| pair tangent_dir_one; | |
| tangent_dir_one := direction t_one of curve; | |
| pair Xtwo; | |
| Xtwo = whatever[Bone, Bone + tangent_dir_one]; | |
| ypart Xtwo = 0; | |
| draw Bone--(Xtwo - 0.4 * (Bone - Xtwo)) withpen pencircle scaled 0.7bp; | |
| fill fullcircle scaled 3.5bp shifted Xtwo; | |
| label.bot(btex $x_2$ etex, Xtwo - (2bp,3bp)); | |
| setbounds currentpicture to box; | |
| endfig; | |
| % РИСУНОК 3 | |
| beginfig(3); | |
| drawarrow (-0.5u,0)--(6.5u,0); | |
| label.bot("x",(6.5u,0)); | |
| draw curve withpen pencircle scaled 1.5bp; | |
| label.top(btex $y=f(x)$ etex, point 0.2 of curve + (-10bp,10bp)); | |
| draw (0,0)--A dashed evenly; | |
| draw (5.5u,0)--B dashed evenly; | |
| label.top("a",(0,2bp)); | |
| label.bot("b",(5.5u,2bp)); | |
| label.bot("A", A - (0,2bp)); | |
| label.top("B", B + (0,2bp)); | |
| fill fullcircle scaled 3bp shifted C; | |
| label.top("C", C + (0,3bp)); | |
| pair Bn; | |
| Bn := point 0.85 of curve; | |
| fill fullcircle scaled 3bp shifted Bn; | |
| label.top(btex $B_n$ etex, Bn + (0,3bp)); | |
| draw (xpart Bn,0)--Bn dashed evenly; | |
| label.bot(btex $x_n$ etex, (xpart Bn,0)); | |
| pair tangent_dir_n; | |
| tangent_dir_n := direction 0.9 of curve; | |
| pair XnextThree; | |
| XnextThree = whatever[Bn, Bn + tangent_dir_n]; | |
| ypart XnextThree = 0; | |
| draw Bn--(XnextThree - 0.2 * (Bn - XnextThree)) withpen pencircle scaled 0.7bp; | |
| fill fullcircle scaled 3bp shifted XnextThree; | |
| label.bot(btex $x_{n+1}$ etex, XnextThree - (2bp,3bp)); | |
| endfig; | |
| end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment