Tracé de l’expérience du poids de l’Hospital en noir et blanc (fiziko)

Auteur ou autrice : Sergey Slyusarev.

Mise en ligne le 28 janvier 2023

Image du résultat de l’exemple

Cet exemple illustre l’utilisation du package fiziko présent sur le CTAN. Ce package propose des macros permettant de produire des illustrations en noir et blanc pour des manuels de physique dans un style imitant les anciens manuels de physique . Il fournit des fonctions primitives pour tracer des choses élémentaires (lignes ,cercles, tubes, etc.). Il fournit aussi des fonctions pour tracer quelques objets standards de la physique. Les exemples sont empruntés à la documentation et au blog https://habr.com/en/post/454376/.

Code


%@Auteur: Sergey Slyusarev
%@Année: 2019

input fiziko.mp;

vardef lHopitalPulley (expr AB, l, m) = % distance AB between the suspension points of the ropes and their lengths l and m. “Why no units of length?”, you may ask. It's because some calculations inside can cause arithmetic overflow in MetaPost.
save A, B, C, D, E, o, a, x, y, d, w, h, support;
image(
pair A, B, C, D, E, o[];
path support;
numeric a, x[], y[], d[], w, h;
x1 := (l**2 + abs(l)*((sqrt(8)*AB)++l))/4AB; % the solution
y1 := l+-+x1; % second coordinate is trivial
y2 := m - ((AB-x1)++y1); % as well as the weight's position
A := (0, 0);
B := (AB*cm, 0);
D := (x1*cm, -y1*cm);
C := D shifted (0, -y2*cm);
d1 := 2/3cm; d2 := 1cm; d3 := 5/6d1; % diameters of the pulley, weight and the pulley wheel
w := 2/3cm; h := 1/3cm; % parameters of the wood block
o1 := (unitvector(C-D) rotated 90 scaled 1/2d3);
o2 := (unitvector(D-B) rotated 90 scaled 1/2d3);
E := whatever [D shifted o1, C shifted o1]
= whatever [D shifted o2, B shifted o2]; % pulley's center
a := angle(A-D);
support := A shifted (-w, 0) -- B shifted (w, 0) -- B shifted (w, h) -- A shifted (-w, h) -- cycle;
draw woodenThing(support, 0); % wood block everything is suspended from
draw pulley (d1, a - 90) shifted E; % the pulley
draw image(
draw A -- D -- B withpen thickpen;
draw D -- C withpen thickpen;
) maskedWith (pulleyOutline shifted E); % ropes should be covered with the pulley
draw sphere.c(d2) shifted C shifted (0, -1/2d2); % sphere as a weight
dotlabel.llft(btex $A$ etex, A);
dotlabel.lrt(btex $B$ etex, B);
dotlabel.ulft(btex $C$ etex, C);
label.llft(btex $l$ etex, 1/2[A, D]);
)
enddef;

beginfig(18);
draw lHopitalPulley (3, 5/2, 3);
endfig;

end.

Mots clés : physiqueillustrationfizikoold schoolexpérience

Cet exemple fait partie de la collection d’exemples Documentation de fiziko.

Fichiers

Télécharger l’archive complète