/**
 * You are an astronomer studying stars. Your task is to calculate the absolute magnitude of a star
 * using its apparent magnitude and distance from Earth. The formula to calculate absolute magnitude is:
 *
 * M = m - 5 * (log(d) - 1)
 *
 * Where:
 * - M is the absolute magnitude
 * - m is the apparent magnitude
 * - d is the distance from Earth (in parsecs)
 *
 * You need to complete the code below to calculate the absolute magnitude based on the given
 * apparent magnitude and distance.
 *
 * @param magnitude The apparent magnitude of the star.
 * @param distance The distance of the star from Earth in parsecs.
 * @return The calculated absolute magnitude.
 */
import kotlin.math.log10


fun calculateMagnitude(magnitude: Double, distance: Double): Double {

    // Calculate the absolute magnitude
    val absoluteMagnitude = magnitude - 5 * (log10(distance) - 1)
    return absoluteMagnitude
}
import kotlin.math.log10

/**
 * You are an astronomer studying stars. Your task is to calculate the absolute magnitude of a star
 * using its apparent magnitude and distance from Earth. The formula to calculate absolute magnitude is:
 *
 * M = m - 5 * (log(d) - 1)
 *
 * Where:
 * - M is the absolute magnitude
 * - m is the apparent magnitude
 * - d is the distance from Earth (in parsecs)
 *
 * You need to complete the code below to calculate the absolute magnitude based on the given
 * apparent magnitude and distance.
 *
 * @param magnitude The apparent magnitude of the star.
 * @param distance The distance of the star from Earth in parsecs.
 * @return The calculated absolute magnitude.
 */
fun calculateMagnitude(magnitude: Double, distance: Double): Double {
import kotlin.math.log10

/**
 * You are an astronomer studying stars. Your task is to calculate the absolute magnitude of a star
 * using its apparent magnitude and distance from Earth. The formula to calculate absolute magnitude is:
 *
 * M = m - 5 * (log(d) - 1)
 *
 * Where:
 * - M is the absolute magnitude
 * - m is the apparent magnitude
 * - d is the distance from Earth (in parsecs)
 *
 * You need to complete the code below to calculate the absolute magnitude based on the given
 * apparent magnitude and distance.
 *
 * @param magnitude The apparent magnitude of the star.
 * @param distance The distance of the star from Earth in parsecs.
 * @return The calculated absolute magnitude.
 */
fun calculateMagnitude(magnitude: Double, distance: Double): Double {

    // Calculate the absolute magnitude
    val absoluteMagnitude = magnitude - 5 * (log10(distance) - 1)
    return absoluteMagnitude
}