Skip to content

Instantly share code, notes, and snippets.

Avatar

john verzani jverzani

View GitHub Profile
@jverzani
jverzani / Rts.jl
Last active Apr 17, 2018
modify Roots to work with Unitful
View Rts.jl
## new framework for Roots
module Rts
using Compat
if VERSION < v"0.7.0"
using Missings
end
using ForwardDiff
@jverzani
jverzani / amvw.jl
Last active Mar 7, 2017
Julia implementation of AMVW algorithm
View amvw.jl
module AMVW
## Julia implementation of
## Fast and backward stable computation of roots of polynomials
## https://lirias.kuleuven.be/bitstream/123456789/461961/1/TW654.pdf
## Derived from fortran code https://people.cs.kuleuven.be/~raf.vandebril/homepage/software/companion_qr.php?menu=5
## License is unclear, but hopefully can be MIT licensed
## TODO
## handle case on non convergence
@jverzani
jverzani / gist:7207719
Created Oct 29, 2013
plot_interfaces.jl updated for mplot, oplot
View gist:7207719
## Various possible plot interfaces
## Plot interfaces for functions
## plot(x, [y], args..., kwargs...) lineplot
## plot(x::Tuple{Vector}, args...; kwargs) scatter plot
## plot(f, a::Real, b::Real, args...; kwargs) function plot using adaptive point, a, b length two atleast
## plot(fs::Vector{Function}, a::Real, b::Real, args...; kwargs) function plot, overlay
## plot(fs::Array{Function, 2}, a::Real, b::Real, args...; kwargs...) table of plots
@jverzani
jverzani / factor-editor.R
Last active Dec 20, 2015
Mock up of factor editor for gdf
View factor-editor.R
##' I want
##' * relabel a factor
##' * collapse one or more factors
##' * append a level to a factor
##' * Select a factor to be the reference
##' * reorder factors (and make ordered along the way)
##'
##'
library(gWidgets2)
@jverzani
jverzani / D.jl
Last active Dec 11, 2015
Julia functions for MTH 229. These functions are used to illustrate some basic algorithms used for numerical approximations to calculus.
View D.jl
module ADiff
## Code to take automatic derivative modeled after
## http://www.davidson.edu/math/neidinger/SIAMRev74362.pdf Numeric
## derivatives via finite differences have errors due to the
## mathematical approximation and the floating point approximation,
## that latter can be large as most compuations end with a difference
## of similar-sized values. Automatic derivatives avoid this, by
## adding information to each step of a function evaluation to also
## evalute the derivative. Errors are due to floating point
@jverzani
jverzani / Comments.md
Created Nov 3, 2012
Some comparisons using shiny and gWidgetsWWW2
View Comments.md

RStudio developers are really hard working. Somehow in their spare time they have worked on their shiny package for making interactive web pages. This gist compares writing a shiny web app to writing a similar app using gWidgetsWWW2.rapache. We only look here at the code, not the deployment. In general, deploying a shiny app widely seems best suited for RStudio's service, currently in beta, though clearly a local shiny app is also quite useful. Deploying an app under gWidgetsWWW2.rapache is fairly easy -- though not very widely tested.

We follow the tkdensity.R GUI from the tcltk package for comparison. This is a standard example with some controls and a resulting graphic. It is right up shiny's alley. We compare to the manipulate commands which mimic RStudio's manipulate pacakge and to straight gWidgetss:

There are 4 files:

  • a file showing how to do this with manipulate (this is an example from the gWidgetsWWW2.rapache package)
  • a file showing gWidgetsWWW2.rapache style (both have a w
@jverzani
jverzani / singleton
Created Mar 1, 2012
example of singleton pattern
View singleton
## Singleton pattern
Singleton <- setRefClass("Singleton",
fields=list(
Class="ANY",
instance="ANY"
),
methods=list(
initialize=function(...) {
"Override this by defining Class"
@jverzani
jverzani / simex.R
Created Feb 17, 2012
Simluation code for manipulate
View simex.R
library(manipulate)
svalue <- identity
runSim <- function(nSamples, sizeSample, thePop, theStat, plotSamps, plotDist, plotPop) {
m <- svalue(nSamples)
n <- svalue(sizeSample)
pop <- svalue(thePop)
stat <- svalue(theStat)
You can’t perform that action at this time.