Ficheiro:Trigonometry exercise 1.svg
Dimensões desta antevisão em PNG do ficheiro SVG: 540 × 540 píxeis Outras resoluções: 240 × 240 píxeis | 480 × 480 píxeis | 768 × 768 píxeis | 1 024 × 1 024 píxeis | 2 048 × 2 048 píxeis.
Ficheiro original (ficheiro SVG, de 540 × 540 píxeis, tamanho: 14 kB)
Descrição do ficheiro[editar | editar código-fonte]
Trigonometry exercise. Code written in R.
Function to plot the triangle:
trigonometry.triangle <- function(f, angle, side, unknown) { # draw an exercise triangle, # whose purpose if to solve it using function "f" # with known angle and side # ex: trigonometry.triangle("sin", "60", "2", "x") # is an exercise to find x using formula x = 2 sin(60) # # plan the triangle # B <- as.double(angle) * pi/180 if (f == "sin" || f == "cos") { a <- as.double(side) b <- a * sin(B) c <- a * cos(B) } else if (f == "cosec" || f == "cotan") { b <- as.double(side) a <- b / sin(B) c <- b / tan(B) } else if (f == "sec" || f == "tan") { c <- as.double(side) a <- c / cos(B) b <- c * tan(B) } # # define the triangle (A,B,C) # pt.x <- c(0, -c, 0, 0) pt.y <- c(0, 0, b, 0) max.bc <- max(b, c) x.lim <- c(-0.7, 0.7) * max.bc - c/2 y.lim <- c(-0.7, 0.7) * max.bc + b/2 # plot and add notations par(mar=c(0,0,0,0)) # reset margins plot(0, xlim=x.lim, ylim=y.lim, col="white") par(usr=c(x.lim, y.lim)) # plot triangle points(pt.x, pt.y, type="l", col="black") # plot angle theta <- seq(0, B, pi/180) points(-c + (a/4) * cos(theta), (a/4) * sin(theta), type="l", col="red") # display names of vertices text(max.bc * 0.1, 0, "A", col="black") text(-c - max.bc * 0.1, 0, "B", col="black") text(max.bc * 0.1, b, "C", col="black") text(-c + (a/3) * cos(B/2), (a/3) * sin(B/2), angle, col="black") # display known side if (f == "sin" || f == "cos") { text(-c/2 + 0.1 * max.bc, b/2 + 0.1 * max.bc, side, col="black") } else if (f == "cosec" || f == "cotan") { text(max.bc * 0.1, b/2, side, col="black") } else if (f == "sec" || f == "tan") { text(-c/2, - max.bc * 0.1, side, col="black") } # display unknown side if (f == "sec" || f == "cosec") { text(-c/2 + 0.1 * max.bc, b/2 + 0.1 * max.bc, unknown, col="black") } else if (f == "sin" || f == "tan") { text(max.bc * 0.1, b/2, unknown, col="black") } else if (f == "cos" || f == "cotan") { text(-c/2, - max.bc * 0.1, unknown, col="black") } }
Code to plot this triangle:
library(Cairo) CairoSVG("Trigonometry_exercise_1.svg") trigonometry.triangle("sin", 30, 15, "x") dev.off()
Licença:[editar | editar código-fonte]
Histórico do ficheiro
Clique uma data e hora para ver o ficheiro tal como ele se encontrava nessa altura.
Data e hora | Miniatura | Dimensões | Utilizador | Comentário | |
---|---|---|---|---|---|
atual | 13h08min de 14 de agosto de 2008 | 540 × 540 (14 kB) | Albmont (discussão | contribs) | Trigonometry exercise. Code written in R. Function to plot the triangle: <pre> trigonometry.triangle <- function(f, angle, side, unknown) { # draw an exercise triangle, # whose purpose if to solve it using function "f" # with known angle and side |
Não pode substituir este ficheiro.
Utilização local do ficheiro
A seguinte página usa este ficheiro: