Message Boards Message Boards

0
|
1724 Views
|
5 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to modify the code to make the function image clear?

Posted 1 year ago

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}]
POSTED BY: Lee Tao
5 Replies

The problem is that the functions depend inversely on x so they diverge as x -> 0. Try removing PlotRange -> All.

POSTED BY: Rohit Namjoshi
Posted 1 year ago

The previous effect is like this, which obviously does not meet the requirements

enter image description here

POSTED BY: Lee Tao
Posted 1 year ago
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}]
POSTED BY: Lee Tao
Posted 1 year ago

enter image description here

POSTED BY: Lee Tao
Posted 1 year ago

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}]
POSTED BY: Lee Tao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract