0
$\begingroup$

I'm trying to map different values onto the derivatives of a function. To test it, I've tried the following:

D[x^5, x] /@ {1}

And the output is:

{(5x^4)[1]}.

Can someone tell me what I'm doing wrong? Clearly if the test works I'm hoping to get on output of 5.

$\endgroup$
  • 5
    $\begingroup$ try D[x^5, x] /. x -> {1, 2, 3} $\endgroup$ – Alucard Sep 20 '17 at 23:39
  • 1
    $\begingroup$ If you try simply Map[x, {1, 2, 3}] you get {x[1], x[2], x[3] which resembles your result. This means that Mma understands x as a head of some function, and according to the way how Map works, substitutes the list elements as its arguments. The workaround is to define a function of your choice, such as f[x_] = D[x^5, x];. Then f /@ {1, 2, 3} yields the ´desired result. Play attention on = instead of :=. If you define the function as f[x_] := D[x^5, x]; Mma will take the numbers of the list and then substitute them into the formula creating absurd expressions like D[1^5,1]. $\endgroup$ – Alexei Boulbitch Sep 21 '17 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.