Sunday, March 13, 2016

Roast Calculus

This post is going to review the subject of roast calculus. This calculus is about change and motion. Everything is dynamic. Measurements of changes are vehicles for understanding a wide spectrum of physical processes. Knowledge of the universe comes from observations of changes and not from static measurements. We use calculi in real life every day. In a car for example, the speedometer measures a rate, the speed. The odometer integrates the speed over time, the distance, and the foot pedals control the acceleration, rate of speed.  

by Rafael Cobo


In a previous post, we learnt how to do derivatives in Artisan using the plotter. With a profile loaded, we visualized the first derivative of BT using the following formula in P1.

P1 = (Y2-Y2[-1])/(t-t[-1])*60*k

In a calculus, differentiation and integration are inverse processes. On integration, we are interested in computing the original curve from the derivative curve. With definite integrals, we would just get a number (area under the curve) in a calculator, but we are interested in reconstructing the curve to visualize its trajectory. To reverse the steps of the derivative, we multiply by (t-t[-1]) and divide by 60 and k.

P2 = P1*(t-t[-1])/60/k

Note: 60 and k were just factors to scale the curve.

Multiplying P1 by (t-t[-1]) finds the rectangular area of each segment of deltaBT (P1). As you can see, we did exact the opposite but we are not finished yet. We have the area (height*width) of each interval in P2 but we need to add them up. To accomplish that, we create another function (P3) that takes as input P2 and sums the result for each data point.

P3 = P2 + F1

In P3, we used the F1 variable to store the running sum. F1 (feedback) holds the value of the last computation and feeds it back. When we look at the results of the new curve (P3), we notice that the new curve sits at the bottom and starts at temperature zero. We need to add a constant to raise it up if we want to see it. If we knew that the BT was initially 370F then we could use P4 as follows.

P4 = P3 + 370

Now P4 should match the original BT curve. We can now say that we have reconstructed BT by using the data of deltaBT plus a constant. In other words, we used input-output steps to reconstruct BT from deltaBT. As an exercise, try practicing with an ln() function of your choice in P1. Do its derivative in P2, and then try to reconstruct P1 using only P2 data.


Series will probably come up in later posts, so I may introduce them here while we are in the subject of calculus. I won’t do examples in Artisan like before as this is a subject that is more theoretical.  Newton introduced the idea of representing functions as series (power series). He wanted to integrate difficult functions by representing them as a series (sums), and then integrating each term (easier).  By doing term by term derivation or integration, the derivative of a sum is the sum of the derivatives, and the integral of a sum is the sum of the integrals. We break the problem into byte size pieces. Many things can be analyzed by breaking them into easier pieces. In other words, we transform their representation to accomplish a task that was difficult before. Pocket calculators use series to calculate functions (sin, cos, etc). 

A series is an indicated sum of a sequence of numbers and a sequence is a list of ordered numbers. In other words, a series is a sum whereas a sequence is a list of numbers.
  • Sequence: {1, 3, 2, 4, 4, 4}
  • Arithmetic series:  1 + 3 + 5 + 7 + ….
  • Geometric series:  a + a*x^1 + a*x^2 + a* x^3 + …
  • Power series: c0 + c1*x + c2*x^2 + c3*x^3 + …

The higher the number of terms, the better the approximation becomes. In other words, the longer the sum, the better the estimation. Some series approximate faster than others (need fewer terms). The following are some examples of useful series expansions that approximate a value.
  • e^x  = x + (x^2)/2! + (x^3)/3! + (x^4)/4! + …
  • ln(x) = 2*(x + (x^3)/3 +( x^5)/5 + (x^7)/7 + …)
  • ln(1+x) = x – x^2/2 + x^3/3 – x^4/4 + …

The Taylor series expansion of a function is a geometric series and states that
  • f(x+h)  = f(x) + (h*f’(x))/1 + (h^2*f’’(x))/2! + (h^3*f’’’(x))/3! + …
  • h = a differential  (delta) e.g. h =( t[+1] – t) 
  • f’(x) = first derivative
  • f’’(x) = second derivative, etc.

Math Formulas

The plotter in Artisan has excellent support for visualizing symbolic mathematical formulas. Mathematical formulas are added in a plot via the command annotate and using TeX markup. Here are some examples (prepared in axes configuration range of  600F):

  • annotate($square-symbol=\sqrt[3]{x}$,01:00,500,20)
  • annotate($Sum-symbol =\sum_{i=0}^\infty\frac{z^{-1}}{3!} + \frac{z^{-2}}{4!}$,01:00,400,20)
  • annotate($Fractions=\left(\frac{5 - \frac{1}{x}}{4}\right)$,01:00,300,20)
  • annotate($fonts = \mathcal{CALIGRAPHY---}\mathrm{ROMAN---}\mathit{ITALIC---}\mathtt{TYPEWRITER---}\mathdefault{ DEFAULT}$,01:00,200,20)
  • annotate(arrows=$500\Longleftarrow your-value$,01:00,100,20)
  • annotate($integral-symbol =  \int_{t=0}^\infty\frac{log(t)}{dt}$,06:00,500,20)
  • annotate($Greek-letters=\alpha--\beta--\gamma--\omega--\rho--\theta--\phi$,06:00,400,20)