4

I have the following diagrams on which I want to illustrate computing volume of a solid of revolution obtained by revolving the function

y=2e^{-(1/2)x}

from a to b, by the disk (rotation about x-axis) and shell (rotation about y-axis). I tried to adapt a number of posts, without any success.

A brief description of what am trying to do: i) to make a dist (like a coin standing on its edge) of diameter 2f(x) (from y=-f(x) to y=f(x); ii) a shell or washer around the y-axis.

If anyone has some code I could adapt for my purpose, for either or both of the above, I would appreciate.

Since I do not seem to be able to attach the figure, below is the code I used to generate the first figure. Due to space limitation (30000 characters, am not able to include code for the second figure. But it is similar to the first, except this is rotated about the y-axis).

First figure

enter image description here

\documentclass[12pt,tikz]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{shapes.geometric, decorations.pathreplacing, matrix, angles, quotes, arrows, arrows.meta, datavisualization,cd}
\usetikzlibrary{through,calc,intersections}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\begin{document}

\definecolor{xdxdff}{rgb}{0.49019607843137253,0.49019607843137253,1.}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm,scale=1.2]

\draw [color=cqcqcq,, xstep=1.0cm,ystep=1.0cm] (-0.,-3.) grid (5.,3.);
\draw[->,color=black] (-0.,0.) -- (5.,0.);
\foreach \x in {}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};

\draw[->,color=black] (0.,-3.) -- (0.,3.);
\foreach \y in {}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};

