4
Plot[(1.8)^n, {n, 0.5, 10}]

Works fine, but this derivative gives an error and does not plot.

D[(1.8)^n, n] (* also ok *)
Plot[D[(1.8)^n, n], {n, 0.5, 10}, WorkingPrecision -> 300, PlotPoints -> 200]

General::ivar: 0.5000477864321607` is not a valid variable.

General::ivar: 0.5477864798994975` is not a valid variable.

General::stop: Further output of General::ivar will be suppressed during this calculation.

How might I be able to change this? The idea is to be able to plot something like this function and its derivative on the same plot.

 Plot[{(1.5)^n, D[(1.5)^n, n]}, {n, -10, 10}, Frame -> True]
creidhne
  • 5,055
  • 4
  • 20
  • 28
CasperYC
  • 1,550
  • 5
  • 13

3 Answers3

7

Need to evaluate first, since Plot has holdall attribute.

    Plot[Evaluate[D[(18/10)^n, n]], {n, 0.5, 10}]

enter image description here

enter image description here

Nasser
  • 143,286
  • 11
  • 154
  • 359
4

Other methods.

Plot[D[(18/10)^n, n], {n, 0.5, 10}, Evaluated -> True]
Plot[Derivative[1][(18/10)^# &][n], {n, .5, 10}]
Plot[Derivative[1][Function[n, (18/10)^n]][x], {x, .5, 10}]
cvgmt
  • 72,231
  • 4
  • 75
  • 133
1

Another method:

Plot[D[(1.8)^n, n] /. {n -> x}, {x, 0.5, 10}]
zakk
  • 978
  • 1
  • 7
  • 17