File:Fractional part and its antiderivatives.svg

Summary

Description
English: Fractional part and its antiderivatives
Français : La partie fractionnaire et ses primitives
Date
Source Own work
Author Gapato
SVG development
InfoField
Source code
InfoField

(scipy/numpy/matplotlib) Python code

from matplotlib.pyplot import *
 from numpy import *
 from scipy.integrate import cumtrapz

 def f(x):
     return x*sin(1/x)

 eps = 1e-9
 x0 = linspace(0, 1-eps, 100)
 x1 = linspace(1, 2-eps, 100)
 x2 = linspace(2, 3-eps, 100)

 int_x0 = x0-modf(x0)[1]
 int_x1 = x1-modf(x1)[1]
 int_x2 = x2-modf(x2)[1]

 x = hstack((x0, x1))
 int_x = hstack((int_x0, int_x1))

 first_prim = cumtrapz(int_x, x, initial=0)
 second_prim = cumtrapz(first_prim, x, initial=0)

 plot(x0, int_x0, color='blue', lw=2)
 plot(x1, int_x1, color='blue', label=r'$f(x)=x-\lfloor x \rfloor$', lw=2)

 plot(x, first_prim, color='red', label=r'$F(x)=\int_0^x f(t)dt$', lw=2)

 plot(x, second_prim, color='green', label=r'$\int_0^x F(t)dt$', lw=2)

 legend(loc=2)
 tight_layout()
 show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Fractional%20part%20and%20its%20antiderivatives.svgCategory:Self-published work
Category:Fractional part Category:Integral calculus
Category:CC-Zero Category:Fractional part Category:Integral calculus Category:Self-published work Category:Valid SVG created with Matplotlib code