Skip to content

fix(trigonometry): add arcsin() function#113

Merged
antfullstack merged 2 commits intoantfullstack:mainfrom
tysoncung:fix/110-add-arcsin
Apr 12, 2026
Merged

fix(trigonometry): add arcsin() function#113
antfullstack merged 2 commits intoantfullstack:mainfrom
tysoncung:fix/110-add-arcsin

Conversation

@tysoncung
Copy link
Copy Markdown
Contributor

Problem

Issue #110 requested an arcsin() function in trigonometry.py to complement the existing sin() and arctan() functions.

Solution

Implemented arcsin(x) using the identity:

arcsin(x) = arctan(x / sqrt(1 - x²))

This leverages the existing arctan() and the algebra.sqrt() functions already in the codebase, keeping the implementation consistent with the project's style.

Behaviour

  • Accepts float | int input in the range [-1, 1]
  • Raises ValueError for inputs outside the valid domain
  • Handles edge cases x = 1π/2 and x = -1-π/2 directly
  • Returns the result in radians

Files Changed

  • simple_equ/geometry/trigonometry.py — added arcsin() function with full docstring

Verification

from simple_equ.geometry.trigonometry import arcsin
import math

arcsin(0)    # 0.0
arcsin(0.5)  # ≈ 0.5236 (π/6)
arcsin(1)    # ≈ 1.5708 (π/2)
arcsin(-0.5) # ≈ -0.5236

Closes #110

Implement arcsin(x) using the identity arcsin(x) = arctan(x / sqrt(1-x²)).
- Accepts float or int in the range [-1, 1]
- Raises ValueError for inputs outside the valid domain
- Handles edge cases x = ±1 directly (returns ±π/2)
- Returns result in radians, consistent with arctan()
@antfullstack
Copy link
Copy Markdown
Owner

Thank you! That will be merged, really appreciate your time and effort!

@antfullstack antfullstack merged commit 389e060 into antfullstack:main Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add arcsin() function in geometry

2 participants