Update twodfunction.R