@@ -80,9 +80,9 @@ NNS.diff <- function(f, point, h = 0.1, tol = 1e-10, digits = 12, print.trace =
80
80
if (lower.B == upper.B ){
81
81
original.par = par(no.readonly = TRUE )
82
82
par(mfrow = c(1 , 2 ))
83
- plot(f , xlim = c(point - (100 * h ), point + (100 * h )), col = ' blue ' , ylab = ' f(x)' )
83
+ plot(f , xlim = c(point - (100 * h ), point + (100 * h )), col = ' steelblue ' , ylab = ' f(x)' )
84
84
points(point , f.x , pch = 19 , col = ' red' )
85
- plot(f , xlim = c(point - 1 , point + 1 ), col = ' blue ' , ylab = ' f(x)' )
85
+ plot(f , xlim = c(point - 1 , point + 1 ), col = ' steelblue ' , ylab = ' f(x)' )
86
86
points(point , f.x , pch = 19 , col = ' red' )
87
87
par(original.par )
88
88
@@ -120,31 +120,31 @@ NNS.diff <- function(f, point, h = 0.1, tol = 1e-10, digits = 12, print.trace =
120
120
plot(f , xlim = c(min(c(point - (100 * h ), point + (100 * h )), 0 ), max(c(point - (100 * h ), point + (100 * h )), 0 )), col = ' azure4' , ylab = ' f(x)' , lwd = 2 , ylim = c(min(c(min(c(B1 , B2 )), min(na.omit(f((point - (100 * h )) : (point + (100 * h ))))))), max(c(max(na.omit(f((point - (100 * h )) : (point + (100 * h ))))), max(c(B1 , B2 ))))), main = ' f(x) and initial y-intercept range' )
121
121
abline(h = 0 , v = 0 , col = ' grey' )
122
122
points(point , f.x , pch = 19 , col = ' green' )
123
- points(point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' blue ' , ' red' ), pch = 19 )
124
- points(point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' , ' blue ' ), pch = 19 )
125
- points(x = rep(0 , 2 ), y = c(B1 , B2 ), col = c(ifelse(B1 == high.B , ' blue ' , ' red' ), ifelse(B1 == high.B , ' red' , ' blue ' )), pch = 1 )
126
- segments(0 , B1 , point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' blue ' ,' red' ), lty = 2 )
127
- segments(0 , B2 , point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' ,' blue ' ), lty = 2 )
123
+ points(point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' steelblue ' , ' red' ), pch = 19 )
124
+ points(point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' , ' steelblue ' ), pch = 19 )
125
+ points(x = rep(0 , 2 ), y = c(B1 , B2 ), col = c(ifelse(B1 == high.B , ' steelblue ' , ' red' ), ifelse(B1 == high.B , ' red' , ' steelblue ' )), pch = 1 )
126
+ segments(0 , B1 , point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' steelblue ' ,' red' ), lty = 2 )
127
+ segments(0 , B2 , point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' ,' steelblue ' ), lty = 2 )
128
128
129
129
# # Plot #2
130
130
plot(f , col = ' azure4' , ylab = ' f(x)' , lwd = 3 , main = ' f(x) narrowed range and secant lines' , xlim = c(min(c(point - h , point + h , 0 )), max(c(point + h ,point - h , 0 ))), ylim = c(min(c(B1 , B2 , f.x.h.lower , f.x.h.upper )), max(c(B1 , B2 , f.x.h.lower , f.x.h.upper ))))
131
131
132
132
abline(h = 0 , v = 0 , col = ' grey' )
133
133
points(point ,f.x , pch = 19 , col = ' red' )
134
- points(point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' blue ' , ' red' ), pch = 19 )
135
- points(point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' , ' blue ' ), pch = 19 )
134
+ points(point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' steelblue ' , ' red' ), pch = 19 )
135
+ points(point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' , ' steelblue ' ), pch = 19 )
136
136
points(point , f.x , pch = 19 , col = ' green' )
137
- segments(0 , B1 , point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' blue ' , ' red' ), lty = 2 )
138
- segments(0 , B2 , point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' , ' blue ' ), lty = 2 )
139
- points(x = rep(0 , 2 ), y = c(B1 , B2 ), col = c(ifelse(B1 == high.B , ' blue ' , ' red' ), ifelse(B1 == high.B , ' red' , ' blue ' )), pch = 1 )
137
+ segments(0 , B1 , point - h , f.x.h.lower , col = ifelse(B1 == high.B , ' steelblue ' , ' red' ), lty = 2 )
138
+ segments(0 , B2 , point + h , f.x.h.upper , col = ifelse(B1 == high.B , ' red' , ' steelblue ' ), lty = 2 )
139
+ points(x = rep(0 , 2 ), y = c(B1 , B2 ), col = c(ifelse(B1 == high.B , ' steelblue ' , ' red' ), ifelse(B1 == high.B , ' red' , ' steelblue ' )), pch = 1 )
140
140
141
141
142
142
# # Plot #3
143
143
plot(Bs , ylim = c(min(c(Bl , Bu )), max(c(Bl , Bu ))), xlab = " Iterations" , ylab = " y-inetercept" , col = ' green' , pch = 19 , main = ' Iterated range of y-intercept' )
144
144
points(Bl , col = ' red' , ylab = ' ' )
145
- points(Bu , col = ' blue ' , ylab = ' ' )
145
+ points(Bu , col = ' steelblue ' , ylab = ' ' )
146
146
147
- legend(' topright' , c(" Upper y-intercept" , " Lower y-intercept" , " Mean y-intercept" ), col = c(' blue ' , ' red' , ' green' ), pch = c(1 , 1 , 19 ), bty = ' n' )
147
+ legend(' topright' , c(" Upper y-intercept" , " Lower y-intercept" , " Mean y-intercept" ), col = c(' steelblue ' , ' red' , ' green' ), pch = c(1 , 1 , 19 ), bty = ' n' )
148
148
149
149
par(original.par )
150
150
0 commit comments