Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
taylorsen7
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
# Exemplo de polinômio de Taylor de sen(x). jcfatorial<-function(n){ #jcfatorial é o nome que escolhi para a função que calcula o fatorial de número natural. if (n==0){p=1} else {p=n*jcfatorial(n-1)} p} taylorsen7<-function(s){ # Polinômio da Taylor de grau 7, em a=0, para sen(x). s-s^3/jcfatorial(3)+s^5/jcfatorial(5)-s^7/jcfatorial(7) } # Testando a função que construímos. curve(taylorsen7,-4,4,col="blue",ylim=c(-1,1),ylab="") legend("topleft", legend="taylorsen7(x)", lty=1, col="blue", lwd=1, bty="n") par(new=TRUE) curve(sin,-4,4,col="red",ylab="") legend(x=-4.3,y=0.95, legend="sen(x)", lty=1, col="red", lwd=1, bty="n")
[
+
]
Show input
Absolute running time: 0.67 sec, cpu time: 0.72 sec, memory peak: 44 Mb, absolute service time: 0,88 sec
edit mode
|
history
|
discussion