\draw[color=black] (0pt,-10pt) node[left] {\footnotesize $0$};
\clip(-0.,-3.) rectangle (5.,3.);
\draw[line width=1.2pt,color=qqwuqq] (0.44724503910049124,1.5992338343215016) -- (0.48790367901871773,1.567050736640756);
\draw[line width=1.2pt,color=qqwuqq] (0.48790367901871773,1.567050736640756) -- (0.5285623189369442,1.535515293952107);
\draw[line width=1.2pt,color=qqwuqq] (0.5285623189369442,1.535515293952107) -- (0.5692209588551707,1.504614472799517);
\draw[line width=1.2pt,color=qqwuqq] (0.5692209588551707,1.504614472799517) -- (0.6098795987733971,1.4743355020131625);
\draw[line width=1.2pt,color=qqwuqq] (0.6098795987733971,1.4743355020131625) -- (0.6505382386916236,1.444665867431168);
\draw[line width=1.2pt,color=qqwuqq] (0.6505382386916236,1.444665867431168) -- (0.6911968786098501,1.4155933067275595);
\draw[line width=1.2pt,color=qqwuqq] (0.6911968786098501,1.4155933067275595) -- (0.7318555185280766,1.3871058043443);
\draw[line width=1.2pt,color=qqwuqq] (0.7318555185280766,1.3871058043443) -- (0.7725141584463031,1.3591915865253146);
\draw[line width=1.2pt,color=qqwuqq] (0.7725141584463031,1.3591915865253146) -- (0.8131727983645296,1.3318391164504486);
\draw[line width=1.2pt,color=qqwuqq] (0.8131727983645296,1.3318391164504486) -- (0.8538314382827561,1.305037089467354);
\draw[line width=1.2pt,color=qqwuqq] (0.8538314382827561,1.305037089467354) -- (0.8944900782009826,1.2787744284193259);
\draw[line width=1.2pt,color=qqwuqq] (0.8944900782009826,1.2787744284193259) -- (0.9351487181192091,1.2530402790671649);
\draw[line width=1.2pt,color=qqwuqq] (0.9351487181192091,1.2530402790671649) -- (0.9758073580374356,1.227824005603168);
\draw[line width=1.2pt,color=qqwuqq] (0.9758073580374356,1.227824005603168) -- (1.016465997955662,1.2031151862553982);
\draw[line width=1.2pt,color=qqwuqq] (1.016465997955662,1.2031151862553982) -- (1.0571246378738886,1.1789036089804128);
\draw[line width=1.2pt,color=qqwuqq] (1.0571246378738886,1.1789036089804128) -- (1.097783277792115,1.1551792672426724);
\draw[line width=1.2pt,color=qqwuqq] (1.097783277792115,1.1551792672426724) -- (1.1384419177103415,1.1319323558788843);
\draw[line width=1.2pt,color=qqwuqq] (1.1384419177103415,1.1319323558788843) -- (1.179100557628568,1.1091532670455728);
\draw[line width=1.2pt,color=qqwuqq] (1.179100557628568,1.1091532670455728) -- (1.2197591975467945,1.0868325862482018);
\draw[line width=1.2pt,color=qqwuqq] (1.2197591975467945,1.0868325862482018) -- (1.260417837465021,1.0649610884502059);
\draw[line width=1.2pt,color=qqwuqq] (1.260417837465021,1.0649610884502059) -- (1.3010764773832475,1.0435297342603245);
\draw[line width=1.2pt,color=qqwuqq] (1.3010764773832475,1.0435297342603245) -- (1.341735117301474,1.0225296661966625);
\draw[line width=1.2pt,color=qqwuqq] (1.341735117301474,1.0225296661966625) -- (1.3823937572197005,1.001952205025933);
\draw[line width=1.2pt,color=qqwuqq] (1.3823937572197005,1.001952205025933) -- (1.423052397137927,0.9817888461763694);
\draw[line width=1.2pt,color=qqwuqq] (1.423052397137927,0.9817888461763694) -- (1.4637110370561535,0.9620312562228238);
\draw[line width=1.2pt,color=qqwuqq] (1.4637110370561535,0.9620312562228238) -- (1.50436967697438,0.9426712694426008);
\draw[line width=1.2pt,color=qqwuqq] (1.50436967697438,0.9426712694426008) -- (1.5450283168926064,0.9237008844406007);
\draw[line width=1.2pt,color=qqwuqq] (1.5450283168926064,0.9237008844406007) -- (1.585686956810833,0.9051122608423792);
\draw[line width=1.2pt,color=qqwuqq] (1.585686956810833,0.9051122608423792) -- (1.6263455967290594,0.8868977160537558);
\draw[line width=1.2pt,color=qqwuqq] (1.6263455967290594,0.8868977160537558) -- (1.667004236647286,0.8690497220856329);
\draw[line width=1.2pt,color=qqwuqq] (1.667004236647286,0.8690497220856329) -- (1.7076628765655124,0.8515609024427112);
\draw[line width=1.2pt,color=qqwuqq] (1.7076628765655124,0.8515609024427112) -- (1.748321516483739,0.8344240290748182);
\draw[line width=1.2pt,color=qqwuqq] (1.748321516483739,0.8344240290748182) -- (1.7889801564019654,0.8176320193895869);
\draw[line width=1.2pt,color=qqwuqq] (1.7889801564019654,0.8176320193895869) -- (1.8296387963201919,0.8011779333252531);
\draw[line width=1.2pt,color=qqwuqq] (1.8296387963201919,0.8011779333252531) -- (1.8702974362384184,0.7850549704823591);
\draw[line width=1.2pt,color=qqwuqq] (1.8702974362384184,0.7850549704823591) -- (1.9109560761566449,0.7692564673131788);
\draw[line width=1.2pt,color=qqwuqq] (1.9109560761566449,0.7692564673131788) -- (1.9516147160748714,0.7537758943677039);
\draw[line width=1.2pt,color=qqwuqq] (1.9516147160748714,0.7537758943677039) -- (1.9922733559930978,0.7386068535950521);
\draw[line width=1.2pt,color=qqwuqq] (1.9922733559930978,0.7386068535950521) -- (2.032931995911324,0.7237430756991806);
\draw[line width=1.2pt,color=qqwuqq] (2.032931995911324,0.7237430756991806) -- (2.0735906358295506,0.7091784175478152);
\draw[line width=1.2pt,color=qqwuqq] (2.0735906358295506,0.7091784175478152) -- (2.114249275747777,0.6949068596335211);
\draw[line width=1.2pt,color=qqwuqq] (2.114249275747777,0.6949068596335211) -- (2.1549079156660036,0.6809225035858677);
\draw[line width=1.2pt,color=qqwuqq] (2.1549079156660036,0.6809225035858677) -- (2.19556655558423,0.6672195697336588);
\draw[line width=1.2pt,color=qqwuqq] (2.19556655558423,0.6672195697336588) -- (2.2362251955024566,0.6537923947162206);
\draw[line width=1.2pt,color=qqwuqq] (2.2362251955024566,0.6537923947162206) -- (2.276883835420683,0.6406354291427605);
\draw[line width=1.2pt,color=qqwuqq] (2.276883835420683,0.6406354291427605) -- (2.3175424753389096,0.6277432352988281);
\draw[line width=1.2pt,color=qqwuqq] (2.3175424753389096,0.6277432352988281) -- (2.358201115257136,0.6151104848989338);
\draw[line width=1.2pt,color=qqwuqq] (2.358201115257136,0.6151104848989338) -- (2.3988597551753625,0.6027319568843912);
\draw[line width=1.2pt,color=qqwuqq] (2.3988597551753625,0.6027319568843912) -- (2.439518395093589,0.5906025352654776);
\draw[line width=1.2pt,color=qqwuqq] (2.439518395093589,0.5906025352654776) -- (2.4801770350118155,0.5787172070070187);
\draw[line width=1.2pt,color=qqwuqq] (2.4801770350118155,0.5787172070070187) -- (2.520835674930042,0.5670710599565236);
\draw[line width=1.2pt,color=qqwuqq] (2.520835674930042,0.5670710599565236) -- (2.5614943148482685,0.5556592808140146);
\draw[line width=1.2pt,color=qqwuqq] (2.5614943148482685,0.5556592808140146) -- (2.602152954766495,0.5444771531427117);
\draw[line width=1.2pt,color=qqwuqq] (2.602152954766495,0.5444771531427117) -- (2.6428115946847215,0.5335200554197508);
\draw[line width=1.2pt,color=qqwuqq] (2.6428115946847215,0.5335200554197508) -- (2.683470234602948,0.5227834591261291);
\draw[line width=1.2pt,color=qqwuqq] (2.683470234602948,0.5227834591261291) -- (2.7241288745211745,0.5122629268750887);
\draw[line width=1.2pt,color=qqwuqq] (2.7241288745211745,0.5122629268750887) -- (2.764787514439401,0.5019541105781647);
\draw[line width=1.2pt,color=qqwuqq] (2.764787514439401,0.5019541105781647) -- (2.8054461543576275,0.49185274964814);
\draw[line width=1.2pt,color=qqwuqq] (2.8054461543576275,0.49185274964814) -- (2.846104794275854,0.4819546692381634);
\draw[line width=1.2pt,color=qqwuqq] (2.846104794275854,0.4819546692381634) -- (2.8867634341940804,0.47225577851630474);
\draw[line width=1.2pt,color=qqwuqq] (2.8867634341940804,0.47225577851630474) -- (2.927422074112307,0.4627520689748323);
\draw[line width=1.2pt,color=qqwuqq] (2.927422074112307,0.4627520689748323) -- (2.9680807140305334,0.4534396127735147);
\draw[line width=1.2pt,color=qqwuqq] (2.9680807140305334,0.4534396127735147) -- (3.00873935394876,0.4443145611162623);
\draw[line width=1.2pt,color=qqwuqq] (3.00873935394876,0.4443145611162623) -- (3.0493979938669864,0.43537314266043714);
\draw[line width=1.2pt,color=qqwuqq] (3.0493979938669864,0.43537314266043714) -- (3.090056633785213,0.426611661958174);
\draw[line width=1.2pt,color=qqwuqq] (3.090056633785213,0.426611661958174) -- (3.1307152737034394,0.41802649792906865);
\draw[line width=1.2pt,color=qqwuqq] (3.1307152737034394,0.41802649792906865) -- (3.171373913621666,0.4096141023636015);
\draw[line width=1.2pt,color=qqwuqq] (3.171373913621666,0.4096141023636015) -- (3.2120325535398924,0.4013709984566787);
\draw[line width=1.2pt,color=qqwuqq] (3.2120325535398924,0.4013709984566787) -- (3.252691193458119,0.3932937793706842);
\draw[line width=1.2pt,color=qqwuqq] (3.252691193458119,0.3932937793706842) -- (3.2933498333763453,0.3853791068274495);
\draw[line width=1.2pt,color=qqwuqq] (3.2933498333763453,0.3853791068274495) -- (3.334008473294572,0.37762370972855785);
\draw[line width=1.2pt,color=qqwuqq] (3.334008473294572,0.37762370972855785) -- (3.3746671132127983,0.3700243828034145);
\draw[line width=1.2pt,color=qqwuqq] (3.3746671132127983,0.3700243828034145) -- (3.415325753131025,0.3625779852845224);
\draw[line width=1.2pt,color=qqwuqq] (3.415325753131025,0.3625779852845224) -- (3.4559843930492513,0.3552814396094176);
\draw[line width=1.2pt,color=qqwuqq] (3.4559843930492513,0.3552814396094176) -- (3.496643032967478,0.34813173014872645);
\draw[line width=1.2pt,color=qqwuqq] (3.496643032967478,0.34813173014872645) -- (3.5373016728857043,0.34112590195981946);
\draw[line width=1.2pt,color=qqwuqq] (3.5373016728857043,0.34112590195981946) -- (3.577960312803931,0.33426105956554686);
\draw[line width=1.2pt,color=qqwuqq] (3.577960312803931,0.33426105956554686) -- (3.6186189527221573,0.32753436575755124);
\draw[line width=1.2pt,color=qqwuqq] (3.6186189527221573,0.32753436575755124) -- (3.6592775926403838,0.32094304042366184);
\draw[line width=1.2pt,color=qqwuqq] (3.6592775926403838,0.32094304042366184) -- (3.6999362325586103,0.314484359398887);
\draw[line width=1.2pt,color=qqwuqq] (3.6999362325586103,0.314484359398887) -- (3.7405948724768368,0.3081556533395288);
\draw[line width=1.2pt,color=qqwuqq] (3.7405948724768368,0.3081556533395288) -- (3.7812535123950632,0.30195430661995565);
\draw[line width=1.2pt,color=qqwuqq] (3.7812535123950632,0.30195430661995565) -- (3.8219121523132897,0.2958777562515758);
\draw[line width=1.2pt,color=qqwuqq] (3.8219121523132897,0.2958777562515758) -- (3.8625707922315162,0.28992349082356583);
\draw[line width=1.2pt,color=qqwuqq] (3.8625707922315162,0.28992349082356583) -- (3.9032294321497427,0.284089049464916);
\draw[line width=1.2pt,color=qqwuqq] (3.9032294321497427,0.284089049464916) -- (3.943888072067969,0.27837202082736306);
\draw[line width=1.2pt,color=qqwuqq] (3.943888072067969,0.27837202082736306) -- (3.9845467119861957,0.2727700420887913);
\draw[line width=1.2pt] (0.5285623189369442,-1.535515293952107) -- (0.5692209588551707,-1.504614472799517);
\draw[line width=1.2pt] (0.5692209588551707,-1.504614472799517) -- (0.6098795987733971,-1.4743355020131625);
\draw[line width=1.2pt] (0.6098795987733971,-1.4743355020131625) -- (0.6505382386916236,-1.444665867431168);
\draw[line width=1.2pt] (0.6505382386916236,-1.444665867431168) -- (0.6911968786098501,-1.4155933067275595);
\draw[line width=1.2pt] (0.6911968786098501,-1.4155933067275595) -- (0.7318555185280766,-1.3871058043443);
\draw[line width=1.2pt] (0.7318555185280766,-1.3871058043443) -- (0.7725141584463031,-1.3591915865253146);
\draw[line width=1.2pt] (0.7725141584463031,-1.3591915865253146) -- (0.8131727983645296,-1.3318391164504486);
\draw[line width=1.2pt] (0.8131727983645296,-1.3318391164504486) -- (0.8538314382827561,-1.305037089467354);
\draw[line width=1.2pt] (0.8538314382827561,-1.305037089467354) -- (0.8944900782009826,-1.2787744284193259);
\draw[line width=1.2pt] (0.8944900782009826,-1.2787744284193259) -- (0.9351487181192091,-1.2530402790671649);
\draw[line width=1.2pt] (0.9351487181192091,-1.2530402790671649) -- (0.9758073580374356,-1.227824005603168);
\draw[line width=1.2pt] (0.9758073580374356,-1.227824005603168) -- (1.016465997955662,-1.2031151862553982);
\draw[line width=1.2pt] (1.016465997955662,-1.2031151862553982) -- (1.0571246378738886,-1.1789036089804128);
\draw[line width=1.2pt] (1.0571246378738886,-1.1789036089804128) -- (1.097783277792115,-1.1551792672426724);
\draw[line width=1.2pt] (1.097783277792115,-1.1551792672426724) -- (1.1384419177103415,-1.1319323558788843);
\draw[line width=1.2pt] (1.1384419177103415,-1.1319323558788843) -- (1.179100557628568,-1.1091532670455728);
\draw[line width=1.2pt] (1.179100557628568,-1.1091532670455728) -- (1.2197591975467945,-1.0868325862482018);
\draw[line width=1.2pt] (1.2197591975467945,-1.0868325862482018) -- (1.260417837465021,-1.0649610884502059);
\draw[line width=1.2pt] (1.260417837465021,-1.0649610884502059) -- (1.3010764773832475,-1.0435297342603245);
\draw[line width=1.2pt] (1.3010764773832475,-1.0435297342603245) -- (1.341735117301474,-1.0225296661966625);
\draw[line width=1.2pt] (1.341735117301474,-1.0225296661966625) -- (1.3823937572197005,-1.001952205025933);
\draw[line width=1.2pt] (1.3823937572197005,-1.001952205025933) -- (1.423052397137927,-0.9817888461763694);
\draw[line width=1.2pt] (1.423052397137927,-0.9817888461763694) -- (1.4637110370561535,-0.9620312562228238);
\draw[line width=1.2pt] (1.4637110370561535,-0.9620312562228238) -- (1.50436967697438,-0.9426712694426008);
\draw[line width=1.2pt] (1.50436967697438,-0.9426712694426008) -- (1.5450283168926064,-0.9237008844406007);
\draw[line width=1.2pt] (1.5450283168926064,-0.9237008844406007) -- (1.585686956810833,-0.9051122608423792);
\draw[line width=1.2pt] (1.585686956810833,-0.9051122608423792) -- (1.6263455967290594,-0.8868977160537558);
\draw[line width=1.2pt] (1.6263455967290594,-0.8868977160537558) -- (1.667004236647286,-0.8690497220856329);
\draw[line width=1.2pt] (1.667004236647286,-0.8690497220856329) -- (1.7076628765655124,-0.8515609024427112);
\draw[line width=1.2pt] (1.7076628765655124,-0.8515609024427112) -- (1.748321516483739,-0.8344240290748182);
\draw[line width=1.2pt] (1.748321516483739,-0.8344240290748182) -- (1.7889801564019654,-0.8176320193895869);
\draw[line width=1.2pt] (1.7889801564019654,-0.8176320193895869) -- (1.8296387963201919,-0.8011779333252531);
\draw[line width=1.2pt] (1.8296387963201919,-0.8011779333252531) -- (1.8702974362384184,-0.7850549704823591);
\draw[line width=1.2pt] (1.8702974362384184,-0.7850549704823591) -- (1.9109560761566449,-0.7692564673131788);
\draw[line width=1.2pt] (1.9109560761566449,-0.7692564673131788) -- (1.9516147160748714,-0.7537758943677039);
\draw[line width=1.2pt] (1.9516147160748714,-0.7537758943677039) -- (1.9922733559930978,-0.7386068535950521);
\draw[line width=1.2pt] (1.9922733559930978,-0.7386068535950521) -- (2.032931995911324,-0.7237430756991806);
\draw[line width=1.2pt] (2.032931995911324,-0.7237430756991806) -- (2.0735906358295506,-0.7091784175478152);
\draw[line width=1.2pt] (2.0735906358295506,-0.7091784175478152) -- (2.114249275747777,-0.6949068596335211);
\draw[line width=1.2pt] (2.114249275747777,-0.6949068596335211) -- (2.1549079156660036,-0.6809225035858677);
\draw[line width=1.2pt] (2.1549079156660036,-0.6809225035858677) -- (2.19556655558423,-0.6672195697336588);
\draw[line width=1.2pt] (2.19556655558423,-0.6672195697336588) -- (2.2362251955024566,-0.6537923947162206);
\draw[line width=1.2pt] (2.2362251955024566,-0.6537923947162206) -- (2.276883835420683,-0.6406354291427605);
\draw[line width=1.2pt] (2.276883835420683,-0.6406354291427605) -- (2.3175424753389096,-0.6277432352988281);
\draw[line width=1.2pt] (2.3175424753389096,-0.6277432352988281) -- (2.358201115257136,-0.6151104848989338);
\draw[line width=1.2pt] (2.358201115257136,-0.6151104848989338) -- (2.3988597551753625,-0.6027319568843912);
\draw[line width=1.2pt] (2.3988597551753625,-0.6027319568843912) -- (2.439518395093589,-0.5906025352654776);
\draw[line width=1.2pt] (2.439518395093589,-0.5906025352654776) -- (2.4801770350118155,-0.5787172070070187);
\draw[line width=1.2pt] (2.4801770350118155,-0.5787172070070187) -- (2.520835674930042,-0.5670710599565236);
\draw[line width=1.2pt] (2.520835674930042,-0.5670710599565236) -- (2.5614943148482685,-0.5556592808140146);
\draw[line width=1.2pt] (2.5614943148482685,-0.5556592808140146) -- (2.602152954766495,-0.5444771531427117);
\draw[line width=1.2pt] (2.602152954766495,-0.5444771531427117) -- (2.6428115946847215,-0.5335200554197508);
\draw[line width=1.2pt] (2.6428115946847215,-0.5335200554197508) -- (2.683470234602948,-0.5227834591261291);
\draw[line width=1.2pt] (2.683470234602948,-0.5227834591261291) -- (2.7241288745211745,-0.5122629268750887);
\draw[line width=1.2pt] (2.7241288745211745,-0.5122629268750887) -- (2.764787514439401,-0.5019541105781647);
\draw[line width=1.2pt] (2.764787514439401,-0.5019541105781647) -- (2.8054461543576275,-0.49185274964814);
\draw[line width=1.2pt] (2.8054461543576275,-0.49185274964814) -- (2.846104794275854,-0.4819546692381634);
\draw[line width=1.2pt] (2.846104794275854,-0.4819546692381634) -- (2.8867634341940804,-0.47225577851630474);
\draw[line width=1.2pt] (2.8867634341940804,-0.47225577851630474) -- (2.927422074112307,-0.4627520689748323);
\draw[line width=1.2pt] (2.927422074112307,-0.4627520689748323) -- (2.9680807140305334,-0.4534396127735147);
\draw[line width=1.2pt] (2.9680807140305334,-0.4534396127735147) -- (3.00873935394876,-0.4443145611162623);
\draw[line width=1.2pt] (3.00873935394876,-0.4443145611162623) -- (3.0493979938669864,-0.43537314266043714);
\draw[line width=1.2pt] (3.9032294321497427,-0.284089049464916) -- (3.943888072067969,-0.27837202082736306);
\draw[line width=1.2pt] (3.943888072067969,-0.27837202082736306) -- (3.9845467119861957,-0.2727700420887913);
\draw[line width=1.2pt] (3.9845467119861957,-0.2727700420887913) -- (4.025205351904422,-0.2672807979766887);
\draw[line width=1.2pt] (3.0493979938669864,-0.43537314266043714) -- (3.090056633785213,-0.426611661958174);
\draw[line width=1.2pt] (3.090056633785213,-0.426611661958174) -- (3.1307152737034394,-0.41802649792906865);
\draw[line width=1.2pt] (3.1307152737034394,-0.41802649792906865) -- (3.171373913621666,-0.4096141023636015);
\draw[line width=1.2pt] (3.171373913621666,-0.4096141023636015) -- (3.2120325535398924,-0.4013709984566787);
\draw[line width=1.2pt] (3.2120325535398924,-0.4013709984566787) -- (3.252691193458119,-0.3932937793706842);
\draw[line width=1.2pt] (3.252691193458119,-0.3932937793706842) -- (3.2933498333763453,-0.3853791068274495);
\draw[line width=1.2pt] (3.2933498333763453,-0.3853791068274495) -- (3.334008473294572,-0.37762370972855785);
\draw[line width=1.2pt] (3.334008473294572,-0.37762370972855785) -- (3.3746671132127983,-0.3700243828034145);
\draw[line width=1.2pt] (3.3746671132127983,-0.3700243828034145) -- (3.415325753131025,-0.3625779852845224);
\draw[line width=1.2pt] (3.415325753131025,-0.3625779852845224) -- (3.4559843930492513,-0.3552814396094176);
\draw[line width=1.2pt] (3.4559843930492513,-0.3552814396094176) -- (3.496643032967478,-0.34813173014872645);
\draw[line width=1.2pt] (3.496643032967478,-0.34813173014872645) -- (3.5373016728857043,-0.34112590195981946);
\draw[line width=1.2pt] (3.5373016728857043,-0.34112590195981946) -- (3.577960312803931,-0.33426105956554686);
\draw[line width=1.2pt] (3.577960312803931,-0.33426105956554686) -- (3.6186189527221573,-0.32753436575755124);
\draw[line width=1.2pt] (3.6186189527221573,-0.32753436575755124) -- (3.6592775926403838,-0.32094304042366184);
\draw[line width=1.2pt] (3.6592775926403838,-0.32094304042366184) -- (3.6999362325586103,-0.314484359398887);
\draw[line width=1.2pt] (3.6999362325586103,-0.314484359398887) -- (3.7405948724768368,-0.3081556533395288);
\draw[line width=1.2pt] (3.7405948724768368,-0.3081556533395288) -- (3.7812535123950632,-0.30195430661995565);
\draw[line width=1.2pt] (3.7812535123950632,-0.30195430661995565) -- (3.8219121523132897,-0.2958777562515758);
\draw[line width=1.2pt] (3.8219121523132897,-0.2958777562515758) -- (3.8625707922315162,-0.28992349082356583);
\draw[line width=1.2pt] (3.8625707922315162,-0.28992349082356583) -- (3.9032294321497427,-0.284089049464916);
\draw[line width=1.2pt] (3.9032294321497427,-0.284089049464916) -- (3.943888072067969,-0.27837202082736306);
\draw[line width=1.2pt] (3.943888072067969,-0.27837202082736306) -- (3.9845467119861957,-0.2727700420887913);
\draw[line width=1.2pt] (3.9845467119861957,-0.2727700420887913) -- (4.025205351904422,-0.2672807979766887);
\draw (1.2,0.)-- (1.2,1.0);
\draw (1.4,0.)-- (1.4,1.);
\draw (1.2,1.)-- (1.4,1.);
\draw[decoration={brace,brace,amplitude=5pt,mirror,raise=1.0pt},decorate]
(1.2,1.0) -- node[left=2.5pt] {\footnotesize $r=f(x)$} (1.2,0.);
\draw[decoration={brace,brace,amplitude=2.5pt,mirror,raise=0.5pt},decorate]
(1.2,-0.1) -- node[below=2.5pt] {\footnotesize $\Delta x$} (1.4,-0.1);

