我遇到了一个奇怪的问题,我自己无法解决。我正在尝试逐步构建经典三角函数、正弦和余弦的曲线。这是代码,编译不会结束(如果您尝试并遇到同样的问题,请在第 65 帧后中断编译)。我正在使用 LuaLaTeX。
\documentclass[12pt,a4paper]{beamer}
\usetheme{Warsaw}
\usecolortheme{crane}
\usepackage{etex}
\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{ifthen,calc}
\hypersetup{pdfencoding=utf8}
\usepackage{pgfplots,tikz}
\usetikzlibrary{calc,arrows,arrows.meta}
\listfiles
\begin{document}
\begin{frame}
\vspace*{3cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay]
\def\xm{-6.4}
\def\xM{6.4}
\def\ym{-2}
\def\yM{2}
\def\xC{-3.14}
\def\yC{4}
\def\lastcount{0}
\def\first{0}
\def\second{0}
\draw[very thick] (\xC, \yC) circle (1cm) ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ;
\draw[color=gray] (\xm,\ym) grid (\xM,\yM);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,\ym) grid (\xM,\yM);
\draw [-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw [very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw [very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\foreach \x/\label/\rx in {-6.28/$-2\pi$/.15, -4.71/$-\dfrac{3\pi}2$/, -3.14/$-\pi$/, -1.57/$-\dfrac\pi2$/, 0/$0$/0, 1.57/$\dfrac\pi2$/, 3.14/$\pi$/, 4.71/$\dfrac{3\pi}2$/, 6.28/$2\pi$/-.1} {
\ifthenelse{\equal{\rx}{}}{\def\rx{0}}{}
\draw[very thick, red] (\x,-.4ex) -- node [xshift=\rx cm, yshift=-1em, fill=white, inner sep=.5pt, opacity=.65, text opacity=1] {\scriptsize\label} (\x,.4ex) ;
}
\draw[very thick, green] (\xC, \yC) -- (\xC, \yC) ;
\draw[very thick, red] (\xC+1, \yC) -- (\xC+1, \yC) ;
\pause
\foreach [count=\i from 2, evaluate=\x as \y using sin(\x/3.1415*180), evaluate=\x as \cosx using cos(\x/3.1415*180) ] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, red] (0,0) -- (\x,0) ;
\draw<\i-64>[ultra thick, green!80!black, opacity=.6] (\x,0) -- (\x,\y) ;
\draw<\i>[very thick, red, -stealth] (\xC, \yC) ++(0:1) arc (0:\x/3.1415*180:1) ;
\draw<\i>[ultra thick, green!80!black, opacity=.6] (\xC, \yC) -- (\xC, \yC+\y) ;
\draw<\i>[thin, dotted, gray] (\xC, \yC+\y) -- (\xC+\cosx, \yC+\y) ;
\xdef\lastcount{\i} ;
\node<\i> at (3,4) {\color{red}\lastcount} ;
} ;
\pgfmathparse{\lastcount+1}
\let\lastcount\pgfmathresult
\uncover<\lastcount->{
\draw[very thick] (\xC, \yC) circle (1cm) ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ; }
\foreach [count=\i from \lastcount, evaluate=\x as \y using sin(-\x/3.1415*180), evaluate=\x as \cosx using cos(-\x/3.1415*180) ] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, blue] (0,0) -- (-\x,0) ;
\draw<\i-64>[ultra thick, green!80!black, opacity=.6] (-\x,0) -- (-\x,\y) ;
\draw<\i>[very thick, blue, -stealth] (\xC, \yC) ++(0:1) arc (0:-1*\x/3.1415*180:1) ;
\draw<\i>[ultra thick, green!80!black] (\xC, \yC) -- (\xC, \yC+\y) ;
\draw<\i>[thin, dotted, gray] (\xC, \yC+\y) -- (\xC+\cosx, \yC+\y) ;
\xdef\lastcount{\i} ;
\node<\i> at (3,4) {\color{blue}\lastcount} ;
} ;
\pgfmathparse{\lastcount+1}
\let\second\pgfmathresult
\onslide<\second>{\node at (5,4) {\color{red}\lastcount} ;}
% \draw<\lastcount->[ultra thick, orange, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(\x/3.1415*180)}) ;
\draw<64>[ultra thick, orange, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(\x/3.1415*180)}) ; \end{tikzpicture} \end{center} \end{frame}
\section{La fonction cosinus}
\begin{frame}
Blah
\end{frame}
\end{document}
我还遇到一个奇怪的警告: 软件包 pgfplots 警告:以向后兼容模式运行(不合适的刻度标签;缺少功能)。请考虑将 \pgfplotsset{compat=1.16} 写入您的前言中。我检查了使用 \listfiles 命令创建的日志,如果我正确理解了其内容,我正在使用 TeXlive 2019 的 3.1.4 版本(安装在 Ubuntu 18.04 的主目录中)。
最后,我的代码出现了不透明度问题(第 54 和 56 行,垂直绿条)。
在此先感谢您的帮助!
答案1
这不是无限循环。有很多事情可以改进(trig format=rad
等等),但也许这是进一步讨论的基础。我补充说
\pgfplotsset{compat=1.16}
更重要的是\let\lastcount
用 替换了东西\edef...
。
\documentclass[12pt,a4paper]{beamer}
\usetheme{Warsaw}
\usecolortheme{crane}
\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{ifthen,calc}
\hypersetup{pdfencoding=utf8}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc,arrows,arrows.meta}
\begin{document}
\begin{frame}[plain]
\vspace*{3cm}
\begin{center}
\begin{tikzpicture}[overlay]
\def\xm{-6.4}
\def\xM{6.4}
\def\ym{-2}
\def\yM{2}
\def\xC{-3.14}
\def\yC{4}
\def\lastcount{0}
\def\first{0}
\def\second{0}
\draw[very thick] (\xC, \yC) circle [radius=1cm] ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ;
\draw[color=gray] (\xm,\ym) grid (\xM,\yM);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,\ym) grid (\xM,\yM);
\draw [-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw [very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw [very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\foreach \x/\label/\rx in {-6.28/$-2\pi$/.15, -4.71/$-\dfrac{3\pi}2$/, -3.14/$-\pi$/, -1.57/$-\dfrac\pi2$/, 0/$0$/0, 1.57/$\dfrac\pi2$/, 3.14/$\pi$/, 4.71/$\dfrac{3\pi}2$/, 6.28/$2\pi$/-.1} {
\ifthenelse{\equal{\rx}{}}{\def\rx{0}}{}
\draw[very thick, red] (\x,-.4ex) -- node [xshift=\rx cm, yshift=-1em, fill=white, inner sep=.5pt, opacity=.65, text opacity=1] {\scriptsize\label} (\x,.4ex) ;
}
\draw[very thick, green] (\xC, \yC) -- (\xC, \yC) ;
\draw[very thick, red] (\xC+1, \yC) -- (\xC+1, \yC) ;
\pause
\foreach [count=\i from 2, evaluate=\x as \y using sin(\x/3.1415*180), evaluate=\x as \cosx using cos(\x/3.1415*180) ] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, red] (0,0) -- (\x,0) ;
\draw<\i-64>[ultra thick, green!80!black, opacity=.6] (\x,0) -- (\x,\y) ;
\draw<\i>[very thick, red, -stealth] (\xC, \yC) ++(0:1) arc (0:\x/3.1415*180:1) ;
\draw<\i>[ultra thick, green!80!black, opacity=.6] (\xC, \yC) -- (\xC, \yC+\y) ;
\draw<\i>[thin, dotted, gray] (\xC, \yC+\y) -- (\xC+\cosx, \yC+\y) ;
\xdef\mylastcount{\i} ;
\node<\i> at (3,4) {\color{red}\mylastcount} ;
} ;
\edef\lastcount{\the\numexpr\mylastcount+1}
\uncover<\lastcount->{
\draw[very thick] (\xC, \yC) [radius=1cm] ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ; }
\foreach [count=\i from \lastcount, evaluate=\x as \y using sin(-\x/3.1415*180), evaluate=\x as \cosx using cos(-\x/3.1415*180) ] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, blue] (0,0) -- (-\x,0) ;
\draw<\i-64>[ultra thick, green!80!black, opacity=.6] (-\x,0) -- (-\x,\y) ;
\draw<\i>[very thick, blue, -stealth] (\xC, \yC) ++(0:1) arc (0:-1*\x/3.1415*180:1) ;
\draw<\i>[ultra thick, green!80!black] (\xC, \yC) -- (\xC, \yC+\y) ;
\draw<\i>[thin, dotted, gray] (\xC, \yC+\y) -- (\xC+\cosx, \yC+\y) ;
\xdef\mylastcount{\i} ;
\node<\i> at (3,4) {\color{blue}\lastcount} ;
} ;
\edef\second{\the\numexpr\mylastcount+1}
\onslide<\second>{\node at (5,4) {\color{red}\lastcount} ;}
% \draw<\lastcount->[ultra thick, orange, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(\x/3.1415*180)}) ;
\draw<64>[ultra thick, orange, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(\x/3.1415*180)}) ;
\end{tikzpicture}
\end{center}
\end{frame}
\section{La fonction cosinus}
\begin{frame}
Blah
\end{frame}
\end{document}
编辑:修正了一个错字。
答案2
我终于(虽然有些困难)找到了适合我需求的东西。我在这里发布相关代码,只是为了分享,也希望有人有足够的时间向我展示如何改进代码。对我来说,处理涉及浮点数比较的测试以及与不透明度结合的箭头提示尤其困难(我最终放弃了,因为范围 + 透明度组在使用记忆图片和叠加选项的 Beamer 框架中效果不佳……并且当我移动箭头提示时,TikZ 的行为很奇怪,在曲线的末端,在文档的末尾,例如第 369 行,例如使用缩短 >=-1.5mm 时)。提前致谢!
\documentclass[12pt,a4paper]{beamer}
\usetheme{Warsaw}
\usecolortheme{crane}
\usepackage[utf8]{luainputenc}
\usepackage[french]{babel}
\usepackage{ifthen,calc}
\hypersetup{pdfencoding=utf8}
\usepackage{amsmath, pgfplots, numprint}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc,arrows,arrows.meta}
\begin{document}
\section{La fonction sinus}
\begin{frame}
\vspace*{3cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay]
\def\xm{-6.4}
\def\xM{6.4}
\def\ym{-2}
\def\yM{2}
\def\xC{-3.14}
\def\yC{4}
\def\lastcount{0}
\draw[very thick] (\xC, \yC) circle (1cm) ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ;
\draw[color=gray] (\xm,\ym) grid (\xM,\yM);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,\ym) grid (\xM,\yM);
\draw[-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw[very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw[very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\foreach \x/\label/\rx in {-6.28/$-2\pi$/.15, -4.71/$-\dfrac{3\pi}2$/, -3.14/$-\pi$/, -1.57/$-\dfrac\pi2$/, 0/$0$/0, 1.57/$\dfrac\pi2$/, 3.14/$\pi$/, 4.71/$\dfrac{3\pi}2$/, 6.28/$2\pi$/-.1} {
\ifthenelse{\equal{\rx}{}}{\def\rx{0}}{}
\draw[very thick, red] (\x,-.4ex) -- node [xshift=\rx cm, yshift=-1em, fill=white, inner sep=.5pt, opacity=.65, text opacity=1] {\scriptsize\label} (\x,.4ex) ;
}
\draw[very thick, green] (\xC, \yC) -- (\xC, \yC) ;
\draw[very thick, red] (\xC+1, \yC) -- (\xC+1, \yC) ;
\pause
\foreach [count=\i from 2, evaluate=\x as \y using sin(deg(\x)), evaluate=\x as \cosx using cos(deg(\x)), evaluate=\x as \a using deg(\x)] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
% Les abscisses sur l'axe (Ox) du repère orthonormé où est tracée la fonction sinus :
\draw<\i-64>[very thick, red] (0,0) -- (\x,0) ;
% La valeur de sin(x) en ordonnée dans le repère orthonormé où est tracée la fonction sinus :
\draw<\i-64>[ultra thick, green!70!black, opacity=.6] (\x,0) -- (\x,\y) ;
% L'arc de cercle orienté de longueur x sur le cercle trigonométrique :
\draw<\i>[very thick, red, -stealth] (\xC, \yC) ++(0:1) arc (0:\a:1) ;
% La mesure x de cet arc de cercle orienté, affichée à proximité de la flèche orientant l'arc :
\draw<\i> [red] (\xC,\yC) ++ (\a:1.5) node[font=\tiny, inner sep=.5pt, fill=white, fill opacity=.5, text opacity=1] {$x=\numprint{\x}$} ;
% Le trait joignant le centre du cercle trigonométrique au point de ce cercle repéré par le réel x :
\draw<\i> [thin, gray] (\xC,\yC) -- ++ (\a:1) ;
% Le marquage (secteur angulaire coloré) de l'angle de mesure x :
\filldraw<\i> [red, opacity=.25] (\xC,\yC) -- (\xC+.5,\yC) arc (0:\a:.5) -- cycle ;
% La matérialisation de la grandeur sin(x) sur le repère orthonormé attaché au centre du cercle trigonométrique :
\draw<\i>[ultra thick, green!70!black, opacity=.6] (\xC, \yC) -- (\xC, \yC+\y) ;
% Le trait permettant de montrer que le point repéré sur le cercle trigonométrique par le réel x a pour ordonnée sin(x) :
\draw<\i>[thin, dashed, gray] (\xC, \yC+\y) -- (\xC+\cosx, \yC+\y) ;
% Des traits fins permettant de matérialiser le passage du repère attaché au cercle trigonométrique au repère où l'on trace la fonction sinus :
\draw<\i>[very thin, dashed, green!70!black] (\xC,\yC) -- (\x,0) ;
\draw<\i>[very thin, dashed, green!70!black] (\xC,\yC+\y) -- (\x,\y) ;
\xdef\lastcount{\i} ;
\node<\i>[text width=7cm] at (3,4) {Tracé de la fonction $\sin : x \longmapsto \sin x$\\ pour $x\in[0\,;2\pi]$} ;
} ;
\edef\lastcount{\the\numexpr\lastcount+1}
\uncover<\lastcount->{
\draw[very thick] (\xC, \yC) circle (1cm) ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ; }
\foreach [count=\i from \lastcount, evaluate=\x as \y using sin(-deg(\x)), evaluate=\x as \cosx using cos(-deg(\x)), evaluate=\x as \a using -deg(\x)] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, blue] (0,0) -- (-\x,0) ;
\draw<\i-64>[ultra thick, green!70!black, opacity=.6] (-\x,0) -- (-\x,\y) ;
\draw<\i>[very thick, blue, -stealth] (\xC, \yC) ++(0:1) arc (0:\a:1) ;
\draw<\i> [blue] (\xC,\yC) ++ (\a:1.5) node[font=\tiny, inner sep=.5pt, fill=white, fill opacity=.5, text opacity=1] {$x=\numprint{-\x}$} ;
\draw<\i> [thin, gray] (\xC,\yC) -- ++ (\a:1) ;
\filldraw<\i> [blue, opacity=.25] (\xC,\yC) -- (\xC+.5,\yC) arc (0:\a:.5) -- cycle ;
\draw<\i>[ultra thick, green!70!black, opacity=.6] (\xC, \yC) -- (\xC, \yC+\y) ;
\draw<\i>[thin, dashed, gray] (\xC, \yC+\y) -- (\xC+\cosx, \yC+\y) ;
\xdef\lastcount{\i} ;
\node<\i>[text width=7cm] at (3,4) {Tracé de la fonction $\sin : x \longmapsto \sin x$\\ pour $x\in[-2\pi\,;0]$} ;
} ;
\edef\lastcount{\the\numexpr\lastcount+1}
\draw<\lastcount-65>[ultra thick, orange, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(deg(\x))}) ;
\node<65>[text width=7cm] at (3,4) {Tracé de la fonction $\sin : x \longmapsto \sin x$\\ pour $x\in[-2\pi\,;2\pi]$} ;
\end{tikzpicture}
\end{center}
\end{frame}
\section{La fonction cosinus}
\begin{frame}
\vspace*{3cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay]
\def\xm{-6.4}
\def\xM{6.4}
\def\ym{-2}
\def\yM{2}
\def\xC{-3.14}
\def\yC{4}
\def\lastcount{0}
\draw[very thick] (\xC, \yC) circle (1cm) ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ;
\draw[color=gray] (\xm,\ym) grid (\xM,\yM);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,\ym) grid (\xM,\yM);
\draw[-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw[very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw[very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\foreach \x/\label/\rx in {-6.28/$-2\pi$/.15, -4.71/$-\dfrac{3\pi}2$/, -3.14/$-\pi$/, -1.57/$-\dfrac\pi2$/, 0/$0$/0, 1.57/$\dfrac\pi2$/, 3.14/$\pi$/, 4.71/$\dfrac{3\pi}2$/, 6.28/$2\pi$/-.1} {
\ifthenelse{\equal{\rx}{}}{\def\rx{0}}{}
\draw[very thick, red] (\x,-.4ex) -- node [xshift=\rx cm, yshift=-1em, fill=white, inner sep=.5pt, opacity=.65, text opacity=1] {\scriptsize\label} (\x,.4ex) ;
}
\draw<1>[ultra thick, green!70!black, opacity=.6] (\xC, \yC) -- (\xC+1, \yC) ;
\draw[very thick, red] (\xC+1, \yC) -- (\xC+1, \yC) ;
\draw<1-64>[ultra thick, green!70!black, opacity=.6] (0, 0) -- (0, 1) ;
\pause
\foreach [count=\i from 2, evaluate=\x as \y using cos(deg(\x)), evaluate=\x as \sinx using sin(deg(\x)), evaluate=\x as \a using deg(\x)] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, red] (0,0) -- (\x,0) ;
\draw<\i-64>[ultra thick, green!70!black, opacity=.6] (\x,0) -- (\x,\y) ;
\draw<\i>[very thick, red, -stealth] (\xC, \yC) ++(0:1) arc (0:\a:1) ;
\draw<\i>[red] (\xC,\yC) ++ (\a:1.5) node[font=\tiny, inner sep=.5pt, fill=white, fill opacity=.5, text opacity=1] {$x=\numprint{\x}$} ;
\draw<\i>[thin, gray] (\xC,\yC) -- ++ (\a:1) ;
\filldraw<\i> [red, opacity=.25] (\xC,\yC) -- (\xC+.5,\yC) arc (0:\a:.5) -- cycle ;
\draw<\i>[ultra thick, green!70!black, opacity=.6] (\xC, \yC) -- (\xC+\y, \yC) ;
\draw<\i>[thin, dashed, gray] (\xC+\y, \yC) -- (\xC+\y, \yC+\sinx) ;
% Des traits fins permettant de matérialiser le passage du repère attaché au cercle trigonométrique au repère où l'on trace la fonction sinus :
\draw<\i>[very thin, dashed, green!70!black] (\xC,\yC) to[bend right] (\x,0) ;
\draw<\i>[very thin, dashed, green!70!black] (\xC+\y,\yC) to[bend right] (\x,\y) ;
\xdef\lastcount{\i} ;
\node<\i>[text width=7cm] at (3,4) {Tracé de la fonction $\cos : x \longmapsto \cos x$\\ pour $x\in[0\,;2\pi]$} ;
} ;
\edef\lastcount{\the\numexpr\lastcount+1}
\uncover<\lastcount->{
\draw[very thick] (\xC, \yC) circle (1cm) ;
\draw[thick, -Stealth] (\xC-1.5, \yC) -- (\xC+1.5, \yC) ;
\draw[thick, -Stealth] (\xC, \yC-1.5) -- (\xC, \yC+1.5) ; }
\foreach [count=\i from \lastcount, evaluate=\x as \y using cos(-deg(\x)), evaluate=\x as \sinx using sin(-deg(\x)), evaluate=\x as \a using -deg(\x)] \x in {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0,6.2} {
\draw<\i-64>[very thick, blue] (0,0) -- (-\x,0) ;
\draw<\i-64>[ultra thick, green!70!black, opacity=.6] (-\x,0) -- (-\x,\y) ;
\draw<\i>[very thick, blue, -stealth] (\xC, \yC) ++(0:1) arc (0:\a:1) ;
\draw<\i> [blue] (\xC,\yC) ++ (\a:1.5) node[font=\tiny, inner sep=.5pt, fill=white, fill opacity=.5, text opacity=1] {$x=\numprint{-\x}$} ;
\draw<\i> [thin, gray] (\xC,\yC) -- ++ (\a:1) ;
\filldraw<\i> [blue, opacity=.25] (\xC,\yC) -- (\xC+.5,\yC) arc (0:\a:.5) -- cycle ;
\draw<\i>[ultra thick, green!70!black, opacity=.6] (\xC, \yC) -- (\xC+\y, \yC) ;
\draw<\i>[thin, dashed, gray] (\xC+\y, \yC) -- (\xC+\y, \yC+\sinx) ;
\xdef\lastcount{\i} ;
\node<\i>[text width=7cm] at (3,4) {Tracé de la fonction $\cos : x \longmapsto \cos x$\\ pour $x\in[-2\pi\,;0]$} ;
} ;
\edef\lastcount{\the\numexpr\lastcount+1}
\draw<\lastcount-65>[ultra thick, orange, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {cos(deg(\x))}) ;
\node<65>[text width=7cm] at (3,4) {Tracé de la fonction $\cos : x \longmapsto \cos x$\\ pour $x\in[-2\pi\,;2\pi]$} ;
\end{tikzpicture}
\end{center}
\end{frame}
\section{Comparaison des courbes représentatives des fonction sinus et cosinus}
\begin{frame}
\vspace*{2cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay]
\def\xm{-6.4}
\def\xM{6.4}
\def\ym{-2}
\def\yM{2}
\pgfkeys{/pgf/number format/use comma} % Pour que les affichages des nombres générés par PGF/TikZ se fassent avec une virgule et non un point !
\draw[color=gray] (\xm,\ym) grid (\xM,\yM);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,\ym) grid (\xM,\yM);
\draw[-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw[very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw[very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\draw[ultra thick, orange!50!red, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(deg(\x))}) ;
\node[orange!50!red] at (4.7,-1.3) {$y=\sin x$} ;
\draw[ultra thick, orange!75!yellow, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {cos(deg(\x))}) ;
\node[orange!75!yellow] at (5.6,1.2) {$y=\cos x$} ;
\node<2->[text width=10cm, align=center] at (0,4) {$2\pi$--périodicité de la fonction \textbf{sinus} :\\ pour tout $x\in\mathbb{R}$, on a $\sin(x+2\pi)=\sin x$} ;
% \pgfmathdeclarefunction{ypos}{1}{\pgfmathparse{(sin(deg(#1))<0) ? -.2 : .2}} % Ne fonctionne pas
\foreach [count=\i from 3, evaluate=\x as \cosx using cos(deg(\x)), evaluate=\x as \sinx using sin(deg(\x)) ] \x in {-6,-5.8,...,0} {
\draw<\i>[thick, opacity=.8, blue, {Circle[length=2pt]}-{Stealth}, shorten <=-1pt ] (\x, \sinx) -- node[inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $2\pi$} (\x+6.28, \sinx) ;
\node<\i>[circle, fill=blue, inner sep=1pt] (f) at (0,\sinx) {} ;
% Nécessaire pour des arrondis corrects, autrement -4,8 donne -4,79999
\def\X{\pgfmathparse{\x}\pgfmathprintnumber[precision=1]{\pgfmathresult}}
% Pas moyen de faire autrement pour comparer des nombres décimaux. S'il y a plus simple, je n'ai pas trouvé !
\ifnum\dimexpr\sinx pt\relax>0pt\relax
\draw<\i>[thin, blue, dashed] (\x, 0) node[yshift=-.2cm, inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $x=\X$} -- (\x, \sinx) ;
\draw<\i>[thin, blue, dashed] (\x+6.28, 0) node[yshift=-.2cm, inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $x+2\pi$} -- (\x+6.28, \sinx) ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f1) at (-.75, 2.5) {\scriptsize $\sin x$} ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f2) at (.75, 2.5) {\scriptsize $\sin(x+2\pi)$} ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f1.south) -- (f.north west) ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f2.south) -- (f.north east) ;
\else
\draw<\i>[thin, blue, dashed] (\x, 0) node[yshift=.2cm, inner sep=.05pt, fill=white, fill opacity=.8] {\scriptsize $x=\X$} -- (\x, \sinx) ;
\draw<\i>[thin, blue, dashed] (\x+6.28, 0) node[yshift=.2cm, inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $x+2\pi$} -- (\x+6.28, \sinx) ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f1) at (-.75, -2.5) {\scriptsize $\sin x$} ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f2) at (.75, -2.5) {\scriptsize $\sin (x+2\pi)$} ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f1.north) -- (f.south west) ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f2.north) -- (f.south east) ;
\fi
}
\end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}
\vspace*{2cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay]
\def\xm{-6.4}
\def\xM{6.4}
\def\ym{-2}
\def\yM{2}
\pgfkeys{/pgf/number format/use comma} % Pour que les affichages des nombres générés par PGF/TikZ se fassent avec une virgule et non un point !
\draw[color=gray] (\xm,\ym) grid (\xM,\yM);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,\ym) grid (\xM,\yM);
\draw[-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw[very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw[very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\draw[ultra thick, orange!50!red, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {sin(deg(\x))}) ;
\node[orange!50!red] at (4.7,-1.3) {$y=\sin x$} ;
\draw[ultra thick, orange!75!yellow, opacity=.8, domain=-6.28:6.28,smooth,samples=200] plot (\x, {cos(deg(\x))}) ;
\node[orange!75!yellow] at (5.6,1.2) {$y=\cos x$} ;
\node<2->[text width=10cm, align=center] at (0,4) {$2\pi$--périodicité de la fonction \textbf{cosinus} :\\ pour tout $x\in\mathbb{R}$, on a $\cos(x+2\pi)=\cos x$} ;
% \pgfmathdeclarefunction{ypos}{1}{\pgfmathparse{(sin(deg(#1))<0) ? -.2 : .2}} % Ne fonctionne pas
\foreach [count=\i from 3, evaluate=\x as \cosx using cos(deg(\x)), evaluate=\x as \sinx using sin(deg(\x)) ] \x in {-6,-5.8,...,0} {
\draw<\i>[thick, opacity=.8, blue, {Circle[length=2pt]}-{Stealth}, shorten <=-1pt ] (\x, \cosx) -- node[inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $2\pi$} (\x+6.28, \cosx) ;
\node<\i>[circle, fill=blue, inner sep=1pt] (f) at (0,\cosx) {} ;
% Nécessaire pour des arrondis corrects, autrement -4,8 donne -4,79999
\def\X{\pgfmathparse{\x}\pgfmathprintnumber[precision=1]{\pgfmathresult}}
% Pas moyen de faire autrement pour comparer des nombres décimaux. S'il y a plus simple, je n'ai pas trouvé !
\ifnum\dimexpr\cosx pt\relax>0pt\relax
\draw<\i>[thin, blue, dashed] (\x, 0) node[yshift=-.2cm, inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $x=\X$} -- (\x, \cosx) ;
\draw<\i>[thin, blue, dashed] (\x+6.28, 0) node[yshift=-.2cm, inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $x+2\pi$} -- (\x+6.28, \cosx) ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f1) at (-.75, 2.5) {\scriptsize $\cos x$} ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f2) at (.75, 2.5) {\scriptsize $\cos(x+2\pi)$} ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f1.south) -- (f.north west) ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f2.south) -- (f.north east) ;
\else
\draw<\i>[thin, blue, dashed] (\x, 0) node[yshift=.2cm, inner sep=.05pt, fill=white, fill opacity=.8] {\scriptsize $x=\X$} -- (\x, \cosx) ;
\draw<\i>[thin, blue, dashed] (\x+6.28, 0) node[yshift=.2cm, inner sep=1pt, fill=white, fill opacity=.8] {\scriptsize $x+2\pi$} -- (\x+6.28, \cosx) ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f1) at (-.75, -2.5) {\scriptsize $\cos x$} ;
\node<\i>[blue, inner sep=1pt, fill=white, fill opacity=.8] (f2) at (.75, -2.5) {\scriptsize $\cos (x+2\pi)$} ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f1.north) -- (f.south west) ;
\draw<\i>[-stealth, blue, shorten >=2pt] (f2.north) -- (f.south east) ;
\fi
}
\end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}
\vspace*{2cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay, xscale=.5, yscale=2]
\def\xm{-12.8}
\def\xM{12.8}
\def\ym{-1.25}
\def\yM{1.5}
\pgfkeys{/pgf/number format/use comma} % Pour que les affichages des nombres générés par PGF/TikZ se fassent avec une virgule et non un point !
\draw[color=gray] (\xm,-1) grid (\xM,1);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,-1) grid (\xM,1);
\draw[-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw[very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw[very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\draw[ultra thick, orange!75!yellow, opacity=.2, domain=\xm:\xM,smooth,samples=400] plot (\x, {cos(deg(\x))}) ;
\node[orange!75!yellow, opacity=.2] at (5.6,1.2) {$y=\cos x$} ;
\node[text width=10cm, align=center] at (0,2) {$2\pi$--périodicité de la fonction \textbf{sinus} :\\
reproduction de motifs de longueur $2\pi$\\
\emph{\scriptsize(\textbf{attention : }le repère n'est plus orthonormé ici !)}} ;
\foreach[count=\k from 2, evaluate=\i as \m using -12.56+\i*6.28, evaluate=\i as \M using -12.56+(\i+1)*6.28] \i in {0,...,3} {
\draw<\k-5>[line width=1.5mm, blue!50!white, domain=\m:\M, smooth, samples=200, {|}-{|}, shorten <=0mm, shorten >=0mm] plot (\x, {sin(deg(\x))}) ;
}
\foreach[count=\k from 6, evaluate=\i as \m using -10.996+\i*6.28, evaluate=\i as \M using -10.996+(\i+1)*6.28] \i in {0,...,3} {
\draw<\k-9>[line width=1.5mm, green!50!black, domain=\m:\M, smooth, samples=200] plot (\x, {sin(deg(\x))}) ;
\draw<\k-9>[line width=1.5mm, green!50!black, ] (\m+.151, .8) -- (\m+.151, 1.16) ;
\draw<\k-9>[line width=1.5mm, green!50!black, ] (\M-.151, .8) -- (\M-.151, 1.16) ;
}
\foreach[count=\k from 10, evaluate=\i as \m using -12+\i*6.28, evaluate=\i as \M using -12+(\i+1)*6.28] \i in {0,...,3} {
\draw<\k-13>[line width=1.5mm, orange!50!pink, domain=\m:\M, smooth, samples=200, {|}-{|}, shorten <=0mm, shorten >=0mm] plot (\x, {sin(deg(\x))}) ;
}
\draw[ultra thick, orange!50!red, opacity=.8, domain=\xm:\xM,smooth,samples=400] plot (\x, {sin(deg(\x))}) ;
\node[orange!50!red] at (4.7,-1.3) {$y=\sin x$} ;
\end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}
\vspace*{2cm}
\begin{center}
\begin{tikzpicture}[remember picture,overlay, xscale=.5, yscale=2]
\def\xm{-12.8}
\def\xM{12.8}
\def\ym{-1.25}
\def\yM{1.5}
\pgfkeys{/pgf/number format/use comma} % Pour que les affichages des nombres générés par PGF/TikZ se fassent avec une virgule et non un point !
\draw[color=gray] (\xm,-1) grid (\xM,1);
\draw[help lines, step=.2, color=gray, opacity=.5] (\xm,-1) grid (\xM,1);
\draw[-Stealth, thick] (\xm,0)--(\xM,0) node[xshift=-.5ex, yshift=1.3ex, circle, fill=white, inner sep=.5pt] {$x$} ;
\draw[-Stealth, thick] (0,\ym)--(0,\yM) node[left, circle, fill=white, inner sep=.1pt]{$y$};
\draw[very thick] (1,-.4ex) -- node [yshift=-.9em, circle, fill=white, inner sep=.1pt] {$1$} (1,.4ex) ;
\draw[very thick] (-.4ex,1) -- node [shift={(-1.2ex,1.2ex)}, circle, fill=white, inner sep=.1pt] {$1$} (.4ex,1) ; % =-1cm and -1cm
\draw[ultra thick, orange!50!red, opacity=.2, domain=\xm:\xM,smooth,samples=400] plot (\x, {sin(deg(\x))}) ;
\node[orange!50!red, opacity=.2] at (4.7,-1.3) {$y=\sin x$} ;
\node[text width=10cm, align=center] at (0,2) {$2\pi$--périodicité de la fonction \textbf{cosinus} :\\
reproduction de motifs de longueur $2\pi$\\
\emph{\scriptsize(\textbf{attention : }le repère n'est plus orthonormé ici !)}} ;
\foreach[count=\k from 2, evaluate=\i as \m using -12.56+\i*6.28, evaluate=\i as \M using -12.56+(\i+1)*6.28] \i in {0,...,3} {
\draw<\k-5>[line width=1.5mm, blue!50!white, domain=\m:\M, smooth, samples=200, shorten <=0mm, shorten >=0mm] plot (\x, {cos(deg(\x))}) ;
\draw<\k-5>[line width=1.5mm, blue!50!white] (\m+.151, .8) -- (\m+.151, 1.16) ;
\draw<\k-5>[line width=1.5mm, blue!50!white] (\M-.151, .8) -- (\M-.151, 1.16) ;
}
\foreach[count=\k from 6, evaluate=\i as \m using -10.996+\i*6.28, evaluate=\i as \M using -10.996+(\i+1)*6.28] \i in {0,...,3} {
\draw<\k-9>[line width=1.5mm, green!50!black, domain=\m:\M, smooth, samples=200, {|}-{|}] plot (\x, {cos(deg(\x))}) ;
}
\foreach[count=\k from 10, evaluate=\i as \m using -12+\i*6.28, evaluate=\i as \M using -12+(\i+1)*6.28] \i in {0,...,3} {
\draw<\k-13>[line width=1.5mm, orange!50!red, domain=\m:\M, smooth, samples=200, {|}-{|}, shorten <=0mm, shorten >=0mm] plot (\x, {cos(deg(\x))}) ;
}
\draw[ultra thick, orange!75!yellow, opacity=1, domain=\xm:\xM,smooth,samples=400] plot (\x, {cos(deg(\x))}) ;
\node[orange!75!yellow, opacity=1] at (5.6,1.2) {$y=\cos x$} ;
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}