Dans l'exemple ci-dessous, les hachures sous la courbe occupent un rectangle. J'aurai voulu limiter la zone hachurée sous la courbe sur un espace moins important et sans que cela ai l'aspect d'une zone rectangulaire. Comment puis-je faire? (sans forcément prendre une courbe parallèle sous la courbe comme limite inférieure des hachures).
Deuxième problème : je ne parviens pas à hachurer toute la zone sous les courbes Cg-Cf-Cg sur l'intervalle [-4;3]. (Nous savons bien que ca ne correspond pas à f(x)<=g(x) sur [-4;3], mais sinon par curiosité comment faire de telles hachures d'un seul coup?)
Merci pour vos suggestions.
Bien cordialement.
DK
*** Pour masquer/découvrir le code Asymptote qui a permis de créer la figure, il faut cliquer dessus. ;-) ***
- CODE ASYMPTOTE de la figure ci-dessus : Tout sélectionner
- import graph_pi;
- import patterns;
- usepackage("relsize");
- usepackage("mathrsfs");
- // ----- Définition et tracé de la grille (+axes) -----------------
- real xmin=-4, xmax=2, ymin=-8 , ymax=6 ;
- graphicrules( xunit=.8cm, yunit=.8cm, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax );
- grid(xStep=1, xstep=.5,
- yStep=1, ystep=.5,
- pTick=.7bp+black,
- ptick=linetype("0 " + string(1mm), offset=0, scale=false, adjust=false)+.7bp+.4white,
- above=false
- );
- cartesianaxis(
- p=currentpen,
- xticks=Ticks(Label(currentpen+fontsize(7),Fill(white)),
- Step=1, step=.5,
- NoZero,
- ptick=grey),
- yticks=Ticks(Label(currentpen+fontsize(7), align=0.75*NW,Fill(white)),
- Step=1, step=.5,
- NoZero,
- ptick=grey),
- viewxaxis=true,
- viewyaxis=true,
- arrow=Arrow
- );
- labeloij(p=1bp+.5*red,arrow=Arrow(SimpleHead,5bp),dot);
- // ----- Définition des fonctions -----------------
- real f(real x) {return x^2+3*x+1 ;}
- real g(real x) {return -2*x^2-4*x+3 ;}
- // ----- Tracé des courbes Cf, Cg -----------------
- draw(graph(f, -4,1.1, n=500),1bp+red);
- draw(graph(g, -3.5,3/2, n=500),1bp+blue);
- real marge=.5;
- xlimits(xmin-marge,xmax+marge,Crop);
- ylimits(ymin-marge,ymax+marge,Crop);
- // ----- Quelques textes et constructions sur la figure -----------------
- label("$\mathscr{C}_f$",(-3.5,f(-3.5)),NE);
- label("$\mathscr{C}_g$",(-3/2,g(-3/2)),NW);
- label("\relsize{-2}{BMA - option : \'Eb\'enisterie -- DM mars 2012}", (-1,-8.35),UnFill);
- // Points d'intersection entre les deux courbes sur l'intervalle [-4;3] :
- real[][] pts=intersections(graph(f),graph(g));
- pair I=point(graph(f),pts[0][0]),
- J=point(graph(f),pts[1][0]);
- dot("$I$",I,NW,3bp+black);
- dot("$J$",J,E,3bp+black);
- //
- // ----- Les hachures pour f(x) <= g(x) -----------------
- path zonehachure = buildcycle( (I.x,g(-3.5))--I, graph(f,I.x,J.x), J--(J.x,g(3/2))--(I.x,g(-3.5)) );
- add("hachure",hatch(H=1mm,dir=SE,gray));
- fill(zonehachure,pattern("hachure"));