Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seawater Freezing Temperature Calculator

A C++ command-line application for estimating seawater freezing temperatures from salinity data using least-squares linear regression.


Context & Provenance

  • Project Context: Coursework project for Scientific Computing / C++ (NYU Abu Dhabi).
  • Author: Ashmit Mukherjee.

Mathematical Model

The relationship between salinity ($S$) and freezing temperature ($T$) is estimated using a least-squares linear fit:

[ T = m \cdot S + b ]

where slope ($m$) and intercept ($b$) are derived from pairs of salinity and freezing point measurements:

[ m = \frac{\sum (S \cdot T) - n \cdot \overline{S} \cdot \overline{T}}{\sum (S^2) - n \cdot (\overline{S})^2} ] [ b = \overline{T} - m \cdot \overline{S} ]

(Historical note: While original course prompts may have casually referred to this calculation as "linear interpolation," the implemented algorithm computes a least-squares linear regression fit across multiple data points).


Running Locally

# Compile
g++ -std=c++17 main.cpp -o seawater_calc

# Run calculator
./seawater_calc

Sample interaction:

1
seawater_data.txt
2
seawater_data.txt
25
3

License

This repository's source code is licensed under the MIT License.

About

C++ linear interpolation tool for estimating seawater freezing temperature from salinity.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages