d4t_formulas/assets/formulas/formulas.d4rt

148 lines
5.1 KiB
Text
Raw Normal View History

2025-09-20 14:46:21 +00:00
[
{
"name": "Temperature converter",
"description": "Example of simple formula, just unit conversion",
"input": [
2025-10-14 17:21:35 +00:00
{"name": "Input", "unit": "Kelvin" }
],
"output": {"name": "Output", "unit": "Kelvin" },
"d4rtCode": "Output = Input;",
"tags": ["converter", "temperature" ]
},
2025-09-20 14:46:21 +00:00
// Free fall distance (vertical)
{
"name": "Free Fall Distance",
2025-10-05 14:53:46 +00:00
"description": r"""
2025-09-20 14:46:21 +00:00
Calculates vertical displacement under constant gravity
2025-09-22 15:00:34 +00:00
$$h = \\frac{1}{2}gt^2$$
2025-09-20 14:46:21 +00:00
Where:
2025-09-22 15:00:34 +00:00
- $g$: Gravitational acceleration ($9.81\\ \\mathrm{m/s^2}$ on Earth)
- $t$: Time in free fall (seconds)
2025-09-20 14:46:21 +00:00
2025-10-05 14:53:46 +00:00
![Free Fall Diagram](https://altcalculator.com/wp-content/uploads/2023/08/Free-Fall.png)""",
2025-09-20 14:46:21 +00:00
"input": [
{"name": "t", "unit": "second"}, // Time in seconds
{"name": "g", "unit": "meters per second"} // Gravitational acceleration
2025-09-20 14:46:21 +00:00
],
"output": {"name": "h", "unit": "meter"}, // Height in meters
2025-09-22 15:00:34 +00:00
"d4rtCode": "h = 0.5 * g * pow(t, 2);",
2025-09-20 14:46:21 +00:00
"tags": ["physics", "kinematics"]
},
// Newton's Law of Universal Gravitation
{
"name": "Gravitational Force",
2025-10-05 14:53:46 +00:00
"description": r'''
2025-09-20 14:46:21 +00:00
Newton's law of universal gravitation
\(F = G\\frac{m_1m_2}{r^2}\)
2025-09-20 14:46:21 +00:00
Where:
2025-09-22 15:00:34 +00:00
- $G$: Gravitational constant ($6.674\\times 10^{-11}\\ \\mathrm{N\\cdot m^2/kg^2}$)
- $m_1, m_2$: Masses of two objects
- $r$: Distance between centers of masses
2025-09-20 14:46:21 +00:00
![Gravitation](https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/NewtonsLawOfUniversalGravitation.svg/1200px-NewtonsLawOfUniversalGravitation.svg.png)''',
"input": [
{"name": "m1", "unit": "kilogram"}, // Mass 1
{"name": "m2", "unit": "kilogram"}, // Mass 2
{"name": "r", "unit": "meter"} // Distance between masses
2025-09-20 14:46:21 +00:00
],
"output": {"name": "F", "unit": "newton"}, // Force in newtons
2025-09-22 15:00:34 +00:00
"d4rtCode": "F = (6.67430e-11 * m1 * m2) / pow(r, 2);",
2025-09-20 14:46:21 +00:00
"tags": ["physics", "astronomy", "gravity"]
},
// Kinetic Energy
{
"name": "Kinetic Energy",
2025-10-05 14:53:46 +00:00
"description": r'''
2025-09-20 14:46:21 +00:00
Energy possessed by a moving object
2025-09-22 15:00:34 +00:00
$$KE = \\frac{1}{2}mv^2$$
2025-09-20 14:46:21 +00:00
Where:
2025-09-22 15:00:34 +00:00
- $m$: Mass of object
- $v$: Velocity of object
2025-09-20 14:46:21 +00:00
![Kinetic Energy](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Kinetic_energy.svg/1200px-Kinetic_energy.svg.png)''',
"input": [
{"name": "m", "unit": "kilogram"}, // Mass
{"name": "v", "unit": "meters per second"} // Velocity
2025-09-20 14:46:21 +00:00
],
"output": {"name": "KE", "unit": "joule"}, // Energy in joules
2025-09-22 15:00:34 +00:00
"d4rtCode": "KE = 0.5 * m * pow(v, 2);",
2025-09-20 14:46:21 +00:00
"tags": ["physics", "energy", "mechanics"]
},
// Projectile Motion Range
{
"name": "Projectile Range",
2025-10-05 14:53:46 +00:00
"description": r"""Calculates horizontal distance of projectile motion
$$R = \\frac{v^2 \\sin(2\\theta)}{g}$$
Where:
- $v$: Initial velocity
- $\\theta$: Launch angle
- $g$: Gravitational acceleration
![Projectile Motion](https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Projectile_motion_diagram.png/800px-Projectile_motion_diagram.png)""",
2025-09-20 14:46:21 +00:00
"input": [
{"name": "v", "unit": "meters per second"}, // Initial velocity
2025-09-22 15:00:34 +00:00
{"name": "a", "unit": "degree"} // Launch angle
2025-09-20 14:46:21 +00:00
],
"output": {"name": "R", "unit": "meter"}, // Horizontal distance
2025-09-22 15:00:34 +00:00
"d4rtCode": """
var radians = a * (pi / 180);
R = (pow(v, 2) * sin(2 * radians)) / 9.80665;
""",
2025-09-20 14:46:21 +00:00
"tags": ["physics", "kinematics", "projectile"]
},
{
"name": "Newton's Second Law",
2025-10-05 14:53:46 +00:00
"description": r'''
2025-09-20 14:46:21 +00:00
Force equals mass times acceleration
2025-09-22 15:00:34 +00:00
$$F = m \\cdot a$$
2025-09-20 14:46:21 +00:00
Where:
2025-09-22 15:00:34 +00:00
- $m$: Mass of object ($\\mathrm{kg}$)
- $a$: Acceleration ($\\mathrm{m/s^2}$)
2025-09-20 14:46:21 +00:00
![Newton's Second Law](https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Newtonslawsofmotion.jpg/800px-Newtonslawsofmotion.jpg)''',
"input": [
{"name": "m", "unit": "kilogram"}, // Mass
{"name": "a", "unit": "meters per square second"} // Acceleration
2025-09-20 14:46:21 +00:00
],
"output": {"name": "F", "unit": "newton"}, // Force in newtons
2025-09-21 14:53:50 +00:00
"d4rtCode": "F = m * a;",
2025-09-20 14:46:21 +00:00
"tags": ["physics", "mechanics", "newton"]
},
2025-11-05 11:59:11 +00:00
// Apgar Score
{
"name": "Apgar Score",
"description": "Newborn health assessment scoring system\n\nScores 0-2 for:\n1. Heart rate\n2. Breathing\n3. Muscle tone\n4. Reflexes\n5. Skin color\nTotal score 0-10",
"input": [
2026-01-25 17:39:43 +00:00
{"name": "HeartRate", "values": ["Absent", "< 100 bpm>", "> 100 bpm"] },
{"name": "Breathing", "values": ["Absent", "Weak, irregular", "Strong, robust cry"] },
{"name": "MuscleTone", "values": ["None", "Some", "Flexed arms/leg, resists extension"] },
{"name": "Reflexes", "values": ["No response", "Grimace on aggressive stimulation", "Cry on stimulation"] },
{"name": "SkinColor", "values": ["Blue or pale", "Blue extremities, pink body", "Pink"] }
2025-11-05 11:59:11 +00:00
],
2025-11-09 19:29:58 +00:00
"output": {"name": "Result", "unit": "scalar"},
2025-11-05 11:59:11 +00:00
"d4rtCode": """
var total = HeartRate + Breathing + MuscleTone + Reflexes + SkinColor;
var interpretation = switch (total) {
>= 7 => 'Normal',
4-6 => 'Requires attention',
_ => 'Emergency care needed'
};
Result = 'Score: \$total - \$interpretation';
""",
"tags": ["medical", "pediatrics", "assessment"]
}
2025-09-20 14:46:21 +00:00
]