Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Implementing Sinusoidal-Tangent Functions in Python | Functions and Their Properties
Mathematics for Data Science

bookImplementing Sinusoidal-Tangent Functions in Python

Transcendental functions aren't just about exponentials and logarithms — they also include trigonometric functions, which describe oscillations, periodic movements, and wave patterns.

This section explores how we can visualize these functions in Python with proper scaling, key points, and function behaviors.

Sine Function: Understanding Oscillations

Sine waves model natural oscillations, such as sound waves and circular motion. The sine function follows the general form:

How the Code Works

  • Defines sine_function(x, a, b, c, d) to control amplitude (a), frequency (b), phase shift (c), and vertical shift (d).
  • Generates x values over two full periods to capture the wave shape.
  • Marks maxima, minima, and intercepts to highlight key points.
  • Includes arrows at both ends to indicate the function continues indefinitely.

Cosine Function: A Phase-Shifted Sine Wave

Cosine functions behave similarly to sine but are phase-shifted by π2\frac{\pi}{2}. They are commonly used in oscillations, physics, and even electrical engineering.

How the Code Works

  • Uses cosine_function(x, a, b, c, d) with the same parameters as sine;
  • Marks key points:
    • Maxima at x=0x = 0;
    • Minima at x=±πx = \pm \pi;
    • Intercepts where the function crosses zero.
  • Adds arrows for infinite continuity.

Tangent Function: Dealing with Asymptotes

Tangent waves are different from sine and cosine because they have asymptotes at x=±π2,±3π2x = \pm \frac{\pi}{2}, \pm\frac{3 \pi}{2}. These occur where cos(x)=0\cos(x) = 0, making the function undefined.

How the Code Works

  • Defines tangent_function(x) = tan(x);
  • Splits x into three segments to avoid vertical asymptotes;
  • Plots asymptotes as dashed red lines where the function is undefined;
  • Includes arrows at both ends to show continuity;
  • Adjusts zoom level to display only two asymptotes, avoiding graph clutter.

1. Where is the first maximum of the cosine function?

2. If we increase b in the sine function, what happens?

question mark

Where is the first maximum of the cosine function?

Select the correct answer

question mark

If we increase b in the sine function, what happens?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 10

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Suggested prompts:

Can you explain the differences between sine, cosine, and tangent functions in more detail?

How do the parameters (amplitude, frequency, phase shift, vertical shift) affect the graphs of these functions?

Can you walk me through how to plot these trigonometric functions step by step in Python?

Awesome!

Completion rate improved to 1.89

bookImplementing Sinusoidal-Tangent Functions in Python

Sveip for å vise menyen

Transcendental functions aren't just about exponentials and logarithms — they also include trigonometric functions, which describe oscillations, periodic movements, and wave patterns.

This section explores how we can visualize these functions in Python with proper scaling, key points, and function behaviors.

Sine Function: Understanding Oscillations

Sine waves model natural oscillations, such as sound waves and circular motion. The sine function follows the general form:

How the Code Works

  • Defines sine_function(x, a, b, c, d) to control amplitude (a), frequency (b), phase shift (c), and vertical shift (d).
  • Generates x values over two full periods to capture the wave shape.
  • Marks maxima, minima, and intercepts to highlight key points.
  • Includes arrows at both ends to indicate the function continues indefinitely.

Cosine Function: A Phase-Shifted Sine Wave

Cosine functions behave similarly to sine but are phase-shifted by π2\frac{\pi}{2}. They are commonly used in oscillations, physics, and even electrical engineering.

How the Code Works

  • Uses cosine_function(x, a, b, c, d) with the same parameters as sine;
  • Marks key points:
    • Maxima at x=0x = 0;
    • Minima at x=±πx = \pm \pi;
    • Intercepts where the function crosses zero.
  • Adds arrows for infinite continuity.

Tangent Function: Dealing with Asymptotes

Tangent waves are different from sine and cosine because they have asymptotes at x=±π2,±3π2x = \pm \frac{\pi}{2}, \pm\frac{3 \pi}{2}. These occur where cos(x)=0\cos(x) = 0, making the function undefined.

How the Code Works

  • Defines tangent_function(x) = tan(x);
  • Splits x into three segments to avoid vertical asymptotes;
  • Plots asymptotes as dashed red lines where the function is undefined;
  • Includes arrows at both ends to show continuity;
  • Adjusts zoom level to display only two asymptotes, avoiding graph clutter.

1. Where is the first maximum of the cosine function?

2. If we increase b in the sine function, what happens?

question mark

Where is the first maximum of the cosine function?

Select the correct answer

question mark

If we increase b in the sine function, what happens?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 10
some-alt