C
C#β’16mo ago
Thinker

# β 0-1 sine wave

Just a super general math question. If I want a sine wave which has a period of 1 and an amplitude of 1 which goes between 0 and 1, what would be the most concise way to write that? I.e. `f(0) = 0`, `f(0.5) = 1`, `f(1) = 0`, as a sine wave.
25 Replies
Thinkerβ’16mo ago
I can come up with `-((cos(2 * pi * x) - 1) / 2)` but was just wondering if there some more elegant way to write it.
rhymbitβ’16mo ago
Won't it be just `sin(2 * pi * x)` ? `y = sin(2 * pi * x)` @π Thinker π
Aaronβ’16mo ago
isn't that just sin(Οx) it follows the examples you gave at least
Thinkerβ’16mo ago
well
Thinkerβ’16mo ago
black is `sin(2 * pi * x)`, red is the desired curve
Aaronβ’16mo ago
oh I'm stupid
rhymbitβ’16mo ago
I think red is just `sin(pi * x)` I thought you wanted entire period of wave to be within 0 to 1 half a period would be `sin(pi * x)`
Thinkerβ’16mo ago
ah, my bad on terminology then
Aaronβ’16mo ago
just `abs(sin(pi * x))`?
Thinkerβ’16mo ago
bouncy
Aaronβ’16mo ago
yeah, you're right shows how much I got out of trig in high school
Aaronβ’16mo ago
well when actual math fails me there's always the backup
Thinkerβ’16mo ago
what the hell is `sinΒ²`
Aaronβ’16mo ago
sin, squared it's the same as `sin()Β²`
Thinkerβ’16mo ago
ah huh yeah that works, now I'm just why
Aaronβ’16mo ago
why that works or how it got to that
Thinkerβ’16mo ago
nvm
Aaronβ’16mo ago
for the second, this
Thinkerβ’16mo ago
you have Wolfram Alhpa pro?
Aaronβ’16mo ago
nope! the mobile app just acts like you do, no idea why best 3 usd I've ever spent
ACiDCA7β’16mo ago
is it just me or is the shown solution here not exactly what was asked.. i just tried it and it starts at 1 instead of 0 which you then also could just do:
Aaronβ’16mo ago
sinΒ²(Οx) starts at 0
ACiDCA7β’16mo ago
`-cos(2 * pi * x) / 2 + 0.5`