[FEAT] Add Thin Lens formula for ray optics (#7170)

* [FEAT] Add Thin Lens formula for ray optics

* [CI] Re-run clang-format checks

* [CI] Re-run checks after rebase

* [STYLE] Apply clang-format to ThinLensTest

---------

Co-authored-by: Koushik Sai <nyamathabadkoushik@gmail.com>
This commit is contained in:
NYAMATHABAD KOUSHIK SAI
2025-12-17 21:18:00 +05:30
committed by GitHub
parent b76962d5ad
commit 4f293b33e5
2 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.thealgorithms.physics;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class ThinLensTest {
@Test
void testConvexLensRealImage() {
double v = ThinLens.imageDistance(10, 20);
assertEquals(20, v, 1e-6);
}
@Test
void testMagnification() {
assertEquals(2.0, ThinLens.magnification(20, 10), 1e-6);
}
}