Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"postCreateCommand": "./.devcontainer/post-create",
"customizations": {
"codespaces": {
"openFiles": [
"README.md"
]
"openFiles": ["README.md"]
},
"vscode": {
"settings": {
Expand Down
108 changes: 82 additions & 26 deletions lib/node_modules/@stdlib/math/base/special/sin/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,84 @@
# sin(x) - Your Chill Math Buddy

{{alias}}( x )
Computes the sine of a number.

Parameters
----------
x: number
Input value (in radians).

Returns
-------
y: number
Sine.

Examples
--------
> var y = {{alias}}( 0.0 )
~0.0
> y = {{alias}}( {{alias:@stdlib/constants/float64/pi}}/2.0 )
~1.0
> y = {{alias}}( -{{alias:@stdlib/constants/float64/pi}}/6.0 )
~-0.5
> y = {{alias}}( NaN )
NaN

See Also
--------
Hey! Sine takes an angle and gives you a number—like a height on a circle. Great for coding, music, or math fun. Let’s check it out!

---

## What You Give It

- **x**: a number
Angle in radians (not degrees—a full spin’s about 6.28). Works with any number, even `NaN` or infinity.

## What You Get Back

- **y**: a number
Between -1 and 1. `NaN` if `x` is weird.

## What It’s Good For

- Smooth game moves
- Sound tweaks
- Shape math

---
__________________________________________________________________________
## Give These a Go

- `sin(0.0)` → `0.0` (no turn)
- `sin( {{alias:@stdlib/constants/float64/pi}} / 2 )` → `1.0` (90°—top!)
- `sin( -{{alias:@stdlib/constants/float64/pi}} / 6 )` → `-0.5` (-30° dip)
- `sin( 0.785 )` → ~`0.707` (45°—even)
- `sin( {{alias:@stdlib/constants/float64/pi}} )` → `0.0` (half spin)
- `sin( Infinity )` → `NaN` (too big!)

---
__________________________________________________________________________
## Fun Code to Try

### For C Folks
code->
- **Add**: `#include <math.h>`
- **Bounce a Ball**:
```c
#include <math.h>
#include <stdio.h>
int main() {
for (int step = 0; step < 5; step++) {
printf("Height %d: %.2f\n", step, sin(step * 0.5));
}
return 0;
}

gcc file.c -lm—prints 0.00, 0.48, 0.91...
______________________________________________________________________
### For JavaScript Folks
Use: Math.sin()
Fade a Light:
code->
for (let time = 0; time < 5; time += 0.5) {
let glow = (Math.sin(time) + 1) / 2;
console.log(`Glow ${time}: ${glow.toFixed(2)}`);
}
output->
Shows 0.50, 0.73, 0.91—smooth!
__________________________________________________________________
Extra: Mix Waves
code->
let mix = Math.sin(1.5) + Math.sin(2.5);
console.log("Wave mix:", mix.toFixed(3)); // ~ -0.589
__________________________________________________________________
Quick Bits
Loops: Repeats every 6.28. sin(100) = sin(100 % 6.28).
Flips: sin(-x) = -sin(x).
Stays Simple: -1 to 1 only.
Spot-On: sin(π/2) = 1, sin(0) = 0.
___________________________________________________________________
Easy Tips
Degrees?: Multiply by 3.14 / 180. sin(60 * 3.14 / 180) ≈ 0.866.
Save It: Store repeats—like let h = sin(1.5).
Handy: sin(3.14 / 3) ≈ 0.866 (60°).
___________________________________________________________________
Other Pals
cos(x): Wave teammate.
tan(x): Slope helper.
{{alias:@stdlib/constants/float64/pi}}: 3.14159.
Loading
Loading