Nothing
# +++++++++++++++++++++++++++++++++++++++++++++++ application: RigidBodyNXFApp.R
# example of a nonstiff system is the system of equations describing
# the motion of a rigid body without external forces.
importFromExamples("RigidBody.R")
# run the application
RigidBodyNXFApp <- function(verbose = FALSE) {
# load the R class that sets up the solver for this application
y1 <- 0 # initial y1 value
y2 <- 1 # initial y2 value
y3 <- 1 # initial y3 value
dt <- 0.01 # delta time for step
body <- RigidBodyNXF(y1, y2, y3)
solver <- Euler(body)
solver <- setStepSize(solver, dt)
rowVector <- vector("list")
i <- 1
# stop loop when the body hits the ground
while (getState(body)[4] <= 12) {
rowVector[[i]] <- list(t = getState(body)[4],
y1 = getState(body)[1],
y2 = getState(body)[2],
y3 = getState(body)[3])
solver <- step(solver)
body <- getODE(solver)
i <- i + 1
}
DT <- data.table::rbindlist(rowVector)
return(DT)
}
# get the data table from the app
solution <- RigidBodyNXFApp()
plot(solution)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.