Context 
The sinusoidal function takes an input value x (longitude) and calculates the corresponding latitude value y based on the sinusoidal function formula: y = A * sin(2 * π * f * normalizedX + φ) + yOffset Where A is the amplitude, f is the frequency, normalizedX is the normalized longitude value (scaled to a range of 0 to 1), φ is the phase shift, and yOffset is the vertical offset. The calculateY function is called when the "Calculate Latitude" button is clicked. It retrieves the user's input for longitude (x), calculates the corresponding latitude (y) using the sinusoidalFunction(x) function, and displays the result in the “Latitude" element on the page. It also updates the chart with the new y-coordinate. The chart contains two datasets: one for the sinusoidal curve and another for the y-coordinate point. The chartPoints variable generates an array of points for the curve by calling the sinusoidalFunction(x) function for a range of longitude values between minX and maxX.
Amplitude = 4.1      Frequency = .63      Phase Shift (Phi φ) = 1.5    Y-Offset (Lattitude) = -11
Figure shows HRSC photographic swaths of the Martian surface on Polar Orbit passes. These swaths are composited to ensure spherical distortion is eliminated. Image: Caplinger, M. A., & Malin, M. C. (2001)
Further reading: Caplinger, M. A., & Malin, M. C. (2001). Mars Orbiter Camera geodesy campaign. Journal of Geophysical Research: Planets, 106(E10), 23595-23606. https://doi.org/10.1029/2000JE001341 Jaumann R, et al (2007) The high-resolution stereo camera (HRSC) experiment on Mars Express: Instrument aspects and experiment conduct from interplanetary cruise through the nominal mission . The high-resolution stereo camera (HRSC) experiment on Mars Express: Instrument aspects and experiment conduct from interplanetary cruise through nominal mission. Planetary and Space Science. 55. 928-952. 10.1016/j.pss.2006.12.003. Gwinner, K., et al., (2009) Topography of Mars from global mapping by HRSC high-resolution digital terrain models and orthoimages: Characteristics and performance, Earth Planet. Sci. Lett., doi:10.1016/j.epsl.2009.11.007 Wikipedia:  https://en.wikipedia.org/wiki/Mars_Express European Space Agency  - Mars Express - The Scientific Investigations NASA: Mars Express Mission
Valles Marineris base Image from HRSC instrument on Mars Express Orbiter. Spherical Distortion corrected by HRSC
Sinusoidal Curve: Valles Marineris
Calculate Latitude Include the Chart.js library Include the JavaScript code
Y-Offset
Math Functions
The aim of the functions embedded within the code is to demonstrate that a mathematically derived Sinusoidal Curve can be closely correlated with the actual shape of the main Canyons of Valles Marineris (and in fact every other feature of the system) Javascript is used to visualize a sinusoidal curve and calculate the latitude value given a longitude input. The main mathematical function used is the sinusoidal function. Here's an explanation of the math involved in this code: Constants and variables, (example values in brackets):   A: Amplitude (4.1)   f: Frequency (0.63)   minX: Minimum longitude value (270)   maxX: Maximum longitude value (320)   phi: Phase shift (1.5)   yOffset: Vertical offset (-11.2) The sinusoidal function is defined as:     function sinusoidalFunction(x) {     const normalizedX = (x - minX) / (maxX - minX);     return A * Math.sin (2 * Math.PI * f *     normalizedX + phi) + yOffset; }
Hide Map
It has long been known that the Canyons of Valles Marineris have some degree of curvature but the exact nature of this curvature has not been previously explored. The evidence presented here suggests the curvature is in the form of a very precise Sinusoidal Curve, or Periodic Oscillation, detectable at all latitudes of the System. A potential objection is that the Sinusoidal Curve shown here is an artifact of an imaging process that might curve any feature on the spherical surface of Mars. In fact the HRSC (High Resolution Stereo Camera) onboard the Mars Express Orbiter, which is in a polar orbit, has been carefully designed to eliminate any spherical distortion. HRSC acquires image data in swaths that are typically up to 100kms wide (62 miles), which are then processed with a combination of techniques, including:   Pre-processing: geometric and radiometric correcting for the effects of camera and spacecraft motion. Projection: To correct for the spherical distortion, images are projected onto a reference ellipsoid that approximates the shape of Mars. This projection process essentially "flattens" the images onto a two-dimensional surface. Digital Terrain Models: HRSC generates DTMs - 3D models of the surface, created by combining the images taken from different angles. These models provide elevation data for each pixel in the image, which is crucial for correcting spherical distortion. Co-registration and Mosaicking: individual images are co-registered and adjusted to account for the spherical distortion. This process involves identifying common features in overlapping images, aligning them, and adjusting the images to ensure a smooth transition between adjacent image strips. After these steps are completed, the resulting composite image provides a large, seamless view of the Martian surface, stitched together from multiple individual image swaths and almost entirely eliminating spherical distortion. This means the HRSC base map on which the chart data and curves are drawn, is a highly accurate representation of the Martian surface free from any distortion.
How accurate and free from distortion is the base map used for the chart?
Amplitude = 4.1      Frequency = .63      Phase Shift (Phi φ) = 1.7   Y-Offset (Lattitude) = -13
Calculate Latitude Include the Chart.js library Include the JavaScript code
Amplitude = 4.1      Frequency = .63      Phase Shift (Phi φ) = 1.2    Y-Offset (Lattitude) = -8.5
Calculate Latitude Include the Chart.js library Include the JavaScript code
Valles Marineris base Image from HRSC instrument on Mars Reconnaisance Orbiter. Spherical Distortion corrected by HRSC
Calculate Latitude Include the Chart.js library Include the JavaScript code
Amplitude = 4.1      Frequency = .63      Phase Shift (Phi φ) = 1.2    Y-Offset (Lattitude) = -7
Calculate Latitude Include the Chart.js library Include the JavaScript code
Amplitude = 4.1      Frequency = .63      Phase Shift (Phi φ) = 1.1    Y-Offset (Lattitude) = -6.5
Calculate Latitude Include the Chart.js library Include the JavaScript code
Amplitude = 4.1      Frequency = .63      Phase Shift (Phi φ) = 1.1    Y-Offset (Lattitude) = -4.2