6
1
The Challenge
Your challenge is to write a program that evaluates the following function:
f(x, t) = d^x / dt^x (sin t)
That is, the x-th derivative of sin t. In case you aren't familiar with calculus, here is a table of derivatives for the sine function:
...
f(-1, t) = -cos t
f(0, t) = sin t
f(1, t) = cos t
f(2, t)= -sin t
...
The sequence repeats these 4 functions.
The Inputs
Your program should take in an integer to be used as the x value in the function, and a float to be used at the t value in the function.
Your program may use radians or degrees for the sine function.
The Output
Your program should output the value of f(x, t) given the integer x and float t.
Scoring
This is code-golf, so the shortest answer (in bytes) wins.
6Are you sure d^-1 / dt^-1 (sin t) = -cos t ? – Leaky Nun – 2016-08-13T18:52:30.017
1What precision should this be to? – HyperNeutrino – 2016-08-13T18:58:37.137
1Test cases would be great. – Lynn – 2016-08-13T22:26:07.110
Okay so trigonometry builtins seem to be allowed. Just a comment, who is not familiar with calculus does not understand the table either :P – Leif Willerts – 2016-08-14T00:46:27.667
Today, I am more in the mood of writing an exponential function
e^x
deriving machine. – sergiol – 2017-05-26T21:37:30.030I think you should repeat the challenge forbidding the π/2 left shift technique! – sergiol – 2017-05-27T20:40:09.990