# Fitting a Parametric Curve

I apologize if this question is obvious or simple. I'm in high school and have started playing around with Mathematica only recently.

For my Calculus Final, I am supposed to use rotation about the $y$-axis to determine the volume of a Bundt cake.

I took a slice of the cake, put it on graph paper, recreated it in Photoshop, and manually extracted data points.

Both axes are in inches with each interval of 1 inch.

Here is a Google Sheet with the data.

I cut out the data points that allowed the top half of the curve to be a function and fit a quadratic function. Rotating that funtion gave me a volume. However the volume of the quadratic function is larger than the true volume because of the overshot area.

I believe fitting parametric curves and their rotation will result in the most accurate value for the volume.

However being an absolute Mathematica beginner, I have no idea how to fit a parametric curve to this data.

Any help would be much appreciated.

{xs, ys} = Transpose[data];
xi = ListInterpolation[xs, {0, 1}];
yi = ListInterpolation[ys, {0, 1}];


It is a nice looking cake:

ParametricPlot3D[{xi[s] Cos[t], xi[s] Sin[t], yi[s]}, {s, 0, 1}, {t,
0, 2 Pi}, Mesh -> False, Axes -> False, Boxed -> False,
Background -> Black]


Esimating volume:

area = Area@Polygon[Table[{xi[j], yi[j]}, {j, 0, 1, 0.01}]]
centr = (RegionCentroid@
Polygon[Table[{xi[j], yi[j]}, {j, 0, 1, 0.01}]] )[[1]]
volint = Abs[Pi NIntegrate[xi[t]^2 yi'[t], {t, 0, 1}]]
volp = 2 Pi area centr
max = Max[xs];
min = Min[xs];
br = (max + min)/2;
lr = (max - min)/2;
h = Max[ys];
volc = Pi (max^2 - min^2) h
volt1 = 2 Pi br Pi lr^2
volt2 = Pi^2 h^2 br/2


Tabulating:

Grid[{{"Integration of parametrized curve", volint},
{"Pappus theorem", volp},
{"Subtracting bounding cylinders", volc},
{"Volume of torus based radius from x axis", volt1},
{"Volume of torus based radius from y axis", volt2}
}, Alignment -> Left, Frame -> All]


Visualizing comparisons:

Torus based on x-axis radius (a bit like a donut and a cake):

Show[RevolutionPlot3D[{br + lr Cos[t], h/2 + lr Sin[t]}, {t, 0, 2 Pi},
PlotStyle -> {Pink, Opacity[0.8]}, Mesh -> None],
ParametricPlot3D[{xi[s] Cos[t], xi[s] Sin[t], yi[s]}, {s, 0, 1}, {t,
0, 2 Pi}, Mesh -> False, Axes -> False, Boxed -> False,
Background -> Black, PlotStyle -> Opacity[0.7]]]


Underestimates volume (cake has flatter base than torus).

Bounding cylinders (clearly overestimates volume):

Show[Graphics3D[{Blue, Cylinder[{{0, 0, 0}, {0, 0, h}}, min],
Opacity[0.3], Cylinder[{{0, 0, 0}, {0, 0, h}}, max]}],
ParametricPlot3D[{xi[s] Cos[t], xi[s] Sin[t], yi[s]}, {s, 0, 1}, {t,
0, 2 Pi}, Mesh -> False, Axes -> False, Boxed -> False,
Background -> Black, PlotStyle -> Opacity[0.7]]]


Apologies for any mistakes (have been sick) but post this for fun...

data = {{2.7263985, 3.1299872}, {2.8254118,
3.129117}, {2.9258595, 3.0881827}, {3.0831985,
3.1030724}, {3.2318013, 3.0817323}, {3.491054,
3.0078683}, {3.5876298, 2.9824286}, {3.7351758,
2.9093807}, {3.8878312, 2.828599}, {3.9565878,
2.777189}, {3.9974086, 2.728245}, {4.0675254,
2.6548667}, {4.114682, 2.6085348}, {4.1402016,
2.5763292}, {4.1682177, 2.5544748}, {4.1952934,
2.4524763}, {4.2424984, 2.3945112}, {4.25405,
2.3635385}, {4.3052645, 2.2564726}, {4.338581,
2.1803522}, {4.369396, 2.0951731}, {4.397598,
2.028079}, {4.4155917, 1.9738674}, {4.4310155,
1.9274001}, {4.434903, 1.908028}, {4.4566307,
1.8719283}, {4.4609118, 1.7569066}, {4.4635835,
1.7246034}, {4.4777694, 1.6703755}, {4.4957952,
1.6084083}, {4.4935064, 1.5476471}, {4.494829,
1.534727}, {4.4999967, 1.5127751}, {4.5077033,
1.490834}, {4.513078, 1.4184723}, {4.5131316,
1.4055467}, {4.528465, 1.381053}, {4.542592,
1.3410431}, {4.584714, 1.2843492}, {4.57849,
1.2545933}, {4.576068, 1.226146}, {4.5787873,
1.1822098}, {4.566296, 1.1330383}, {4.524935,
1.0048962}, {4.498449, 0.9634205}, {4.4795732,
0.92326987}, {4.437866, 0.87914413}, {4.4201913,
0.85580224}, {4.407625, 0.82472664}, {4.407657,
0.8169713}, {4.407721, 0.80146056}, {4.4115877,
0.7872586}, {4.427075, 0.7252807}, {4.4321895,
0.7162544}, {4.4312124, 0.6451582}, {4.414823,
0.617944}, {4.3921022, 0.5868251}, {4.357958,
0.55565745}, {4.3161817, 0.528335}, {4.282,
0.5062153}, {4.2706237, 0.49453348}, {4.2593913,
0.44795257}, {4.253124, 0.42853707}, {4.2176623,
0.40899706}, {4.0972033, 0.37746122}, {4.0718646,
0.36571988}, {4.061774, 0.35016584}, {4.047848,
0.34105837}, {4.0048075, 0.31243795}, {3.9174256,
0.26294702}, {3.900988, 0.24736592}, {3.859185,
0.22650628}, {3.8212006, 0.20307775}, {3.788246,
0.19130392}, {3.7412963, 0.18722591}, {3.6968749,
0.18574384}, {3.6676908, 0.1830342}, {3.6550133,
0.17910236}, {3.6398027, 0.17386715}, {3.62336,
0.15957859}, {3.5853913, 0.13227238}, {3.5511777,
0.11790803}, {3.4776733, 0.089157656}, {3.4307559,
0.07732428}, {3.383833, 0.06678346}, {3.3597422,
0.06021778}, {3.3293207, 0.049747348}, {3.282403,
0.037913967}, {3.2342002, 0.029952858}, {3.174568,
0.023235578}, {3.1111171, 0.019087175}, {3.0552878,
0.0136787}, {2.972749, 0.02108213}, {2.8863757,
0.03493212}, {2.8088932, 0.04752745}, {2.7415864,
0.054995853}, {2.699677, 0.059987422}, {2.6717517,
0.059868306}, {2.6247704, 0.06354566}, {2.5905037,
0.062106907}, {2.4952183, 0.0823818}, {2.4431436,
0.08991518}, {2.375837, 0.09738358}, {2.3377144,
0.10756163}, {2.3059437, 0.116474204}, {2.2219071,
0.17945233}, {2.098686, 0.20219323}, {2.0794544,
0.2486442}, {2.0450974, 0.269179}, {2.003103,
0.29485154}, {1.9623512, 0.3269923}, {1.9126823,
0.36685053}, {1.8859093, 0.39517316}, {1.8629656,
0.4183418}, {1.8323846, 0.44664818}, {1.7954143,
0.485268}, {1.7749985, 0.5110326}, {1.7367537,
0.5509395}, {1.7213941, 0.581896}, {1.6907917,
0.61537266}, {1.6614481, 0.65143985}, {1.6346114,
0.69527316}, {1.608996, 0.750745}, {1.6075512,
0.7933941}, {1.6035625, 0.8373249}, {1.5996108,
0.8722078}, {1.6323317, 0.9408543}, {1.632252,
0.96024275}, {1.6270577, 0.9886574}, {1.6231593,
1.0106148}, {1.6230849, 1.0287106}, {1.6266909,
1.0778441}, {1.6340303, 1.1450897}, {1.6426499,
1.2097557}, {1.6575203, 1.2977148}, {1.6762147,
1.3818125}, {1.6950102, 1.4413515}, {1.6987331,
1.4620488}, {1.6948241, 1.4865911}, {1.7112191,
1.5125127}, {1.7250276, 1.5500566}, {1.7338332,
1.5694829}, {1.7324309, 1.6017915}, {1.7386446,
1.6341325}, {1.74984, 1.6897614}, {1.7597395,
1.7518476}, {1.7671801, 1.7945347}, {1.7771008,
1.8514507}, {1.7907976, 1.9161382}, {1.8070704,
1.9717888}, {1.833519, 2.0223124}, {1.8498821,
2.0559893}, {1.8573387, 2.0947986}, {1.8673285,
2.1349113}, {1.8672222, 2.1607625}, {1.8683107,
2.204715}, {1.9061675, 2.259165}, {1.9072986,
2.292777}, {1.9096884, 2.3289795}, {1.9120675,
2.367767}, {1.9156681, 2.4181933}, {1.9307566,
2.4531574}, {1.9610026, 2.5062823}, {1.9874725,
2.5516357}, {2.0139744, 2.5892336}, {2.059495,
2.632083}, {2.097373, 2.6813629}, {2.1493094,
2.707436}, {2.2023716, 2.7684138}, {2.2238653,
2.7891867}, {2.2554817, 2.8177586}, {2.2871354,
2.8372822}, {2.3251143, 2.8620033}, {2.358048,
2.8789475}, {2.3846455, 2.8932793}, {2.4201338,
2.9063566}, {2.4302459, 2.9167402}, {2.4415636,
2.9426403}, {2.4617507, 2.9724557}, {2.4908442,
2.997139}, {2.5275488, 3.023147}, {2.5528557,
3.0426438}, {2.5807014, 3.0621514}, {2.6149201,
3.0752232}, {2.6504085, 3.0883005}, {2.6960406,
3.104006}, {2.7251236, 3.1312745}};

• It could use some icing.. – Daniel Lichtblau Jun 4 '15 at 15:35
• This is really helpful! My teachers jaw is going to hit the flow with all this math. :D. One question though: What are the parametric equations? I want to put them on my power-point and do some light computer assisted calculus on them. PS. I kept the icing off to keep the math simple XD – Zaid Mansuri Jun 4 '15 at 15:50
• @ZaidMansuri this is just using a versatile tool but you should do things yourself, get your own estimate...I could have made s mistake (unintentional) . The interpolated functions parametrize your measurement data. You should come up with your own approximation, e.g. approximating cross section with circle. I could not resist this nice q. but working things out for yourself is always better...learning from this site is good but using it to do homework is hollow victory...I am not implying this is your motive just that sink or swim on your own work...that is how you learn. – ubpdqn Jun 4 '15 at 22:30