<s>[INST] Four points, sine, Taylor's series I am creating a program that finds the cubic equation $y = ax^3+bx^2+cx+d$ through four points; I have already found how to calculate the coefficients, but I am also attempting to use a Taylor’s series to approximate a sine equation $A\sin(Bx+C)+D$ through roughly the same points based on the cubic function. Is there anyway to find $A, B, C$, or $D$ using solely the points’ coordinates and/or $a,b,c$, or $d$?
 [/INST] Note that the Taylor expansion you need is
$$
\sin x = \sum_{k=1}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!}
       = x - x^3/6 + \Theta\left(x^5\right)
$$
Hence
$$
A\sin(Bx+C) + D
   \approx D + A\left[ (Bx+C) - (Bx+C)^3/6 \right]
$$
and now expand the brackets and do arithmetic. The next term in the series would be $x^5$, so the coefficients of $x^2$ is zero and you are only looking upto cubic term.
UPDATE
Expanding the right-hand side you get 4 equations
$$
\left\{\begin{matrix}
6a = AB^3\\
2b = AB^2C \\
c = B\left(A-3C^2\right)\\
d = D + AC\left(1 - \frac{C^2}{6}\right)
\end{matrix}\right\|
$$
You need to solve these for $A,B,C,D$ in terms of $a,b,c,d$. Here is one approach.
If $a=b=c=0$ then set $A=B=C=0$ and $D=d$.
If one of $a,b,c$ is not zero, we can assuming $B \ne 0$. Then first equation implies
$$
A = \frac{6a}{B^3}
$$
and second equation implies
$$
C = \frac{2b}{AB^2} = \frac{2b}{B^2 \frac{6a}{B^3}} = \frac{Bb}{3a}.
$$
The last equation implies
$$
D = d - AC\left(1 - \frac{C^2}{6}\right)
$$
so everything boils down to knowing the value of $B$. From the 3rd equation, we have
$$
\frac{c}{B} = A - 3C^2 = \frac{6a}{B^3} - \frac{B^2 b^2}{3a^2}.
$$
Take the left and right expressions (exclude the middle one) and cross multiply by $3a^2B^3$ to get
$$
3a^2cB^2 = 18a^3 - B^5b^2
$$
and so we must solve
$$
B^5b^2 + 3a^2cB^2 = 18a^3,
$$
which does not have an analytic solution. However, given the values of $a,b,c$ you can use numerical root-finding (like Newton's method, for example) to find the value(s) of $B$ for which this equation is true (and it is guaranteed that $B$ will have at least one real value).
</s>