C
C#2y 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
Thinker2y 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
rhymbit2y ago
Won't it be just sin(2 * pi * x) nervousowo ? y = sin(2 * pi * x) @🌈 Thinker 🌈
Aaron
Aaron2y ago
isn't that just sin(πx) it follows the examples you gave at least
Thinker
Thinker2y ago
well
Thinker
Thinker2y ago
black is sin(2 * pi * x), red is the desired curve
Aaron
Aaron2y ago
oh I'm stupid
rhymbit
rhymbit2y 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
Thinker2y ago
ah, my bad on terminology then
Aaron
Aaron2y ago
just abs(sin(pi * x))? KEKW
Thinker
Thinker2y ago
bouncy
Aaron
Aaron2y ago
yeah, you're right shows how much I got out of trig in high school
Aaron
Aaron2y ago
well when actual math fails me there's always the backup
Thinker
Thinker2y ago
what the hell is sin²
Aaron
Aaron2y ago
sin, squared it's the same as sin()²
Thinker
Thinker2y ago
ah huh yeah that works, now I'm just why
Aaron
Aaron2y ago
why that works or how it got to that
Thinker
Thinker2y ago
nvm
Aaron
Aaron2y ago
for the second, this
Thinker
Thinker2y ago
you have Wolfram Alhpa pro?
Aaron
Aaron2y ago
nope! the mobile app just acts like you do, no idea why best 3 usd I've ever spent
ACiDCA7
ACiDCA72y 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
Aaron2y ago
sin²(πx) starts at 0
ACiDCA7
ACiDCA72y ago
uuuh crap my bad
230V
230V2y ago
-cos(2 * pi * x) / 2 + 0.5
ACiDCA7
ACiDCA72y ago
jea i missed the - -.-
Want results from more Discord servers?
Add your server