\draw (2.5,0.8) node[anchor=center,rotate=-22] {\footnotesize $y=fx)$};
\draw (0.5,-0.1) node[anchor=center,rotate=-22] {\footnotesize $a$};
\draw (3.95,-0.1) node[anchor=center,rotate=-22] {\footnotesize $b$};
\end{tikzpicture}
\end{document}
9

Run with xelatex

\documentclass{article}
\usepackage{pst-func}
\begin{document}
\psset{algebraic}
\noindent
\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=magenta!30](0,4){1}{sqrt(x)}
\psline{->}(4,0)(5,0)
\end{pspicture}
%
\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=red!40](0,4){2}{sqrt(x)}
\psline{->}(4,0)(5,0)
\end{pspicture}
%
\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=blue!40](0,4){4}{sqrt(x)}
\psline{->}(4,0)(5,0)
\end{pspicture}
\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=green!40](0,4){8}{sqrt(x)}
\psline{->}(4,0)(5,0)
\end{pspicture}
%
\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=yellow!40](0,4){16}{sqrt(x)}
\psline{->}(4,0)(5,0)
\end{pspicture}
%
\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=cyan!40](0,4){32}{sqrt(x)}
\psline{->}(4,0)(5,0)
\end{pspicture}

\end{document}

enter image description here

Or with your function:

 \def\func{2*Euler^(-1/2*x)}

and

\begin{pspicture}(-0.5,-2.5)(5,2.5)
\psaxes{->}(0,0)(0,-2)(3,2.5)
\psVolume[fillstyle=solid,fillcolor=magenta!30](0,4){1}{\func}
\psline{->}(4,0)(5,0)
\end{pspicture}

enter image description here

| improve this answer | |
  • Thanks @Herbert, this is close to what I want, I will work with this and see what I can do. – Zilore Mumba Sep 12 '17 at 12:30
  • Not being familiar with xelatex, can you replace the function y=sqrt(x) by a different on and see what happens? – Zilore Mumba Sep 12 '17 at 22:27
  • see edited answer for your function – user2478 Sep 13 '17 at 7:07
  • Thank you very much @Herbert, I think I can work with this. But other variants to this are welcome, as am also interested in annotating the figure with $\delta x$, $r=f(x)$ etc. Thanks am marking this – Zilore Mumba Sep 13 '17 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.