What is going on here? I have a simple function y=sin(2pi*x)...

What is going on here? I have a simple function y=sin(2pi*x). I only care about 0replace (1-x) by another formula so that the times of peaks and troughs are conserved but amplitude is still lost over time.

Pointing me in the right direction if it's too difficult to solve would be appreciated.

Other urls found in this thread:

en.wikipedia.org/wiki/Maxwell–Boltzmann_distribution
en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator
twitter.com/NSFWRedditVideo

The positions of the maxima are changing because the (1-x) term changes faster than the sin term close to the sine's peaks. Exponential decay would do the job, but won't be linear.

I don't mind exponential decay, but is there a single exponent that will preserve the times of the peaks and troughs?

e^(- alpha x)

Even with a period of 1 the peak and trough times don't match up with the expected .25 and .75 using e^-x

Multiplying two functions yields a different set of derivatives than for either function individually. Since maxima/minima are conditional on the derivatives, there is no expectation that maxes and mins should match after multiplying any arbitrary functions.

Try the elementary calculus yourself and you can prove that multiplying two arbitrary functions doesn't preserve maxima. (Why would it?)

>Since maxima/minima are conditional on the derivatives, there is no expectation that maxes and mins should match after multiplying any arbitrary functions.
Okay that makes sense.

So is anyway to find a non-arbitrary function that when multiplied:
>decays the amplitude over t=0 to t=1
>preserves the mimima and maxima of the first function

this sounds like an interesting problem, but first I have to ask:
Are you trying to model something or just find such a pair of functions that satisfy what you want?

>over time
>t
>including a spatial term x

is this not your problem?

>(1-t)sin(x)

no this was not the problem. please read the whole thread before posting something like this

literally answered the question as you phrased it. brainlet.

also you need to substitute pi into the formula instead of 2pi. the trough is unimportant.

oh and try sin^2(x)

or sin(x)cos(x) rather

or sin(2pi * x)*cos(pi/2 * x)

>doesn't read thread
>a fellow user politely asks to read the thread
>then insults fellow user
making posts like this decreases the quality of the board. please contribute in a respectful tone which is relevant to the mathematical content of the thread.

its true though. using shitty phrasing one can expect confusion.

im the only fucker contribooting as it stands now, so ill say whatever i damn well please!

so user you need to solve the problem:
f(0) = 0
f(1) = 0
f'(1/2) =0
f''(1/2) < 0

go nuts

>figure out how to calculate the new min and max when sin(2*pi*x) is multiplied by (1-x)
just differentiate sin(2*pi*x)*(1-x), and then use Newton's method to compute the zeros
>replace (1-x) with an easier formula
you didn't say anything about needing differentiability, so you can just replace (1-x) with a discrete function that shrinks after each half cycle

>being this much of an unironic shitposting highschooler

>Are you trying to model something or just find such a pair of functions that satisfy what you want?
I am writing a function for an animation system.

Imagine a fist punch animated for 1 second. An inexperienced animator would make 2 keyframes: the start of the punch and the end of a punch. Animations linearly interpolate over keyframes, so the animation would look really shitty because there is no momentum involved.
A novice animator would add in more keyframes so the punch gains momentum. Of course this can be automated with an exponential interpolation.
An expert animator will put in even more keyframes. A good looking punch will extend beyond its resting point initially, then the puncher will regain control and try to pull his fist back, then slightly forward, wobbling back and forth a few times as he is finally able to maintain the final resting position at time 1.
So you can automate this by phenomenon by creating a "decaying amplitude sine wave" interpolation function.

To make this as easy as possible for the animator, I would like the interpolation function to include the ability to modify the number of wobbles (period) and the time at which the wobble peaks. Multiplying the wobble decay doesn't affect the period, but it is affecting the time of the wobble peaks as seen in my original image. I am therefore trying to figure out how to decay the amplitude while maintaining the peak and trough times so the animator knows exactly what is happening.

user is trying to fit a function to a predetermined maximum of 1/2 and 3/4 respectively

shitposting "highschooler here".

im pretty sure this is the answer

en.wikipedia.org/wiki/Maxwell–Boltzmann_distribution

duh, that is what he said
just do what I said, and multiply sin(x) by a discrete function

yeah this is the best option, especially if the user is writing the function as a script.

or OP if you want something very close, (1-x/(4pi))sin(x) has a maximum at 4.92

>figure out how to calculate the new min and max times when sin(x) is multiplied by (1-x)
You mean differentiating the function sin(x)*(1-x) and finding the zeroes?

Basically this pic. 1-x won't work a as decay function, so I need a new decay function that preserves the times of peaks and troughs.

the user previous did give you a satisfactory answer. use a stepwise redefinition of the amplitude as you cross each point.

so your function will look like this:

def f(x):
if 0 < x < 0.25:
return sin(x)
if 0.25

In other words, you need a function such that
f(x)*sin(2*pi*x) < f(0.25 + 0.5*k_0)*sin(2*pi*(0.25 + 0.5*k_0)), where x are real numbers withing half a period of 0.25 + 0.5*k_0 (and 0.25 + 0.5*k_0 happens to belong to a crest). So, we have
f(x) - f(x)*(1 - sin(2*pi*x)) < f(0.25 + 0.5*k_0),
f(x) - f(0.25 + 0.5*k_0) < f(x)*(1 - sin(2*pi*x)),
[f(x) - f(0.25 + 0.5*k_0)]/[(1 - sin(2*pi*x))] < f(x)
[f(x) - f(0.25 + 0.5*k_0)]/[(sin(2*pi*(0.25 + 0.5*k_0) - sin(2*pi*x))] < f(x),
- [f(x) - f(0.25 + 0.5*k_0)]/[sin(2*pi*x) - sin(2*pi*(0.25 + 0.5*k_0)] < f(x)
in other words, - f ' (c) < f(x), where f ' (c) is the average derivative on the interval (x,0.25+0.5*k_0).

replace 0.5 with 1

e^-x won't work because the condition is satisfied only when x < x_0, not when x_0 < x
C definitely satisfies the condition, but f*sin will not shrink over time

annoying guy again.

this time i definitely got it, niggers.

en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator

so solve the damped harmonic oscillator, initial displacement of zero, initial velocity more than zero.

A damped harmonic oscillator actually has a decaying period. OP is trying to make a function where the amplitude decays but the period does not. So the damped harmonic oscillator function will not satisfy the requirements.

Harmonic Oscillator Equation:
ω = ω_0 | |
ω | angular frequency
ω_0 | natural angular frequency

Displacement:
You

This in fact corresponds to oscillation under friction, called Coulomb damping. IIRC the decay is proportional to the coefficient of friction. But I believe the center of oscillation also changed in that case. Should look natural enough.

>Coulomb
Input interpretation: C (coulomb)

Unit type: SI derived: A s (ampere second)

Basic unit dimensions: [time] [current]

Physical quantities: electric charge, battery capacity, dielectric flux

Corresponding quantities for 1 C:
Current I caused by the charge flowing in one second from I = Q/t: | 1 A (ampere)
Force F between like charges 1 cm apart from F = Q^2/(4πϵ_0r^2): | 8.988×10^13 N (newtons)
Time t to deliver 1 ampere of current from t = C/I: | 1 second

Comparisons for 1 C as electric charge:
≈ ( 0.02 ≈ 1/40 ) × positive and negative charge in a typical thundercloud (≈ 40 C )
≈ ( 0.05 ≈ 1/20 ) × charge transfer in a strong lightning stroke (≈ 20 C )
≈ 0.5 × charge transfer in a typical lightning stroke (≈ 2 C )

Conversions to other units:
1 C = unit | conversion | exact value
1 | 1000 mC (millicoulombs) | 1000 mC (millicoulombs)
1 | 0.001 kC (kilocoulombs) | 1/1000 kC (kilocoulombs)
1 | 0.1 abC (abcoulombs)
(unit officially deprecated) | 1/10 abC (abcoulombs)
1 | 2.998×10^9 statC (statcoulombs)
(unit officially deprecated) | 2997924580 statC (statcoulombs)
1 | 2.998×10^9 Fr (franklins) | 2997924580 Fr (franklins)
1 | 2.998×10^9 esus of charge
(unit officially deprecated) | 2997924580 esus of charge
1 | 0.1 emus of charge
(unit officially deprecated) | 1/10 emus of charge
1 | 1.036427×10^-5 F (faradays)
(unit officially deprecated) | 0.00001036427 F (faradays)
1 | 6.2415091×10^18 e (elementary charges) | 6.2415091×10^18 e (elementary charges)

Fuck off, this is not reddit.

...

1 * Two-sided limit does not exist = False
lim_(x->0) 1/x = False = True
lim_(x->0^-) 1/x = -∞ = False = True
lim_(x->0^+) 1/x = ∞ = False = True

pretty sure the frequency changes, but does not decay.

answer is the damped oscillator:
solve f_new = 2pi = f_initial * (1- damping const)^0.5

choose your damping constant and initial frequency to make a new freq of 1 rad per second.

if youre still here op, give me a (you)

So you want a "scaling down" function that doesn't change the positions of the turning points. Since D(fg) = gDf + fDg (i.e. the product rule), you'll get what you want if you choose a scaling function with zero derivative at the same points as the original sine wave. I suggest you construct it piecewise from cubics, setting each cubic to have an inflexion point at one of the sine function's turning points. You can make it smoother/bumpier/whatever by changing the coefficients, or by going to a higher-order polynomial if that doesn't work.

Did you want that sexy coulumb? It talks about Pi you know. Like, a lot. Cunt won't shut up about it.

ummm wat?

*shrug*
I'm cool with this.

6 is a good number too, it really knows how to avoid that -1/12

yah but 7 8 9 which is bad and wrong

You're talking to someone that really enjoys anal sex, dude!

You want an oscillatory curve with the same local maxima/minima but with decreasing amplitude.
Dude, just divide your curve by x+1 or something like that.

That's wrong. The curve must have the same critical points, the simplest case would be a cubic curve (because two critical points in the interval). In this case something like 16x^3-24x^2+9x+3 works well.

well i cant say i wanted to know.

[math] y = \frac {sin(2 \pi f x)} {x} [/math]
where f is the frequency of the sin wave.

express your new function as a Fourier series that includes as its leading term your OG sine wave. You can always do this. This of the series as 1) your zeroth order funciton (OG sine wave) 2) the next largest weighted sine wave can be thought of as a 1st order correction 2) next largest weighed sine wave a 2nd order correction... and so on.

Does anyone even bother reading the OP?

instead of (1-x) use
[eqn]1 - \int \sin(2\pi x)dx = 1 +\frac{\sin(4 \pi x)-4 \pi x}{8 \pi}[/eqn]

it works because the derivative is 0 at each minimum and maximum.

note that you need to use the same period in the integral as the sin you are trying to damp.

fuck, integral should be cos, not sin.
[eqn]1 - \int \sin(2\pi x)dx = 1 -\frac{\sin(4 \pi x)+4 \pi x}{8 \pi}[/eqn]

and I missed a square
[eqn] 1 - \int \sin^2(2\pi x)dx = 1 -\frac{\sin(4 \pi x)+4 \pi x}{8 \pi}[/eqn]

anyway, proof it works

+other one

jesus crist i cant latex tonight. excuse me im drunk
its
[eqn]1 - \int \cos^2(2\pi x)dx = 1 -\frac{\sin(4 \pi x)+4 \pi x}{8 \pi}[/eqn]

OP back. You are an absolute legend. I'm actually going to my submit spring interpolation function as a pull request to Unreal Engine with the help of your math. I want to credit you if you see this. I'll credit you as "Veeky Forums user 9147813" if you don't reply.

glad I could help. some version of user like that is fine.

Will do. Takes a couple of months for a pull request to go through, and then of course the wait for the new version to be publicly released.