File:CosinusSinus.gif

Uploaded by Auswahlaxiom
Upload date 2017-03-28T15:34:10Z
MIME type image/gif
Dimensions 740 × 172 px
File size 212.1 KB

Summary

Description
English: Transition from cosine to sine and vice versa
Deutsch: Übergang von Kosinus zu Sinus und umgekehrt
Date
Source Own work
Author Auswahlaxiom
GIF development
InfoField
 This GIF graphic was created with Asymptote.
Source code
InfoField

Asymptote code

import graph;

unitsize(1.5cm);

real dt = 0.04;
int n = 0;

void ship() {
	write(n);
	shipout(outprefix() + format("-%04d", n));
	++n;
}

pen fix = rgb(0.3, 0, 0.7)+linewidth(2);
pen trans = rgb(0.7, 0, 0.3)+linewidth(2);

string pilabel(real x) {
	int n = floor(2*x/pi+0.5);
	if(n % 2 == 0) {
		return "$"+(n<0 ? "-" : "")+(abs(n)!=2 ? format("%d", abs(n)#2) : "")+"\pi$";
	} else {
		return "$"+(n<0 ? "-" : "")+"\frac{"+(abs(n)!=1 ? format("%d", abs(n)) : "")+"\pi}2$";
	}
}

xaxis(Label("$x$", EndPoint, 2*E), -2*pi-0.4, 2*pi+0.4, LeftTicks(pilabel, n=3, Step=pi/2, NoZero), EndArrow);
yaxis(Label("$y$", EndPoint, 2*N), -1.4, 1.4, LeftTicks(n=2, Step=1, NoZero), EndArrow);

path cl = box(truepoint(SW), truepoint(NE));
draw(cl, invisible);

save();
draw(graph(cos, -2*pi, 2*pi), fix);
clip(cl);
for(real t = 0; t+dt/2 < 1; t += dt) {
	ship();
}
restore();

for(real t = 0; t+dt/2 < 1; t += dt) {
	save();
	draw(graph(new real(real x) { return cos(x - t*pi/2); }, -2*pi, 2*pi), rgb(0.3+0.4*t, 0, 0.7-0.4*t)+linewidth(2));
	clip(cl);
	ship();
	restore();
}

save();
draw(graph(sin, -2*pi, 2*pi), trans);
clip(cl);
for(real t = 0; t+dt/2 < 1; t += dt) {
	ship();
}
restore();

for(real t = 0; t+dt/2 < 1; t += dt) {
	save();
	draw(graph(new real(real x) { return sin(x + t*pi/2); }, -2*pi, 2*pi), rgb(0.7-0.4*t, 0, 0.3+0.4*t)+linewidth(2));
	clip(cl);
	ship();
	restore();
}

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

28 March 2017

image/gif

5f11b43cf8aaa415c175b1a148f1e057a8dab29e

217,155 byte

4.000000000000002 second

172 pixel

740 pixel

Category:Animated GIF files Category:CC-BY-SA-4.0 Category:Cosine function Category:PNG created with Asymptote code Category:Self-published work Category:Sine function