Message Boards Message Boards


[GIF] Tangents (Tangent lines to a Bessel function)

Posted 2 years ago
0 Replies
3 Total Likes

Tangent lines to a Bessel function


This shows 900 tangent lines to the Bessel function $J_4$. The Bessel function itself is not explicitly shown at all, but, as in Bessel, the graph of the function emerges quite clearly from the approximations.

One note: the GIF is made up out of 1801 frames, which seems to make the Javascript on the post preview page very unhappy, and the original file output by Mathematica was 275 MB(!). Using gifsicle to reduce the color palette and only record diffs between consecutive frames, I was able to get this down to 2.9 MB, or about 100 times smaller (and thereby actually reasonable to post online).

Here's the code, which makes use of one simple function that returns the tangent line to a function at a given point:

TangentLine[f_, x_] := InfiniteLine[{x, f[x]}, {1, f'[x]}];

DynamicModule[{f, b = N[BesselJZero[4, 6]], n = 450, 
  cols = RGBColor /@ {"#FF5200", "#003355"}},
 f[x_] := BesselJ[4, x];
   {Opacity[.1], cols[[1]],
    Table[TangentLine[f, x], {x, Max[-b, s - 2 b], Min[s, b], b/n}]},
   PlotRange -> {{-b, b}, {-2, 2}}, AspectRatio -> 2/3, 
   ImageSize -> 540, Background -> cols[[-1]]],
  {s, -b, 3 b}]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract