Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have defined the following function, which is the Euler relation for $\cos\,x$.

f[x_] := 1/2*(Exp[I*k*x] + Exp[-I*k*x ] )

I want to take the derivative with respect to x, but I am not getting the "right" answer. How do I do this?

share|improve this question

closed as too localized by Sjoerd C. de Vries, Szabolcs, m_goldberg, rm -rf May 12 '13 at 20:21

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

"I am not getting the "right" answer." - what then were you expecting? –  J. M. May 12 '13 at 17:14
I'm getting a long dump of answers when i type f[x]'. I expect to get each exponential multiplied by i*k. I –  olliepower May 12 '13 at 17:16
Really? The output of D[(Exp[I k x] + Exp[-I k x])/2, x] sure looks reasonable to me. –  J. M. May 12 '13 at 17:18
you mean f'[x]? –  Spawn1701D May 12 '13 at 17:20
Since your problem is a simple syntax error I'm voting to close. –  Sjoerd C. de Vries May 12 '13 at 17:53

1 Answer 1

up vote 3 down vote accepted

I'm not sure what you're looking for in a 'right' answer, but here are some ways to take (and view) the derivative of your function:

D[f[x], x]
Dt[f[x], x] // TraditionalForm
Dt[f[x], x] // FullSimplify // TraditionalForm

Check the documentation for D and Dt and pay close attention to syntax (ie. where all the punctuation and arguments go)

share|improve this answer
or try ExpToTrig[D[f[x], x]] to see what it really is. –  bill s May 12 '13 at 17:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.