Created
November 30, 2020 13:02
-
-
Save Icaruk/59020db2a9f249033436198ed755dfe2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Devuelve la profundidad de un pozo a partir del tiempo tanscurrido entre soltar una piedra y escuchar su sonido. | |
* La piedra se deja caer, no se tira. | |
* | |
* @param {number} segundos Número de segundos desde que sueltas la piedra hasta que escuchas el sonido. | |
* @return {number} Profundidad del pozo en metros. | |
*/ | |
const alturaPozo = (segundos) => { | |
return ( | |
4.9 * ( | |
( | |
-340 + ( | |
Math.sqrt(115600 + 19.6 * (340 * segundos)) | |
) | |
) / 9.8 | |
) ** 2 | |
) | |
}; | |
// console.log( alturaPozo(2) ); // 18.54 metros |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment