Is there a way to make the function

f(w,t)=sin(wt)/w

defined at w = 0?

I want to achieve better numerical stability, and make it continuous everywhere.

Observation: Using limw->0 f(w,t)

I know that at w = 0:

f(0,t) = t

Is it possible to improve this function? I would be really glad to know and why, how. Thank you in advance!

I really do not want to code in smth like: if w < 0.001 { x = t; }

Background notes: My equation also has constant v coefficient, but I removed it for simplicity. f(w,t)=v*sin(wt)/w

If I derived this correctly this should be x component of a motion of a car that rotates with rate w. It goes with const speed and const steer.

These are consts: v - speed, l - base length(dist from rear to front shaft), a - steering angle.

w(a) is defined idk if correctly. w(a) = (vsin(2a))/(2*l) I just logically added proportions, projections, imagining a rear wheel powered car. Put some values I am somewhat confident in, such as: w(0) = 0 w(π/2) = 0

you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 2 months ago

You're right that limw->0 sin(wt)/w = t, because for small values of x, sin(x) is increasingly close to x,

but unfortunately limt->0 sin(wt)/w=0 because sin(0)=0

@Buildout has a good solution for the computation problem - a math library with sinc will compute t sinc(wt) much better than trying to compute sin(wt)/w for small values of w.

I don't know what's going on in the real world context when w or t are zero - this is an interesting question. Are either or both of them likely to actually be zero (or close enough that your processor uses zero to represent the number)? If so, can we deduce whether f(0,0)=1 or f(0,0)=0 is a better answer? Maybe f(0,0)=0 gives more surprising and jerky behaviour than f(0,0)=1, but I can't be certain of that.

  • source