Showing posts with label curve fitting. Show all posts
Showing posts with label curve fitting. Show all posts

Saturday, October 25, 2025

Casio fx-991CW: Arc of a Quadratic Curve

Casio fx-991CW: Arc of a Quadratic Curve



All screen shots will be taken with the https://www.classpad.app/ website.


Introduction


We are given three points: (x1, y1), (x2, y2), and (x3, y3) which are connected to a quadratic curve:


y(x) = a + b * x + c * x^2


with it’s derivative:

y’(x) = b + 2 * c * x


We assume that all three x-values are unique, therefore x1 ≠ x2, x2 ≠ x3, and x1 ≠ x3.


The arc length is the integral: ∫( √(1 + (b + 2 * c * x)^2 dx, min(x), max(x))


In curve fitting, if we only have three points, the quadratic curve will fit all three points.



Procedure


We can do the entire calculation in the Statistics app of the fx-991CW.


1. Go to the Statistics app by pressing [ Home ], selecting Statistics.

2. Enter the three points. If you need to, you can clear the lists by selecting Tools > Edit > Delete All.

3. Press [OK] (or [EXE] ), select Statistics Calc, y = a + b * x + c * x^2, and then press [OK] (or [EXE]) again. The Statistics Calc will allow us to make calculations using the statistics variables.

4. Calculate the integral:

∫ ( √(1 + (b + 2 * c * x)^2), min(x), max(x))


∫: Catalog > Func Analysis > Integration

b: Catalog > Statistics > Regression > b

c: Catalog > Statistics > Regression > c

min(x): Catalog > Statistics > Regression > Min/Max > min(x)

max(x): Catalog > Statistics > Regression > Min/Max > min(x)


Let’s walk through an example:


Points: (0,0), (5,4), (7,2)

Arc length: 9.97139451


You can see the procedure through the screen shots below:





Quadratic Curve:



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Saturday, October 18, 2025

Numworks: Estimating the Speed of Sound in Water

 Numworks: Estimating the Speed of Sound in Water


Generally, the speed of sound in water is faster than the speed of sound in air. Is there an easy way to estimate the speed of sound in water using curve fitting? I will use the Numworks’ Regression App. The online simulator of Numworks: https://www.numworks.com/simulator/ .


* For readability, I consolidated some screen shots.


The data, from The Engineering Toolbox (see Source below) is shown in below:


SI Units

Temperature in °C

Speed of sound in m/s (meters/second)

0

1403

5

1427

10

1447

20

1481

30

1507

40

1526

50

1541

60

1552

70

1555

80

1555

90

1550

100

1543


https://www.engineeringtoolbox.com/sound-speed-water-d_598.html





Of the curve fits available, I found the best fits were to be with polynomial regression.


Quadratic Regression: y = a2 * x^2 + a1 * x + a0



y = -0.02736013 * x^2 + 4.059449 * x + 1407.3398


where y is the speed of sound in water (m/s) and x is the temperature (°C). The r^2 parameter is 0.9980768, which is pretty good given the raw data is only rounded the nearest integer. The Numworks also offers residual plot, which is the difference between predicted and given data. From the residual plot, the biggest difference was at x = 0.


Quartic Regression: y = a4 * x^4 + a3 * x^3 + a2 * x^2 + a1 * x + a0



If we are looking for better accuracy, we could use the quartic regression, where r^2 parameter is 0.99981. From the residual plot, the biggest difference was located at x = 60.


y = -7.955665 * 10^-7 * x^4 + 2.523644 * 10^-4 * x^3 – 0.05122094 * x^2 + 4.782147 * x + 1403.692


For a quick calculation, the quadratic equation could be sufficient enough.



Source


The Engineering ToolBox (2004). Water - Speed of Sound vs. Temperature. [online] Available at: https://www.engineeringtoolbox.com/sound-speed-water-d_598.html. Accessed May, 2025.


Eddie

All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


The author does not use AI engines and never will.


Saturday, May 17, 2025

TI-84 Plus CE: Rafter Multipliers and Roof Area

TI-84 Plus CE: Rafter Multipliers and Roof Area



Introduction


Rafter multipliers are a quick way to calculate the area of a roof. All that is needed are three measurements:


(1) The width of a house

(2) The length of a house, including eaves and lengths of overhangs

(3) The pitch of the roof. The pitch the rise of the roof in inches over a run of 12 inches.


It is assumed that we have a simple roof and the area of the house is rectangular. Even in more complex cases, we can use the multipliers come up with a good approximation.



Pitch = rise in inches / 12 inches


The area of the roof depends on the width, length, and pitch.


The area is approximated by:

roof area ≈ length * width * rafter factor


The common values are shown here:


Pitch (n in 12”)

Pitch (decimal – 3 places)

Rafter Factor (decimal -3 places)

2 in 12

0.167

1.014

3 in 12

0.250

1.031

4 in 12

0.333

1.054

5 in 12

0.417

1.083

6 in 12

0.500

1.118

7 in 12

0.583

1.158

8 in 12

0.667

1.202

9 in 12

0.750

1.250*

10 in 12

0.833

1.302

11 in 12

0.917

1.357

12 in 12

1.000

1.413

13 in 12

1.083

1.474

14 in 12

1.167

1.537

15 in 12

1.250

1.601

16 in 12

1.333

1.667

17 in 12

1.417

1.734

18 in 12

1.500

1.803

19 in 12

1.583

1.875

20 in 12

1.667

1.948

21 in 12

1.750

2.010

22 in 12

1.833

2.083

23 in 12

1.917

2.167


* This was erroneously labeled as 1.357 on the Dewalt Construction Math Quick Check guide (see Sources). Several sources correctly has the value of 1.250.



Curve Fitting


What if I can fit a formula to the above data?


I used a TI-84 Plus CE to assist me with this.


First, we’ll use the quadratic regression with the data from the above table:


y = a * x^2 + b * x + c


The resulting coefficients:


a = 0.1867080745

b = 0.2897396951

c = 0.938

r^2 = 0.9992015789


That’s a pretty good fit.


What about the square root fit:


y = √(a * x^2 + b)


If we square both sides, we get:


y^2 = a * x^2 + b


This equation takes somewhat the form of the linear regression.


Let z = x^2 and t = y^2, then:


z = a * t + b


Pitch (n in 12”)

X = Pitch (decimal – 3 places)

Z = X^2 (approximate)

Rafter Factor (decimal -3 places)

T = Y^2 (approximate)

2 in 12

0.167

0.0278

1.014

1.0282

3 in 12

0.250

0.0625

1.031

1.063

4 in 12

0.333

0.1111

1.054

1.1109

5 in 12

0.417

0.1736

1.083

1.1729

6 in 12

0.500

0.25

1.118

1.2499

7 in 12

0.583

0.3403

1.158

1.341

8 in 12

0.667

0.4444

1.202

1.4448

9 in 12

0.750

0.5625

1.250*

1.5625

10 in 12

0.833

0.6944

1.302

1.6952

11 in 12

0.917

0.8403

1.357

1.8414

12 in 12

1.000

1

1.413

1.9966

13 in 12

1.083

1.1736

1.474

2.1727

14 in 12

1.167

1.3611

1.537

2.3624

15 in 12

1.250

1.5625

1.601

2.5632

16 in 12

1.333

1.7778

1.667

2.7789

17 in 12

1.417

2.0069

1.734

3.0068

18 in 12

1.500

2.25

1.803

3.2508

19 in 12

1.583

2.5069

1.875

3.5156

20 in 12

1.667

2.7778

1.948

3.7947

21 in 12

1.750

3.0625

2.010

4.0401

22 in 12

1.833

3.3611

2.083

4.3389

23 in 12

1.917

3.6736

2.167

4.6959


Running the linear regression calculation with (z, t) we get:


a = 1.000120031

b = 1.00008392

r^2 = 0.9999332927

More accurate that the quadratic regression.


z = 1.000120031 * t + 1.00008392

y^2 = 1.000120031 * x^2 + 1.00008392

y = √(1.000120031 * x^2 + 1.00008392)



Analysis


I suspect that the exact formula for the rafter factor is:

rafter factor = √( pitch^2 + 1 ), pitch as a decimal


And the roof area is:

roof area = length * width * √( pitch^2 + 1 ) [ in inches ]


Roof area in square feet = Roof area in square inches / 144



Example


Area: length = 18 feet 6 inches, width = 20 feet, pitch = 7/12

In inches, length = 222 inches, width = 240 inches


roof area = 222 * 240 * √((7/12)^2 + 1) ≈ 61682.45131 in^2 ≈ 428.3503 ft^2



Sources


Prince, Christopher DeWALT Construction Math Quick Check: Extreme Duty Edition. Delmar, Cengage Learning: Cliffon Park, NY. 2010


Elliot. “Roof Area Calculator * Surface Area Multiplied by Pitch”. sktechandcalc.com. October 20, 2017. https://www.calculator.net/roofing-calculator.html?acarea=176&acareaunit=feet&roofpitch=4&angle=25&eaves=0&eavesunit=feet&price=&priceunit=feet&ctype=pitch&tp=ar&x=Calculate


calculator.net. “Roofing Calculator” 2008 – 2024. Retrieved November 4, 2024. https://www.calculator.net/roofing-calculator.html?acarea=176&acareaunit=feet&roofpitch=4&angle=25&eaves=0&eavesunit=feet&price=&priceunit=feet&ctype=pitch&tp=ar&x=Calculate



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


-

Python: Drawing a Ring of Circles

Python: Drawing a Ring of Circles The goal: Draw a number of circles that revolve around the origin (0,0). The center of each circle i...