# \[GiF\] Tangents (Tangent lines to a Bessel function)

**URL:** <https://community.wolfram.com/t/gif-tangents-tangent-lines-to-a-bessel-function/10578>\
**Category:** Staff Picks\
**Tags:** computational-arts, calculus, geometry, graphics-and-visualization, interface-construction, staff-pick\
**Created:** [May 24, 2017, 5:00am UTC](https://community.wolfram.com/t/gif-tangents-tangent-lines-to-a-bessel-function/10578 "2017-05-24T05:00:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![claytonshonkwiler](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/claytonshonkwiler/32/24940_2.png) [@claytonshonkwiler](https://community.wolfram.com/u/claytonshonkwiler)\
**Post date:** [May 24, 2017, 5:00am UTC](https://community.wolfram.com/t/gif-tangents-tangent-lines-to-a-bessel-function/10578/1 "2017-05-24T05:00:14Z")

</div>

![lines9c.gif](https://global.discourse-cdn.com/wolfram/original/3X/f/9/f99a2871b5b55b155d69a8e4be1e4cc35881b834.gif)

**Tangents**

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_](https://wolfram.discourse.group/t/10272/1) , 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](http://lcdf.org/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];
 Manipulate[
  Graphics[
   {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}]
 ]

```

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [May 11, 2022, 8:18pm UTC](https://community.wolfram.com/t/gif-tangents-tangent-lines-to-a-bessel-function/10578/2 "2022-05-11T20:18:53Z")

</div>

![news-congrads-kkluyshnik-02-04-19.jpg](https://global.discourse-cdn.com/wolfram/original/3X/6/a/6a310c2d0904616faf4e6e148260c9f29ab9f4eb.jpeg) – you have earned _ **Featured Contributor Badge** _ ![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)  
Your exceptional post has been selected for our editorial column _ **Staff Picks** _ [http://wolfr.am/StaffPicks](http://wolfr.am/StaffPicks) and [Your Profile](http://community.wolfram.com/web/claytonshonkwiler) is now distinguished by a _ **Featured Contributor Badge** _ and is displayed on the [Featured Contributor Board](https://community.wolfram.com/people). Thank you!
