For those who want to spend their life understanding
The Analysis Tool (also called REPL) – is JavaScript code used by Claude.ai to perform the thermal calculations and generate the data. This was invoked using the repl
command.
React Component – This is the visualization code Claude.ai created as an artifact using React and the Recharts library to display the temperature profiles. This was created with the identifier “temp-profile” and used the artifact type “application/vnd.ant.react”.
It now all makes perfect sense – right? 🤣😂
import React from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
const TempProfile = () => {
const [data, setData] = React.useState([]);
React.useEffect(() => {
// Using properties from Table 3
const albumenFraction = 0.58;
const shellFraction = 0.11;
const yolkFraction = 1 - albumenFraction - shellFraction;
const avgSpecificHeat =
albumenFraction * 3935 +
yolkFraction * 3266 +
shellFraction * 888;
const eggMass = 0.06;
const eggRadius = 0.025;
const eggSurfaceArea = 4 * Math.PI * Math.pow(eggRadius, 2);
const timePoints = [];
const fridgeTemps = [];
const eggTemps = [];
const timeStep = 1;
const totalTime = 7 * 60;
for (let t = 0; t <= totalTime; t += timeStep) {
let fridgeTemp;
if (t <= 20) {
fridgeTemp = 4 + (10 - 4) * (t / 20);
} else {
fridgeTemp = 4 + (10 - 4) * Math.exp(-0.01 * (t - 20));
}
const h = 10;
const tempDiff = fridgeTemp - (eggTemps.length > 0 ? eggTemps[eggTemps.length - 1] : 4);
const heatTransfer = h * eggSurfaceArea * tempDiff * timeStep;
const tempChange = heatTransfer / (eggMass * avgSpecificHeat);
const newEggTemp = (eggTemps.length > 0 ? eggTemps[eggTemps.length - 1] : 4) + tempChange;
timePoints.push(t);
fridgeTemps.push(fridgeTemp);
eggTemps.push(newEggTemp);
}
const chartData = timePoints.map((t, i) => ({
time: Math.round(t / 60 * 10) / 10, // Convert to minutes with 1 decimal
fridgeTemp: Math.round(fridgeTemps[i] * 1000) / 1000,
eggTemp: Math.round(eggTemps[i] * 1000) / 1000
}));
// Sample every 3rd point to reduce data size
setData(chartData.filter((_, i) => i % 3 === 0));
}, []);
return (
<div className="w-full h-96 p-4">
<ResponsiveContainer width="100%" height="100%">
<LineChart data={data}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis
label={{ value: 'Time (minutes)', position: 'bottom', offset: 0 }}
dataKey="time"
/>
<YAxis
label={{ value: 'Temperature (°C)', angle: -90, position: 'insideLeft' }}
domain={[3, 11]}
/>
<Tooltip />
<Legend />
<Line
type="monotone"
dataKey="fridgeTemp"
stroke="#8884d8"
name="Fridge Temperature"
dot={false}
/>
<Line
type="monotone"
dataKey="eggTemp"
stroke="#82ca9d"
name="Egg Temperature"
dot={false}
/>
</LineChart>
</ResponsiveContainer>
</div>
);
};
export default TempProfile;