A scientific calculator Android app built with Kotlin and Jetpack Compose, covering basic arithmetic plus a full set of bonus scientific/mathematical features.
- Addition, subtraction, multiplication, division
- Percentage, sign toggle, decimal input
- Division-by-zero handled gracefully (shows "Error", no crash)
- Trigonometric functions:
sin,cos,tanand their inverses (sin⁻¹,cos⁻¹,tan⁻¹) - Hyperbolic functions:
sinh,cosh,tanh - DEG / RAD toggle for angle mode
- Logarithms:
log(base 10),ln(natural log) - Powers & roots:
x²,√,xʸ - Other functions:
1/x,n!(factorial), constantsπande - Supports entering a function either before or after the number (e.g. both
sin → 90and90 → sinwork)
- Supports matrix sizes from 2×2 up to 4×4
- Operations: Addition, Subtraction, Multiplication, Determinant, Inverse, Transpose
- Grid-style input for entering matrix values directly
- Invalid operations (e.g. inverting a singular matrix, multiplying mismatched sizes) show a clear error instead of crashing
- Enter any dataset (comma-separated numbers) to compute:
- Mean, Median, Mode, Range
- Sample Variance, Sample Standard Deviation
- Permutations (
nPr) and Combinations (nCr) calculator with input validation
- Full dark / light theme toggle
- Color-coded buttons (operators, functions, numbers, equals) for visual clarity
- Built entirely with Jetpack Compose (modern, declarative Android UI)
The app is split into a logic layer and a UI layer, so the math itself can be reasoned about (and tested) independently of the Android UI:
app/src/main/java/com/example/sencalculator/
├── MainActivity.kt → Hosts the app, mode switcher (tabs), theme toggle
├── logic/
│ ├── CalculatorEngine.kt → Basic arithmetic + scientific functions
│ ├── MatrixOps.kt → Matrix add/subtract/multiply/determinant/inverse/transpose
│ └── StatsOps.kt → Mean/median/mode/variance/stddev + nPr/nCr
└── ui/
├── BasicCalculatorScreen.kt
├── ScientificScreen.kt
├── MatrixScreen.kt
├── StatsScreen.kt
└── theme/ → Compose theme, colors, dark/light support
Key design choices:
- All math functions in the
logiclayer returnnullon invalid input (e.g. divide by zero, square root of a negative number, inverse of a singular matrix) instead of throwing exceptions — the UI checks fornulland shows a friendly error message. - The four calculator modes (Basic, Scientific, Matrix, Stats) are separate, independently testable Compose screens, switched via a tab bar in
MainActivity.kt.
| Basic | Scientific |
|---|---|
![]() |
![]() |
| Matrix | Statistics |
|---|---|
![]() |
![]() |
- Clone this repository:
git clone https://github.com/LightX5/SEN-Calculator.git
- Open the project in Android Studio
- Run on an emulator or physical device via the Run button
A pre-built debug APK is also available in the /releases folder of this repo — download app-debug.apk and install it directly on an Android device (you may need to allow "install from unknown sources").
- Language: Kotlin
- UI Toolkit: Jetpack Compose (Material 3)
- Min SDK: API 24 (Android 7.0)
- Architecture: Logic layer separated from UI (Compose screens + pure Kotlin math engine)



