Advertisement
onexiv

CST

Mar 29th, 2025 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. import math
  2.  
  3. def analyze_divisible_angles():
  4. """
  5. Analyzes angles divisible by 3 up to 90°, comparing a custom pattern
  6. to trigonometric functions (cosine, sine, tangent).
  7. """
  8. print("# Analysis of Angles and Trigonometric Patterns")
  9. print("\nAngle | Third | Pattern | cos(θ) | sin(θ) | tan(θ) | Diff (cos) | Diff (sin) | Diff (tan)")
  10. print("------|-------|---------|--------|--------|--------|------------|------------|------------")
  11.  
  12. bool_div = -1 # Initialize pattern multiplier
  13.  
  14. for angle in range(1, 91, 1):
  15. third = angle / 3 # Exact third of the angle
  16. angle_rad = math.radians(angle)
  17.  
  18. # Trigonometric functions
  19. cos_val = math.cos(angle_rad)
  20. sin_val = math.sin(angle_rad)
  21. tan_val = math.tan(angle_rad) if angle != 90 else float('inf') # Avoid infinity at 90°
  22.  
  23. # Compute pattern
  24. x_recip = 1 / (angle if angle != 0 else 1) # Reciprocal of angle
  25. max_val = max(angle, x_recip)
  26. min_val = min(angle, x_recip)
  27. pattern = math.radians(-1 * (max_val - min_val - max_val))
  28.  
  29. # Toggle `bool_div` every 3rd angle
  30. if angle % 3 == 0:
  31. bool_div *= 1
  32.  
  33. # Compute differences
  34. diff_cos = abs(pattern - cos_val)
  35. diff_sin = (abs(pattern / angle)) # if sin_val != 0 else (abs(pattern - (1 / sin_val)))
  36. diff_tan = abs(pattern)**2/3
  37.  
  38. # print(f"{angle:3d}° | {third:5.1f}° | {pattern:8.4f} | {cos_val:6.4f} | {sin_val:6.4f} | {tan_val:6.4f} | {diff_cos:10.6f} | {diff_sin:10.6f} | {diff_tan:10.6f}")
  39.  
  40. # Highlight small differences
  41. if diff_cos < 0.1 or diff_sin < 0.1 or diff_tan < 0.1:
  42. print(f"\n🔹 Significant match at {angle}°:")
  43. print(f" - Pattern: {pattern:.6f}")
  44. print(f" - cos(θ): {cos_val:.6f}, sin(θ): {sin_val:.6f}, tan(θ): {tan_val:.6f}")
  45. print(f" - Diff (cos): {diff_cos:.6f}, Diff (sin): {diff_sin:.6f}, Diff (tan): {diff_tan:.6f}")
  46. print("---")
  47.  
  48. # Run the function
  49. analyze_divisible_angles()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement