Skip to content

MadBri/variacion_temp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

ejercicio_1

main.py

import math

def temperatura(t, T0=5, Ts=40, k=0.45):
    return Ts + (T0 - Ts) * math.exp(-k * t)

def tiempo_para_temp_deseada(Td, T0=5, Ts=40, k=0.45):
    return -(math.log((Td - Ts) / (T0 - Ts)) / k)

if __name__ == "__main__":
    # Temperaturas a las 1, 5, 12 y 14 horas
    for horas in [1, 5, 12, 14]:
        print(f"Temperatura después de {horas} horas: {temperatura(horas):.2f} ºC")

    # Tiempo para que la temperatura sea 0.5ºC menos que la temperatura ambiente
    Td = Ts - 0.5
    tiempo = tiempo_para_temp_deseada(Td)
    print(f"Tiempo para alcanzar {Td} ºC: {tiempo:.2f} horas")

Rama 1: temperatura_horas

import math

def temperatura(t, T0=5, Ts=40, k=0.45):
    return Ts + (T0 - Ts) * math.exp(-k * t)

if __name__ == "__main__":
    # Temperaturas a las 1, 5, 12 y 14 horas
    for horas in [1, 5, 12, 14]:
        print(f"Temperatura después de {horas} horas: {temperatura(horas):.2f} ºC")

Rama 2: tiempo_para_temp_deseada

import math

def tiempo_para_temp_deseada(Td, T0=5, Ts=40, k=0.45):
    return -(math.log((Td - Ts) / (T0 - Ts)) / k)

if __name__ == "__main__":
    # Tiempo para que la temperatura sea 0.5ºC menos que la temperatura ambiente
    Td = Ts - 0.5
    tiempo = tiempo_para_temp_deseada(Td)
    print(f"Tiempo para alcanzar {Td} ºC: {tiempo:.2f} horas")

Rama 3: funciones_generales

import math

def temperatura(t, T0=5, Ts=40, k=0.45):
    return Ts + (T0 - Ts) * math.exp(-k * t)

def tiempo_para_temp_deseada(Td, T0=5, Ts=40, k=0.45):
    return -(math.log((Td - Ts) / (T0 - Ts)) / k)

if __name__ == "__main__":
    # Temperaturas a las 1, 5, 12 y 14 horas
    for horas in [1, 5, 12, 14]:
        print(f"Temperatura después de {horas} horas: {temperatura(horas):.2f} ºC")

    # Tiempo para que la temperatura sea 0.5ºC menos que la temperatura ambiente
    Td = Ts - 0.5
    tiempo = tiempo_para_temp_deseada(Td)
    print(f"Tiempo para alcanzar {Td} ºC: {tiempo:.2f} horas")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published