Package FindAllRoots

Similar documents
Package rgabriel. February 20, 2015

Package comparec. R topics documented: February 19, Type Package

Package CPE. R topics documented: February 19, 2015

Package MultisiteMediation

Package BayesNI. February 19, 2015

Package LIStest. February 19, 2015

Package depth.plot. December 20, 2015

Package SimSCRPiecewise

Package invgamma. May 7, 2017

Package ltsbase. R topics documented: February 20, 2015

Package severity. February 20, 2015

Package TSF. July 15, 2017

Package EnergyOnlineCPM

Package darts. February 19, 2015

Package scio. February 20, 2015

Package spcov. R topics documented: February 20, 2015

Package lsei. October 23, 2017

Package SCEPtERbinary

Package gtheory. October 30, 2016

Package CRAC. February 19, 2015

Package unbalhaar. February 20, 2015

Package RootsExtremaInflections

Package locfdr. July 15, Index 5

Package BNN. February 2, 2018

Package ShrinkCovMat

Package denseflmm. R topics documented: March 17, 2017

Package IsingFit. September 7, 2016

Package alabama. March 6, 2015

Package IUPS. February 19, 2015

Package CompQuadForm

Package milineage. October 20, 2017

Package abundant. January 1, 2017

Package covtest. R topics documented:

Package PoisNonNor. R topics documented: March 10, Type Package

Package survidinri. February 20, 2015

Package SEMModComp. R topics documented: February 19, Type Package Title Model Comparisons for SEM Version 1.0 Date Author Roy Levy

Package RZigZag. April 30, 2018

Package flora. R topics documented: August 29, Type Package. Title flora: taxonomical information on flowering species that occur in Brazil

Package pssm. March 1, 2017

Package semgof. February 20, 2015

Package NORMT3. February 19, 2015

Package RI2by2. October 21, 2016

Package elhmc. R topics documented: July 4, Type Package

Package Tcomp. June 6, 2018

Package magma. February 15, 2013

Package nsga2r. February 20, 2015

Package eel. September 1, 2015

Package Grace. R topics documented: April 9, Type Package

Package ICGOR. January 13, 2017

Package noncompliance

Package crossreg. February 19, 2015

Package emplik2. August 18, 2018

Package pearson7. June 22, 2016

Package mar. R topics documented: February 20, Title Multivariate AutoRegressive analysis Version Author S. M. Barbosa

Package Blendstat. February 21, 2018

Package OGI. December 20, 2017

Package WaveletArima

Package DTK. February 15, Type Package

Package emg. R topics documented: May 17, 2018

Package neat. February 23, 2018

Package gsarima. February 20, 2015

Package ensemblepp. R topics documented: September 20, Title Ensemble Postprocessing Data Sets. Version

Package mlmmm. February 20, 2015

Package ChIPtest. July 20, 2016

Package scpdsi. November 18, 2018

Package MBI. February 19, 2015

Package clogitboost. R topics documented: December 21, 2015

Package metafuse. October 17, 2016

Package rnmf. February 20, 2015

Package fwsim. October 5, 2018

Package OrdNor. February 28, 2019

Package bivariate. December 10, 2018

Package covsep. May 6, 2018

Package SK. May 16, 2018

Package FDRreg. August 29, 2016

Package basad. November 20, 2017

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression

Package MiRKATS. May 30, 2016

Package noise. July 29, 2016

Package ForecastCombinations

Package lomb. February 20, 2015

Package intrees. March 12, 2018

Package dhga. September 6, 2016

Package CMC. R topics documented: February 19, 2015

Package MultiRNG. January 10, 2018

Package MPkn. May 7, 2018

Package geigen. August 22, 2017

Package bigtime. November 9, 2017

Package goftest. R topics documented: April 3, Type Package

Package GORCure. January 13, 2017

Package leiv. R topics documented: February 20, Version Type Package

Package SimplicialCubature

Package NlinTS. September 10, 2018

Package flexcwm. R topics documented: July 11, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.0.

Package RTransferEntropy

Package HIMA. November 8, 2017

Package sscor. January 28, 2016

Package R1magic. April 9, 2013

Package dhsic. R topics documented: July 27, 2017

Package separationplot

Transcription:

Type Package Package FindAllRoots February 19, 2015 Title Find all root(s) of the equation and Find root(s) of the equation by dichotomy Version 1.0 Date 2012-07-13 Author Bingpei Wu & Jiajun He & Sijie Chen & Yangyang Liu Maintainer Bingpei Wu<jianpeizhon@126.com> Find all root(s) of the equation,including complex roots;find root(s) of the equation by dichotomy.besides,in dichotomy, more than one interval can be given at a time. License GPL (>= 2) Repository CRAN Date/Publication 2012-07-23 05:40:17 NeedsCompilation no R topics documented: FindAllRoots-package................................... 1 allroots........................................... 2 dichotomy.......................................... 3 f............................................... 5 Index 7 FindAllRoots-package Find all root(s) of the equation and Find root(s) of the equation by dichotomy Find all root(s) of the equation,including complex roots;find root(s) of the equation by dichotomy 1

2 allroots Package: FindAllRoots Type: Package Version: 1.0 Date: 2012-07-13 License: GPL (>= 2) Bingpei Wu & Jiajun He & Sijie Chen & Yangyang Liu Maintainer: Bingpei Wu<jianpeizhon@126.com> References a passage about finding all roots,whose author is Dequan Shang a passage about finding root(s) of equation,whose author is Yong Ling x1=c(1:10) x2=c(2:11) allroots(a,b) dichotomy(x1,x2,a,b) allroots Find all roots of the equation,including complex roots. find all roots of the equation,including complex roots Usage allroots(a, b) Arguments a b vector of coefficients of the equation vector of exponention of the equation,one one corresponding with a mentioned above a should be one one corresponding with b,or there might lead to wrong results

dichotomy 3 Value all roots of the equation,including complex roots.besides,the inaccuracy error of the roots is also given Bingpei Wu References a passage about finding all roots,whose author is Dequan Shang ##---- Should be DIRECTLY executable!! ---- ##-- ==> Define data, use random, ##--or do help(data=index) for the standard data sets. allroots(a,b) ## The function is currently defined as function (a, b) { a1 = a b1 = b n = length(b) - 1 a = a/a[1] b = matrix(0, ncol = n, nrow = n) for (i in 1:(n - 1)) b[i, i + 1] = 1 for (i in 1:n) b[n, i] = -a[n + 2 - i] c = eigen(b) print(c$values) print("inaccuracy error") print(f(c$values, a1, b1)) dichotomy Find root(s) of the equation by dichotomy Find root(s) of the equation by dichotomy.besides,in dichotomy, more than one interval can be given at a time. Usage dichotomy(x1, x2, a, b, pert = 10^(-5), n = 1000, s = 0.1)

4 dichotomy Arguments x1 x2 a b pert n s vector of left end point of interval(s) vector of right end point of interval(s) vector of coefficients of the equation vector of exponention of the equation,one one corresponding with a mentioned above precision of root(s) the algorithm runs n times at most in one interval and NA will be returned assuming x0 is midpoint of interval [a,b].if f(x0)*f(a)>0 and f(x0)*f(b)>0,b will minus s. If you want to find root(s) of the equation in [a1,b1],[a2,b2],,[an,bn],x1 should be c(a1,a2,,an) and x2 should be c(b1,b2,,bn). If there is no root in [a1,b1],but there is a root in [min(a1,b1- n*s),max(a1,b1-n*s)],the algorithm can still find the root.so the returned root may not in [an,bn] that you give but must be in [min(a1,b1-n*s),max(a1,b1-n*s)]. Value the root(s) of the equation that the difference between returned root(s) and the real root(s) of the equation is less than 10e-6 Bingpei Wu References a passage about finding root(s) of equation,whose author is Yong Ling ##---- Should be DIRECTLY executable!! ---- ##-- ==> Define data, use random, ##--or do help(data=index) for the standard data sets. x1=c(1:10) x2=c(2:11) dichotomy(x1,x2,a,b) ## The function is currently defined as function (x1, x2, a, b, pert = 10^(-5), n = 1000, s = 0.1) { x0 = rep(na, length(x1)) for (i in 1:length(x1)) { if (f(x1[i], a, b) == 0)

f 5 x0 x0[i] = x1[i] if (f(x2[i], a, b) == 0) x0[i] = x2[i] if (f(x1[i], a, b)!= 0 & f(x2[i], a, b)!= 0) { x0[i] = (x1[i] + x2[i])/2 k = 1 while ((abs(f(x0[i], a, b)) >= pert) & (k < n)) { if (f(x0[i], a, b) == 0) break if (f(x1[i], a, b) * f(x0[i], a, b) < 0) x2[i] = x0[i] if (f(x2[i], a, b) * f(x0[i], a, b) < 0) x1[i] = x0[i] if (x1[i]!= x0[i] & x2[i]!= x0[i]) x2[i] = x2[i] - s x0[i] = (x1[i] + x2[i])/2 k = k + 1 if (k == 1000) x0[i] = NA f function returning one function value, or a vector of function values. function returning one function value, or a vector of function values. Usage f(x, a, b) Arguments x a b either one value or a vector containing the x-value(s) vector of coefficients of the equation vector of exponention of the equation,one one corresponding with a mentioned above the function f that estimates the function values will be called as f(x,...). If x is a vector, then the first argument passed to f should also be a vector.

6 f Value the value(s) of the function equation,one function value, or a vector of function values. Bingpei Wu ##---- Should be DIRECTLY executable!! ---- ##-- ==> Define data, use random, ##--or do help(data=index) for the standard data sets. x=c(1:3) f(x,a,b) ## The function is currently defined as function (x, a, b) { z = 0 for (i in 1:length(b)) z = z + a[i] * x^(b[i]) z

Index Topic package FindAllRoots-package, 1 allroots, 2 dichotomy, 3 f, 5 FindAllRoots (FindAllRoots-package), 1 FindAllRoots-package, 1 7