is there a package that will automate the typesetting of the triangular table used to calculate the coefficients used in Newton's devided differences algorithm?
2 Answers
I found one solution in the internet that worked for me. If you want to see where I find use the link, it's a text about finite differences.
\[
\begin{array}{cccccc}
x_0 & y_0 \\
& & \Delta y_0 \\
x_1 & y_1 & & \Delta^2 y_0\\
& & \Delta y_1 & & \Delta^3 y_0\\
x_2 & y_2 & & \Delta^2 y_1 & & \Delta^4 y_0\\
& & \Delta y_2 & & \Delta^3 y_1\\
x_3 & y_3 & & \Delta^2 y_2\\
& & \Delta y_3 \\
x_4 & y_4
\end{array}
\]
I had the same problem this morning. I solved it using a not very elegant arrangement
\documentclass[a4paper,11pt]{article}
\usepackage{array}
\newcolumntype{C}{>{$}c<{$}}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{C}
\begin{tabular}{C|C|C|C|C|C|C|C|C}
x_1,x_2 & x_1,x_3 & x_1,x_4 & x_1, x_5 & x_1, x_6 & x_1, x_7 & x_1, x_8 & x_1, x_9 & x_1, x_{10}
\end{tabular}
\\
\begin{tabular}{C|C|C|C|C|C|C|C}
x_2,x_3 & x_2,x_4 & x_2,x_5 & x_2,x_6 & x_2,x_7 & x_2,x_8 & x_2,x_9 & x_2,x_{10}
\end{tabular}
\\
\begin{tabular}{C|C|C|C|C|C|C}
x_3,x_4 & x_3,x_5 & x_3,x_6 & x_3,x_7 & x_3,x_8 & x_3,x_9 & x_3,x_{10}
\end{tabular}
\\
\begin{tabular}{C|C|C|C|C|C}
x_4,x_5 & x_4,x_6 & x_4,x_7 & x_4,x_8 & x_4,x_9 & x_4,x_{10}
\end{tabular}
\\
\begin{tabular}{C|C|C|C|C}
x_5,x_6 & x_5,x_7 & x_5,x_8 & x_5,x_9 & x_5,x_{10}
\end{tabular}
\\
\begin{tabular}{C|C|C|C}
x_6,x_7 & x_6,x_8 & x_6,x_9 & x_6,x_{10}
\end{tabular}
\\
\begin{tabular}{C|C|C}
x_7,x_8 & x_7,x_9 & x_7,x_{10}
\end{tabular}
\\
\begin{tabular}{C|C}
x_8,x_9 & x_8,x_{10}
\end{tabular}
\\
\begin{tabular}{C}
x_9,x_{10}
\end{tabular}
\end{tabular}
\caption{Divided Differences}
\label{table:divided_differences}
\end{table}
\end{document}
-
2+1. I've taken the liberty of editing your code as follows: The
array
package needs to be loaded, not themathtools
package, in order to be able to make use of the\newcolumntype
macro.– MicoCommented Nov 23, 2016 at 9:39