\documentclass[10pt,letterpaper]{article} % DESTDIR="storage_container_mathematics" \usepackage[utf8]{inputenc} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=OliveGreen, urlcolor=blue } \usepackage[usenames,dvipsnames]{color} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} \usepackage{float} \usepackage{wrapfig} \usepackage{color} %\usepackage{xcolor} \definecolor{sageIn}{rgb}{1,1,.95} \definecolor{sageOut}{rgb}{.95,1,.95} \definecolor{codeList}{rgb}{.95,.95,.95} \usepackage{listings} \usepackage{lmodern} \lstset{language=Python} \usepackage{endnotes} \usepackage{enumitem} \usepackage{mdframed} \numberwithin{equation}{section} \usepackage[margin=.75in]{geometry} \newcommand\Hrule{\hrule\vspace{\baselineskip}} \renewcommand\notesname{References} \let\footnote=\endnote %\setlength{\parskip}{0.3\baselineskip}% % the location of the target HTML and PDF output files \newcommand{\dest}{/netbackup/data/Network/arachnoid/storage_container_mathematics} \author{\href{http://arachnoid.com/administration}{Copyright \copyright \space 2015, Paul Lutus}} \title{Storage Container Mathematics} \date{Most recent revision: \today} \begin{document} \maketitle \begin{abstract} \noindent\rule{.9\textwidth}{.1px} This is a collection of full and partial, volume and surface area equations for common storage tank types. It's meant to serve as an easy-to-use reference for tank analysis methods and mathematics that are distributed across many articles located in the storage tank modeling section\footnote{\href{http://arachnoid.com/TankCalc}{StorageTank Modeling} -- a collection of tank modeling articles at http://arachnoid.com.} of http://arachnoid.com. The overarching purpose of this activity is to create summaries and accurate sensor height to volume tables for various kinds of storage tanks. An additional goal is to provide full and partial surface area results when possible. The mathematical treatments are arranged to progress from simple to complex, in most cases building on what has already been presented. \noindent\rule{.9\textwidth}{.1px} \end{abstract} \tableofcontents \listoffigures \listoftables \section{Circle equations} \Hrule This section describes some basic equations from which most of the later equations are derived. \subsection{Common conventions} Certain common names used in geometry have different assignments here, to remain consistent across uses and to agree with the conventions used in TankCalc\footnote{\href{http://arachnoid.com/TankCalc}{TankCalc} -- the author's tank analysis program.}, the author's tank analysis program. One convention seen here differs from TankCalc. In this and later sections, the $y$ value, normally associated with a content sensor height, has a range of $0 \leq y \leq 2R$, which I think is more consistent and logical than the prior convention. This convention differs from that in the TankCalc documentation, where $-R \leq y \leq R$. This change produces a number of changes in the dependent equations, and readers should expect to see equation forms that differ from those on the arachnoid.com website. \begin{figure}[H] \centering \includegraphics[width=.4\textwidth]{graphics/circle_basis.png} \caption{Partitioned Circle} \end{figure} \subsection{Circle width} We first compute $w$ (green line in figure 1), the width across the circle defined by the $y$ bisector argument: \begin{equation} \label{eq1} w = 2 \, \sqrt{{\left(2 \, R - y\right)} y} \end{equation} This equation can be easily used to compute a cylinder's content surface area -- just multiply its result by the length of the cylinder: $a = 2 \, \sqrt{{\left(2 \, R - y\right)} y} L$. \subsection{Circle partial area} By integrating equation (\ref{eq1}) on the interval $0 \leq z \leq y$, we acquire an equation for the area of the blue shaded segment in figure 1. This result is later used to compute end cap partial areas and volumes, and cylindrical partial volumes: \begin{equation} \label{eq2} a = \int_0^y 2 \, \sqrt{{\left(2 \, R - z\right)} z} \, dz = \frac{1}{2} \, \pi R^{2} + R^{2} \arcsin\left(\frac{y - R}{R}\right) - \sqrt{2 \, R y - y^{2}} {\left(R - y\right)} \end{equation} Equation (\ref{eq2}) produces this result for R = 1: \begin{figure}[H] \centering \includegraphics[width=.5\textwidth]{graphics/circle_area_chart.png} \caption{Partial circle area} \end{figure} \subsection{Circle partial circumference} We also require the partial circumference defined by the $y$ bisector argument and represented by the red line in figure 1, later used as a term in cylinder partial surface area equations: \begin{equation} \label{eq3} c = \pi R - 2 \, R \arcsin\left(\frac{R - y}{R}\right) \end{equation} Equation (\ref{eq3}) produces this result for R = 1: \begin{figure}[H] \centering \includegraphics[width=.5\textwidth]{graphics/circumference_chart.png} \caption{Partial circumference} \end{figure} The equations to come are, to the extent practical, derived from these basic equations. \section{Common container geometries} \Hrule For each of the following storage container types, equations are provided for: \begin{table}[H] \begin{tabular}{lll} Description & Variable & Notes \\ \hline \\ Content height & $y$ & the location of the top of the container's contents \\ Full Volume & $v$ & container full volume \\ Content Partial volume & $v_y$ & content volume from container base to coordinate y (blue tint) \\ Full Area & $a$ & container full surface area \\ Content wetted area & $w_y$ & wetted area (liquid/wall interface) \\ & & from container base to coordinate y (blue tint) \\ Content surface area & $s_y$ & surface area (liquid/gas interface) at coordinate y (green tint) \\ \end{tabular} \caption{Defined Variables} \end{table} \subsection{Vertical cylinder} \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/cylindrical_tank_vertical_diagram.png} \caption{Vertical cylinder} \end{figure} A vertical cylinder is the simplest storage tank element, unfortunately not often used in the field. Its equations are: \begin{equation} v = \pi R^2 L \end{equation} \begin{equation} v_y = \pi R^2 y \end{equation} \begin{equation} a = 2 \pi R^2 + 2 \pi R L \end{equation} \begin{equation} w_y = \pi R^2 + 2 \pi R y \end{equation} \begin{equation} s_y = \pi R^2 \end{equation} If only all storage tanks were this simple. \subsection{Horizontal cylinder} \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/cylindrical_tank_horizontal_diagram.png} \caption{Horizontal cylinder} \end{figure} For a horizontal cylinder, computing partial volume and surface area becomes a bit more complex. Referring to the variables defined in table 1: Full volume $v$: \begin{equation} \label{eq8} v = \pi R^2 L \end{equation} $v_y$ is acquired by multiplying equation (\ref{eq2}) by $L$: \begin{equation} \label{eq9} v_y = \frac{1}{2} \, {\left(\pi R^{2} - 2 \, R^{2} \arcsin\left(\frac{R - y}{R}\right) - 2 \, \sqrt{2 \, R y - y^{2}} {\left(R - y\right)}\right)} L \end{equation} Full surface area $a$ (including flat end caps): \begin{equation} a = 2 \pi R^2 + 2 \pi R L \end{equation} Full surface area $a$ (excluding end caps): \begin{equation} \label{eq10} a = 2 \pi R L \end{equation} $w_y$ represents the partial surface area of two circular end caps ($2 \, \times$ equation (\ref{eq2})), plus the partial surface area of the cylindrical section ($L \, \times$ equation (\ref{eq3})): \begin{equation} \label{eq4} w_y = 2 \left( \frac{1}{2} \, \pi R^{2} + R^{2} \arcsin\left(\frac{y - R}{R}\right) - \sqrt{2 \, R y - y^{2}} {\left(R - y\right)} \right) + L \left( \pi R + 2 \, R \arcsin\left(\frac{y - R}{R}\right) \right) \end{equation} After combining/canceling terms, $w_y$ becomes: \begin{equation} w_y = \pi L R + \pi R^{2} + 2 \, {\left(L R + R^{2}\right)} \arcsin\left(\frac{y-R}{R}\right) - 2 \, \sqrt{2 \, R y - y^{2}} {\left(R - y\right)} \end{equation} Remember about the above equations that, in some tank analyses, one may wish to only compute the cylinder's surface area, without end caps. For that case, use this equation (the right-hand part of equation (\ref{eq4})): \begin{equation} w_y = L \left( \pi R + 2 \, R \arcsin\left(\frac{y - R}{R}\right) \right) \end{equation} $s_y$, content surface area (green plane in figure 4), is acquired by multiplying equation (\ref{eq1}) by $L$: \begin{equation} s_y = 2 L \, \sqrt{{\left(2 \, R - y\right)} y} \end{equation} \subsection{Sphere} \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/spherical_tank_diagram.png} \caption{Sphere} \end{figure} A spherical section, often a hemisphere or ellipse at each end of a cylinder, is included in many kinds of tanks. Most tanks use one or another kind of ellipse or spheroid, more difficult to analyze. A sphere's equations are: \begin{equation} v = \frac{4}{3} \pi R^3 \end{equation} \begin{equation} \label{eq5} v_y = \pi R y^{2} - \frac{1}{3} \, \pi y^{3} \end{equation} \begin{equation} a = 4 \pi R^2 \end{equation} \begin{equation} \label{eq6} w_y = 2 \pi R y \end{equation} \begin{equation} \label{eq7} s_y = \pi {\left(2 \, R - y\right)} y \end{equation} \subsection{Elliptical end cap} This section analyzes a class of storage tank end cap whose minor radius varies between flat and hemispherical. The analysis and equations described here are normally added as terms to an equation for the entire tank, one whose final form has the height variable $y$ common to all its sections. \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/end_cap_tank_diagram.png} \caption{Elliptical end cap} \end{figure} \subsubsection{Notes} Because ellipses possess major and minor radii, this section adopts the convention that $R$ refers to both the central cylinder's radius and the ellipse's major radius, and $r$ refers to the ellipse's minor radius, which explains the unconventional variable names used above. Elliptical end caps (technically, spheroids\footnote{\href{http://en.wikipedia.org/wiki/Spheroid}{Spheroid} -- an ellipse of revolution.}) have some complex properties, but for a horizontal tank, computing an end cap's full and partial volumes is often a simple matter of computing a spherical result and scaling the result. Each such end cap is half an oblate spheroid\footnote{\href{http://en.wikipedia.org/wiki/Oblate_spheroid}{Oblate spheroid} -- an ellipse of revolution whose polar axis is smaller than its equatorial diameter.}, rotated 90$^{\circ}$ from the usual convention, and with major (y-axis) radius $R$ equal to the tank's primary radius, and a minor (x-axis) radius $r$ lying in the range $0 \leq r \leq R$. \subsubsection{Volume} The full volume of such an end cap is equal to $\frac{1}{2}$ the volume of an oblate spheroid with its described dimensions, or: \begin{equation} \label{eq22} v = \frac{2}{3} \pi R^2 r \end{equation} The partial volume equation $v_y$ requires some changes to equation (\ref{eq5}) to accommodate the two required radii, and remembering that this result is for a single end cap, i.e. $\frac{1}{2}$ the volume of an oblate spheroid: \begin{equation} \label{eq23} v_y = \frac{3 \, \pi R r y^{2} - \pi r y^{3}}{6 \, R} \end{equation} \subsubsection{Surface area} An oblate spheroid end cap's full surface area $a$ (half that of an oblate spheroid) requires this equation: \begin{equation} \label{eq24} a = \frac{\pi r^{2} {\rm tanh^{-1}}\left(\sqrt{\frac{R^{2} - r^{2}}{R^{2}}}\right) + \pi R^{2} \sqrt{\frac{R^{2} - r^{2}}{R^{2}}}}{\sqrt{\frac{R^{2} - r^{2}}{R^{2}}}}, 0 < r < R \end{equation} Note the valid range of the $r$ argument: $0 < r < R$: \begin{itemize} \item For $r = 0$ (flat end cap), instead use $a = \pi R^2$. \item For $r = R$ (spherical end cap), instead use $a = 2 \pi R^2$ (one end cap). \end{itemize} \subsubsection{Partial wetted area} Computing $w_y$, an oblate spheroid wetted area, is more difficult: \begin{itemize} \item If the minor radius $r = 0$ (flat end cap), use a circle area partitioned by sensor height $y$: equation (\ref{eq2}). \item If the minor radius $r = R$ (spherical end cap), use a spherical surface area partitioned by sensor height $y$: apply equation (\ref{eq6}) but multiply the result by $\frac{r}{2R}$ (one end cap): \begin{equation} \label{eq25} w_y = 2 \pi R y \frac{r}{2R} \end{equation} \item If the minor radius $r$ lies in the range $0 < r < R$, this is a special case requiring a method like that described below. \end{itemize} \subsubsection{Partial wetted area algorithm} In the event that $0 < r < R$, things become even more difficult. There's no closed form equation for partial surface areas of an oblate spheroid, instead a numerical method must be used. Here's a description of the author's method used in TankCalc: \begin{enumerate} \item Remember that $R$ = ellipse major radius, and $r$ = ellipse minor radius (figure 7). \item Choose a number of iterations $n$, larger values produce greater accuracy but require more running time. \item For each iteration $i$, generate an $x$ value in the range $0 \leq x \leq 1$: \begin{quotation} $x = \frac{i}{n}$ \end{quotation} \item Use the x value from item (3) to acquire a radius within a modeled quarter-circle: \begin{quotation} $r = \sqrt{1-x^2}$ \end{quotation} \item Using two sequential (i.e. one from iteration $i$, one from iteration $i-1$) radius values from item (4) (name them $r_1$ and $r_2$), compute the area of an equivalent conical frustum\footnote{\href{http://mathworld.wolfram.com/ConicalFrustum.html}{Conical Frustum} -- a geometric element whose methods aid storage tank analysis.} using the end caps's minor radius divided by the number of iterations ($r/n$) as a height: \begin{quotation} $a = \pi (r_1+r_2) \sqrt{(r_1-r_2)^2+(r/n)^2}$ \end{quotation} \item Acquire a partitioned area value $p$ using the sensor height argument $y$ and an average of the two computed radii ($ra = (r_1+r_2)/2$): \begin{enumerate} \item if $y \leq 0, p = 0$ \item if $y > 2ra, p = a$ \item if $ \displaystyle 0 < y < 2ra, p = a \, cos^{-1}\left(\frac{R-y}{ra}\right)/\pi$ \end{enumerate} \item Accumulate the adjusted areas in a sum $s$: \begin{quotation} $ \displaystyle s = s + \frac{p}{n}$ \end{quotation} \item The result should approximate the partial surface area (wetted area) of an elliptical end cap. \end{enumerate} \subsubsection{Python listing} Here's Python code for the algorithm described above: \begin{mdframed}[backgroundcolor=codeList] \begin{lstlisting} from math import * # partition based on sensor height y def py(y,r): if(y <= -r): return 0 elif(y >= r): return 1 else: return acos(-(y/r)) / pi # partial spheroid area def psa(y,n,r,R): y -= R sx = 1.0/n hsq = (r/n)**2 a = 0 x = 0 r1 = None for i in range(n+1): r2 = sqrt(1-x**2) * R if(r1 != None): rsum = r1+r2 # compute frustum surface area z = pi * rsum * sqrt((r1-r2)**2 + hsq) # scale the result based on sensor height y a += z * py(y,rsum * 0.5) r1 = r2 x += sx return a \end{lstlisting} \end{mdframed} \subsubsection{Content surface area} The last equation for an end cap, $s_y$ or content surface area, is surprisingly simple -- it's a variation of that used for a sphere (equation (\ref{eq7})), with the result scaled to the spheroid's dimensions: \begin{equation} s_y = \pi {\left(2R - y\right)} y \frac{r}{2R} \end{equation} The term at the right serves to adjust the result to correspond to the dimensions of a single, possibly elliptical, end cap. \section{Practical Application} \Hrule In this section we will apply the prior content to an example tank -- a horizontal cylindrical section with end caps that can assume some common shapes, and that may differ from each other. To avoid excessive complexity, this example considers a horizontal tank, which means, with a single exception, it's accessible to closed-form analysis, i.e. using clearly defined equations and no numerical calculus methods required. (The one exception involves finding the partial wetted area of an elliptical end cap, as explained above.) The end result will be a table that correlates sensor heights and tank partial volumes. Here's an outline to follow when analyzing a storage tank: \begin{itemize} \item Measure the tank, keeping in mind that an accurate analysis requires the tank's \textit{internal} dimensions. \item Consider the tank as three sections -- a central cylinder and two end caps. If the end caps differ, apply appropriate equations and measurement values for each. \item Remember that the tank's three sections have one variable in common -- the sensor height. This makes it possible to generate a single sensor to volume table. \item Choose a suitable method for processing the tank. For common tank types and small workloads, use TankCalc\footnote{TankCalc (see note 2)}, my free Java program. For more ambitious projects, and in particular if developing code to be used widely, I recommend Python for the development phase. \item Always include equations and results for full tank volume and surface area. This serves multiple purposes, including a verification check of the data table's results. As one testing example, for a horizontal tank with a cylindrical cross-section, the volume value at a sensor height that is half the tank's height should be exactly $\frac{1}{2}$ the full volume. \item Remember that, unless a program like TankCalc is in use, all the measurements should use the same units, and the results will be expressed in the chosen units squared (surface area) and cubed (volume). \end{itemize} \subsection{Example tank} \begin{figure}[H] \centering \includegraphics[width=.8\textwidth]{graphics/full_tank_diagram.png} \caption{Example Tank Diagram} \end{figure} \subsubsection{Measuring the tank} For this example, let's say we have a tank like that shown in figure (8) ready for analysis. We need to acquire measurements and translate them into the values required by this method. The values are: \begin{itemize} \item Cylinder length ($L$): \begin{itemize} \item This is the easiest measurement to make. \item Many tanks have a clear weld line at the intersection of the cylindrical section and the end caps, which simplifies this measurement. \item Because this measurement is taken parallel to the tank wall, the wall's thickness is not an issue. \end{itemize} \item Major radius ($R$): \begin{itemize} \item If there's any confusion about the meaning of this term, imagine a line extending from the tank's centerline to the inside of the cylinder wall. \item The radius is half the tank's diameter, but remember that most ways to measure a tank's diameter will need to subtract the tank's wall thickness. \item One way to acquire a value for $R$ is to take a flexible tape measure and pass it around the cylinder's circumference, then divide the result by $2 \pi$ (Circumference $C = 2 \pi R$). \item A correction can be made to the above measurement for wall thickness -- if you know the tank's wall thickness, multiply it by $2 \pi$ and subtract that from the above result. \end{itemize} \item Minor radius ($r$): \begin{itemize} \item This is the most difficult measurement -- there's often no easy way to acquire it from outside the tank. \item One method is to use a plumb line, make chalk marks at the base of the tank, and measure the distance between the marks. \item Remember to subtract the wall thickness from the measured value. \item If the end caps differ, take two measurements and process them independently. \item Remember that for a flat end cap, assign an $r$ value of zero. \end{itemize} Remember also that, if manufacturer documentation is available for the tank, this might be a better way to acquire the needed values. \end{itemize} \subsubsection{Choosing the equations} This becomes easier with experience. For the example tank, and assuming we want full and partial volumes and content surface area, we would acquire: \begin{itemize} \item Central cylinder: \begin{itemize} \item Full volume: equation (\ref{eq8}). \item Partial volume based on sensor height $y$: equation (\ref{eq9}). \item Full surface area excluding end caps: equation (\ref{eq10}). \item Content surface area based on sensor height $y$: equation (\ref{eq1}), multiply the result by $L$. \end{itemize} \item End Caps: \begin{itemize} \item Full volume: equation (\ref{eq22}). \item Partial volume based on sensor height $y$: equation (\ref{eq23}). \item Full surface area: equation (\ref{eq24}). \item Content surface area based on sensor height $y$: equation (\ref{eq25}). \end{itemize} For two identical end caps, one may multiply by 2 the result for one equation. \end{itemize} \subsubsection{Example program} \href{http://arachnoid.com/TankCalc/volumes_resources/example_tank_analysis.py}{Follow this link}\footnote{\href{http://arachnoid.com/TankCalc/volumes_resources/example_tank_analysis.py}{Example Tank Analysis} -- a Python program that summarizes this article's methods.} for an example Python program that performs all the tasks outlined in the prior section, prints a summary list of tank properties, then prints a table of values correlating sensor height, volume, and content surface area. At the top of the program is a set of user-definable values that permit the user to customize the results. Examination of this Python program should give readers a sense of how to proceed in crafting a solution for many types of common storage tanks. \section{Overview} \Hrule \subsection{TankCalc} \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/tankcalc_left.png} \caption{TankCalc numerical strategy} \end{figure} The methods this article describes are valid for horizontal or (in a few cases) vertical tanks, but if the tank is tilted at an angle to the local horizon (meaning the tank's contents rest at an angle with respect to the tank itself), closed-form methods fail. This is because the methods used to describe the relationship between a tank and its contents require that they have a reference plane in common, either parallel or orthogonal. \subsubsection{Tilted tanks} When I first described methods for analyzing storage tanks, they were much like those in this article -- straightforward and closed-form. I soon began to receive inquiries from people with actual storage tanks, who asked whether my methods could be applied to tilted tanks. I was initially mystified -- who would do such a thing to a perfectly good tank? But my correspondents educated me -- there are very good reasons to tilt a tank, one being that it sequesters impurities in a waste area and allows relatively pure product to be drawn from the tank until it's nearly empty. So to meet this need I wrote TankCalc, which, unlike the closed-form methods described in this article, uses a numerical scheme. In some ways TankCalc is simpler and easier to understand than this article's methods -- it relies on a relatively simple numerical Calculus scheme that iteratively generates disks that are partitioned by the tank's contents (using a version of equation (\ref{eq2})), and sums their two-dimensional partial areas to construct a three-dimensional partial volume (as shown in figure 9 -- imagine thousands of disks) -- but in other ways it's less satisfactory. One drawback to the TankCalc approach is that the results are approximate -- quite accurate, but never exact. Another drawback is that, unlike the closed-form equations in this article, TankCalc's numerical methods can't be easily manipulated to get different kinds of results. To me, TankCalc exemplifies the collision between pure and applied mathematics, and supports Einstein's famous aphorism: "As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they do not refer to reality." \subsection{Tools} In the process of creating mathematical results for articles like this one, I rely on a number of tools including Sage\footnote{\href{http://www.sagemath.org/}{Sage} -- a powerful, free, open-source mathematical environment.}, IPython\footnote{\href{http://ipython.org/}{IPython} -- a Python-based mathematical environment, requires less storage and horsepower than Sage.} and much past experience in storage tank analysis. \subsubsection{Sage} Sage in particular has turned out to be a valuable resource for both symbolic and numerical results. Because Sage relies on Python, it's a relatively simple matter to produce a new symbolic result in Sage, then transfer it to a Python working script for further analysis and tuning. Here's an example: I start with an equation that, if presented with a $y$ coordinate within a circle of radius $R$, will return the circle's width at that coordinate -- see equation (\ref{eq1}) and figure (1) above. The equation: \begin{equation} w = 2 \, \sqrt{{\left(2 \, R - y\right)} y} \end{equation} First I want to be sure the equation produces the hoped-for result, that is, a width corresponding to a given $y$ coordinate within a circle. So to find out I provide Sage with the equation and plotting instructions: \begin{mdframed}[backgroundcolor=sageIn] \begin{lstlisting}[basicstyle=\ttfamily] f(y,R) = 2 * sqrt((2*R-y) * y) plot(f(y,10),y,0,20,axes_labels=('y','result'),gridlines=True,figsize=(5,3)) show(f(y,R)) latex(f(y,R)) \end{lstlisting} \end{mdframed} Sage responds with: \begin{mdframed}[backgroundcolor=sageOut] \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/sage_example1.png} \end{figure} $2 \, \sqrt{{\left(2 \, R - y\right)} y} $ \begin{verbatim} 2 \, \sqrt{{\left(2 \, R - y\right)} y} \end{verbatim} \end{mdframed} The final printed result above allows me to easily copy LaTeX code from Sage into an article like this one. At this point I realize that, if I integrate the above equation on the interval $0 \leq z \leq y$, I will have an equation for partial circle area, useful in a number of ways. So I instruct Sage thus: \begin{mdframed}[backgroundcolor=sageIn] \begin{lstlisting}[basicstyle=\ttfamily] assume(y > 0) assume(R > 0) fi(y,R) = integrate(f(z,R),z,0,y) plot(fi(y,10),y,0,20,axes_labels=('y','result'),gridlines=True,figsize=(5,3)) show(fi(y,R)) \end{lstlisting} \end{mdframed} Sage responds with: \begin{mdframed}[backgroundcolor=sageOut] \begin{figure}[H] \centering \includegraphics[width=.6\textwidth]{graphics/sage_example2.png} \end{figure} $-R^{2} \arcsin\left(\frac{\sqrt{R^{2}} {\left(R - y\right)}}{R^{2}}\right) + R^{2} \arcsin\left(\frac{\sqrt{R^{2}}}{R}\right) - \sqrt{2 \, R y - y^{2}} {\left(R - y\right)} $ \end{mdframed} The graph shows me that the integration result is valid, providing an equation for the partial area of a circle, but looking at the equation I suspect it might not be written in the most concise way (when I see an expression like $\sqrt{R^2}$, my alarm bells go off), so I tell Sage: \begin{mdframed}[backgroundcolor=sageIn] \begin{lstlisting}[basicstyle=\ttfamily] fi(y,R) = fi(y,R).full_simplify() show(fi(y,R)) \end{lstlisting} \end{mdframed} Sage responds with: \begin{mdframed}[backgroundcolor=sageOut] $\frac{1}{2} \, \pi R^{2} - R^{2} \arcsin\left(\frac{R - y}{R}\right) - \sqrt{2 \, R y - y^{2}} {\left(R - y\right)}$ \end{mdframed} Much better. \subsubsection{Texmaker} I'm sure there are as many views about the ideal LaTeX editor as there are users of such programs. At the moment my favorite is Texmaker\footnote{\href{http://www.xm1math.net/texmaker/}{Texmaker} -- a free, open-source, cross-platform LaTeX editor.}, a rather nice, free LaTeX editor with versions for all common platforms. Texmaker greatly simplifies the task of LaTeX creation and editing compared to programs available only a few years ago. It certainly represents an improvement over how I once created LaTeX -- by hand-entering everything, then submitting it to a renderer/converter to see where I had gone wrong. Along with Inkscape and Povray described below, Texmaker belongs to my favorite class of programs -- those that are created and maintained by people who just want the best tools, and who can afford to build them without thought of commercial gain. The availability and ease of use of programs like Texmaker, and some others, is producing a change in how I create Web content. A long-time static HTML page creator using my Web creation tool Arachnophilia\footnote{\href{http://arachnoid.com/arachnophilia}{Arachnophilia} -- my free Web development environment.}, I have recently been writing articles with more mathematical content, which requires extra effort in HTML. Also my numbered footnote/reference lists have become longer and therefore harder to edit and maintain. Finally, people have begun to ask for PDF versions of some of my more widely read articles, which requires a conversion from HTML to PDF, with sometimes mediocre results. This change of direction in recent articles means the article source is a plain-text LaTeX document, with a PDF rendering, and finally an HTML version of the LaTeX source using a Python conversion script. This arrangement means the PDF version is often a much better rendering than the HTML. \subsubsection{Inkscape} Most of the diagrams in this article were captioned using Inkscape\footnote{\href{http://www.inkscape.org/}{Inkscape} (after image generation using Povray --see below) -- a terrific, free, open-source drawing program.}. Inkscape is a very good drawing program, much better than one expects in a program category that for some reason seems to attract mediocrity and bugginess. It's not often that I see a program that already offers the features I think I need after working with it for a spell. Inkscape has a lot of useful features, more than I have figured out yet. \subsubsection{Povray} Povray\footnote{\href{http://www.povray.org/}{Povray} -- the Persistence Of Vision raytracer.} is a venerable ray tracing\footnote{\href{http://en.wikipedia.org/wiki/Ray_tracing_(graphics)}{Ray Tracing (graphics)} -- a method for producing very realistic graphic renderings.} program that has existed in various forms for almost 30 years, and that keeps getting better. I keep expecting something better to come along -- a program that joins a convenient modeler like Blender\footnote{\href{http://www.blender.org/}{Blender} -- an animation and photorealistic graphics workshop.} to the ability to perform the kind of ray tracing that graphics perfectionists expect. But that goal remains out of reach, and Povray continues to be my choice for images like those in this article, in which, to pictorialize how TankCalc creates numerical partial volume results, I needed transparent, realistic 3D renderings with multiple elements. After a bit of coding and testing, Povray produced them. \href{http://arachnoid.com/raytracing/intro_blowup.html}{Click this link} to see what Povray can do, and why the ray tracing method is regarded as superior to other graphic rendering methods. \theendnotes \end{document}