4
$\begingroup$
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]
$\endgroup$
0

3 Answers 3

7
$\begingroup$

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

$\endgroup$
4
$\begingroup$

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}]
$\endgroup$
1
$\begingroup$

Another method:

Plot[D[(1.8)^n, n] /. {n -> x}, {x, 0.5, 10}]
$\endgroup$

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