I was playing around with some Generalized Trigonometric Functions defined as follows;

 w[n_] := E^((2*\[Pi]*I)/n)

 Ncos[n_, x_] := Expand[(1/n)*Sum[E^(x*w[2 n]^(2 k + 1)), {k, 0, n - 1}]]

 Nsin[n_, j_, x_] := Expand[(1/(n*w[2 n]^j))*Sum[w[n]^(-j*k) E^(x*w[2 n]^(2 k + 1)), {k, 0, n - 1}]]

These functions act like the familiar trigonometric functions and have the property that

$$\frac{d^{2n}}{dx^{2n}}f(x)=f(x)$$ or $$f^{(n)}(x)+f(x)=0$$

As I was testing with paper and pencil I wrote up the above functions when I got home to my computer and observed that these relations hold. However, when I employ the derivative function $D$ in Mathematica, it will give the derivative in terms of the expanded function. For example, if I type in


It returns $$-\frac{e^{-x}}{3}+\frac{1}{3}e^{{\frac{-i\pi}{3}-e^{\frac{-i\pi}{3}}}x}+\frac{1}{3}e^{{\frac{i\pi}{3}-e^{\frac{i\pi}{3}}}x}$$

The derivative should equal -Nsin[3,2,x], and when you input


it returns


While Mathematica doesn't output the same form, subtracting the two yields 0, proving their equality...

My question is this. Is there a way to get mathematica, when I input


to output


Or for other derivative, for example, if I input


I would like to see


Is this possible?

  • $\begingroup$ Could you check your results? I copied your definitions and ran them, and I don't get the results you posted for -Nsin[3, 2, x] (your result seems to be missing a few $x$ here and there) or for D[Ncos[3, x]] (your result seems to contain a $(-1)^{1/3}$ factor in two terms that I cannot reproduce. Not only that, but if I run D[Ncos[3, x]] - (-Nsin[3, 2, x]) // FullSimplify I do NOT obtain zero, no matter what I try for simplification. $\endgroup$
    – MarcoB
    Commented Feb 25, 2016 at 23:05
  • $\begingroup$ Did you include the root of unity definition? Mine definitely works, and I verified with with >D[Nsin[3,2,x],x]-Nsin[3,1,x] // FullSimplify $\endgroup$ Commented Feb 25, 2016 at 23:15
  • $\begingroup$ I could email you my notebook.... $\endgroup$ Commented Feb 25, 2016 at 23:18
  • $\begingroup$ I edited the formulas (removed the simplify command) and reposted. I am definitely getting the correct results... $\endgroup$ Commented Feb 25, 2016 at 23:21
  • $\begingroup$ @MarcoB have you retried with the new formulas i edited in the question? $\endgroup$ Commented Feb 26, 2016 at 2:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.