csn899
(Lee Tao)
November 17, 2022, 7:40am
1
How to modify the code so that the abscissa and ordinate of the original function and derivative function are adaptive in the same coordinate system so that the displayed image size is appropriate and the form of the function image can be felt as a whole
ClearAll@f;
f[x_] := Log[x]/-x^2
Manipulate[Refresh[functions = Table[D[f[x], {x, n}], {n, 0, nMax, 1}];
orders =
Table[D[f[x], {x, n}] // Inactivate // TraditionalForm //
ToString, {n, 0, nMax, 1}];
labels =
MapThread[#1 <> " = " <> ToString[#2, TraditionalForm] &, {orders,
functions}];];
Plot[functions, {x, 0, 1}, PlotLabels -> labels, PlotRange -> All,
ImageSize -> 700, AspectRatio -> 1,
PlotLabel -> Row[{"f(x) = ", f[x]}]], {{nMax, 1, "Order"}, 1, 10, 1,
PopupMenu}]
csn899
(Lee Tao)
November 17, 2022, 7:42am
2
The previous effect is like this, which obviously does not meet the requirements
The problem is that the functions depend inversely on x so they diverge as x -> 0. Try removing PlotRange -> All.
csn899
(Lee Tao)
November 18, 2022, 8:07am
4
ClearAll@f;
f[x_] := Log[x]/-x^2
Manipulate[Refresh[functions = Table[D[f[x], {x, n}], {n, 0, nMax, 1}];
orders =
Table[D[f[x], {x, n}] // Inactivate // TraditionalForm //
ToString, {n, 0, nMax, 1}];
labels =
MapThread[#1 <> " = " <> ToString[#2, TraditionalForm] &, {orders,
functions}];];
Plot[functions, {x, 0, 13}, PlotLabels -> labels, ImageSize -> 700,
AspectRatio -> 1,
PlotLabel -> Row[{"f(x) = ", f[x]}]], {{nMax, 1, "Order"}, 1, 10, 1,
PopupMenu}]
csn899
(Lee Tao)
November 18, 2022, 8:19am
6
Set to equal horizontal and vertical coordinates
ClearAll@f;
f[x_] := x Log[x]
Manipulate[Refresh[functions = Table[D[f[x], {x, n}], {n, 0, nMax, 1}];
orders =
Table[D[f[x], {x, n}] // Inactivate // TraditionalForm //
ToString, {n, 0, nMax, 1}];
labels =
MapThread[#1 <> " = " <> ToString[#2, TraditionalForm] &, {orders,
functions}];];
Plot[functions, {x, 0, 5}, PlotLabels -> labels, ImageSize -> 700,
AspectRatio -> Automatic,
PlotLabel -> Row[{"f(x) = ", f[x]}]], {{nMax, 1, "Order"}, 1, 10, 1,
PopupMenu}]