Solver will continue anyway.. Solver will continue anyway.. Solver will continue anyway.. Solver will continue anyway... Solver will continue anyway.. Solver will continue anyway.. Solve
Trang 2NV1.Tính các tích phân xác định trong bài 9.1 với cận num đến num+10
Error in integrate(f, lower = 166, upper = 176) :
non-finite function value
In addition: Warning message:
In sqrt((1 - x^2)^3) : NaNs produced
Trang 4In addition: Warning message:
In log(tan(x)) : NaNs produced
11,dx
> f<-function(x){(x^2-1)/(x^4+1)}
> integrate(f,lower=166,upper=176)
Trang 5Error in integrate(f, lower = 166, upper = 176) :
the integral is probably divergent
Error in integrate(f, lower = 166, upper = 176) :
non-finite function value
Trang 62.003271e-06 with absolute error < 2.2e-20
NV2 Tính đạo hàm cấp 1 & 2 các hàm số trong bài 12.2 1) Z=
Trang 7y^2 * (2 * y) + (x^3 + y^3) * 2)/(x^2 + y^2)^2 - (x^3 + y^3) * (2 * y) * (2 * (2 * y * (x^2 + y^2)))/((x^2 + y^2)^2)^2)
(x^2 + y^2)^-0.5)) * (1 + 0.5 * (2 * x * (x^2 + y^2)^-0.5))/(x + sqrt(x^2 + y^2))^2
3) Z=
Trang 8exp(atan(y/x)) * (1/x/(1 + (y/x)^2)) * (1/x/(1 + (y/x)^2)) -
exp(atan(y/x)) * (1/x * (2 * (1/x * (y/x)))/(1 + (y/x)^2)^2)
4) Z= ln
Đạo hàm cấp 1 x
> D(expression(log((sqrt(x^2+y^2)-x)/(sqrt(x^2+y^2)+x))),'x')((0.5 * (2 * x * (x^2 + y^2)^-0.5) - 1)/(sqrt(x^2 + y^2) + x) - (sqrt(x^2 + y^2) - x) * (0.5 * (2 * x * (x^2 + y^2)^-0.5) +
1)/(sqrt(x^2 + y^2) + x)^2)/((sqrt(x^2 + y^2) - x)/(sqrt(x^2 + y^2) + x))
Đạo hàm cấp 2 x
Trang 9(0.5 * (2 * (x^2 + y^2)^-0.5 + 2 * x * (-0.5 * (2 * x * (x^2 +
y^2)^-1.5)))/(sqrt(x^2 + y^2) + x) - (0.5 * (2 * x * (x^2 +
y^2)^-0.5) - 1) * (0.5 * (2 * x * (x^2 + y^2)^-0.5) + 1)/(sqrt(x^2 + y^2) + x)^2 - (((0.5 * (2 * x * (x^2 + y^2)^-0.5) - 1) *
(0.5 * (2 * x * (x^2 + y^2)^-0.5) + 1) + (sqrt(x^2 + y^2) -
x) * (0.5 * (2 * (x^2 + y^2)^-0.5 + 2 * x * (-0.5 * (2 *
x * (x^2 + y^2)^-1.5)))))/(sqrt(x^2 + y^2) + x)^2 - (sqrt(x^2 + y^2) - x) * (0.5 * (2 * x * (x^2 + y^2)^-0.5) + 1) * (2 *
((0.5 * (2 * x * (x^2 + y^2)^-0.5) + 1) * (sqrt(x^2 + y^2) +
x)))/((sqrt(x^2 + y^2) + x)^2)^2))/((sqrt(x^2 + y^2) -
x)/(sqrt(x^2 + y^2) + x)) - ((0.5 * (2 * x * (x^2 + y^2)^-0.5) - 1)/(sqrt(x^2 + y^2) + x) - (sqrt(x^2 + y^2) - x) * (0.5 *
(2 * x * (x^2 + y^2)^-0.5) + 1)/(sqrt(x^2 + y^2) + x)^2) *
((0.5 * (2 * x * (x^2 + y^2)^-0.5) - 1)/(sqrt(x^2 + y^2) +
x) - (sqrt(x^2 + y^2) - x) * (0.5 * (2 * x * (x^2 + y^2)^-0.5) + 1)/(sqrt(x^2 + y^2) + x)^2)/((sqrt(x^2 + y^2) - x)/(sqrt(x^2 + y^2) + x))^2
Đạo hàm cấp 1 y
> D(expression(log((sqrt(x^2+y^2)-x)/(sqrt(x^2+y^2)+x))),'y')(0.5 * (2 * y * (x^2 + y^2)^-0.5)/(sqrt(x^2 + y^2) + x) - (sqrt(x^2 + y^2) - x) * (0.5 * (2 * y * (x^2 + y^2)^-0.5))/(sqrt(x^2 +
y^2) + x)^2)/((sqrt(x^2 + y^2) - x)/(sqrt(x^2 + y^2) + x))
Trang 12y^2)^-0.5)) * (2 * (0.5 * (2 * x * (x^2 + y^2)^-0.5) *
(sqrt(x^2 + y^2))))/((sqrt(x^2 + y^2))^2)^2))/(1 + ((sqrt(x^2 -
y^2))/(sqrt(x^2 + y^2)))^2) - (0.5 * (2 * x * (x^2 - y^2)^-0.5)/(sqrt(x^2 + y^2)) - (sqrt(x^2 - y^2)) * (0.5 * (2 * x * (x^2 + y^2)^-0.5))/(sqrt(x^2 + y^2))^2) * (2 * ((0.5 * (2 * x * (x^2 - y^2)^-0.5)/(sqrt(x^2 +
y^2)) - (sqrt(x^2 - y^2)) * (0.5 * (2 * x * (x^2 + y^2)^-0.5))/(sqrt(x^2 + y^2))^2) * ((sqrt(x^2 - y^2))/(sqrt(x^2 + y^2)))))/(1 + ((sqrt(x^2 -
y^2)^-0.5)) * (2 * (0.5 * (2 * y * (x^2 + y^2)^-0.5) *
Trang 13y^2))/(sqrt(x^2 + y^2)))^2) + (0.5 * (2 * y * (x^2 - y^2)^-0.5)/(sqrt(x^2 + y^2)) + (sqrt(x^2 - y^2)) * (0.5 * (2 * y * (x^2 + y^2)^-0.5))/(sqrt(x^2 + y^2))^2) * (2 * ((0.5 * (2 * y * (x^2 - y^2)^-0.5)/(sqrt(x^2 +
y^2)) + (sqrt(x^2 - y^2)) * (0.5 * (2 * y * (x^2 + y^2)^-0.5))/(sqrt(x^2 + y^2))^2) * ((sqrt(x^2 - y^2))/(sqrt(x^2 + y^2)))))/(1 + ((sqrt(x^2 -
y^2))/(sqrt(x^2 + y^2)))^2)^2)
7) Z=
Đạo hàm cấp 1 x
> D(expression((x+y)^(sin(x)*sin(y))),'x')
(x + y)^((sin(x) * sin(y)) - 1) * (sin(x) * sin(y)) + (x + y)^(sin(x) *
sin(y)) * (log((x + y)) * (cos(x) * sin(y)))
Đạo hàm cấp 2 x
> D( D(expression((x+y)^(sin(x)*sin(y))),'x'),'x')
((x + y)^(((sin(x) * sin(y)) - 1) - 1) * ((sin(x) * sin(y)) -
1) + (x + y)^((sin(x) * sin(y)) - 1) * (log((x + y)) * (cos(x) *
sin(y)))) * (sin(x) * sin(y)) + (x + y)^((sin(x) * sin(y)) -
1) * (cos(x) * sin(y)) + (((x + y)^((sin(x) * sin(y)) - 1) *
(sin(x) * sin(y)) + (x + y)^(sin(x) * sin(y)) * (log((x +
y)) * (cos(x) * sin(y)))) * (log((x + y)) * (cos(x) * sin(y))) +
(x + y)^(sin(x) * sin(y)) * (1/(x + y) * (cos(x) * sin(y)) -
log((x + y)) * (sin(x) * sin(y))))
Đạo hàm cấp 1 y
Trang 14> D(expression((x+y)^(sin(x)*sin(y))),'y')
(x + y)^((sin(x) * sin(y)) - 1) * (sin(x) * sin(y)) + (x + y)^(sin(x) *
sin(y)) * (log((x + y)) * (sin(x) * cos(y)))
Đạo hàm cấp 2 y
> D( D(expression((x+y)^(sin(x)*sin(y))),'y'),'y')
((x + y)^(((sin(x) * sin(y)) - 1) - 1) * ((sin(x) * sin(y)) -
1) + (x + y)^((sin(x) * sin(y)) - 1) * (log((x + y)) * (sin(x) *
cos(y)))) * (sin(x) * sin(y)) + (x + y)^((sin(x) * sin(y)) -
1) * (sin(x) * cos(y)) + (((x + y)^((sin(x) * sin(y)) - 1) *
(sin(x) * sin(y)) + (x + y)^(sin(x) * sin(y)) * (log((x +
y)) * (sin(x) * cos(y)))) * (log((x + y)) * (sin(x) * cos(y))) +
(x + y)^(sin(x) * sin(y)) * (1/(x + y) * (sin(x) * cos(y)) -
log((x + y)) * (sin(x) * sin(y))))
NV3 Vẽ đồ thị nghiệm riêng của các PTVP trong bài 10.4 với điều kiện ban đầu y(num)
= 2 trên miền [num, num+10]
1
2 2
2
'
y x
xy y
−
=
> ham <- function (x, y,parms) {list(c((2*x)/(1+x^2)))}
> dieukien <- c(y = 2)
> nghiem <- ode(y = dieukien, func = ham,times = 166:176, parms = 0)
> plot(nghiem, type = "l", which = "y",lwd = 2, xlab = "Truc x", ylab = "Truc y",main =
"PTVP")
Trang 15> nghiem <- ode(y = dieukien, func = ham,times = 166:176, parms = 0)
> plot(nghiem, type = "l", which = "y",lwd = 2, xlab = "Truc x", ylab = "Truc y",main =
"PTVP")
Trang 16> nghiem <- ode(y = dieukien, func = ham,times = 166:176, parms = 0)
> plot(nghiem, type = "l", which = "y",lwd = 2, xlab = "Truc x", ylab = "Truc y",main =
"PTVP")
Trang 174 y'−y.sinx=sinxcosx
> ham <- function (x, y,parms) {list(c(y*sin(x)+sin(x)*cos(x)))}
> dieukien <- c(y = 2)
> nghiem <- ode(y = dieukien, func = ham,times = 166:176, parms = 0)
> plot(nghiem, type = "l", which = "y",lwd = 2, xlab = "Truc x", ylab = "Truc y",main =
"PTVP")
Trang 192: In asin(x) : NaNs produced
3: In asin(x) : NaNs produced
4: In asin(x) : NaNs produced
5: In asin(x) : NaNs produced
6: In asin(x) : NaNs produced
7: In asin(x) : NaNs produced
8: In asin(x) : NaNs produced
9: In asin(x) : NaNs produced
10: In asin(x) : NaNs produced
11: In asin(x) : NaNs produced
12: In asin(x) : NaNs produced
13: In asin(x) : NaNs produced
14: In asin(x) : NaNs produced
6 ' 2 ( )
2 y x x
Trang 20Error in lsoda(y, times, func, parms, ) :
illegal input detected before taking any integration steps - see written message
7
2
22
xy− =
> ham <- function (x, y,parms) {list(c((2*y)/x+2*x^3))}
> dieukien <- c(y = 2)
> nghiem <- ode(y = dieukien, func = ham,times = 166:176, parms = 0)
> plot(nghiem, type = "l", which = "y",lwd = 2, xlab = "Truc x", ylab = "Truc y",main =
"PTVP")
Trang 221: In sqrt(1 - x^2) : NaNs produced2: In asin(x) : NaNs produced
3: In sqrt(1 - x^2) : NaNs produced4: In sqrt(1 - x^2) : NaNs produced5: In asin(x) : NaNs produced
6: In sqrt(1 - x^2) : NaNs produced7: In sqrt(1 - x^2) : NaNs produced8: In asin(x) : NaNs produced
9: In sqrt(1 - x^2) : NaNs produced10: In sqrt(1 - x^2) : NaNs produced11: In asin(x) : NaNs produced12: In sqrt(1 - x^2) : NaNs produced13: In sqrt(1 - x^2) : NaNs produced14: In asin(x) : NaNs produced15: In sqrt(1 - x^2) : NaNs produced16: In sqrt(1 - x^2) : NaNs produced17: In asin(x) : NaNs produced18: In sqrt(1 - x^2) : NaNs produced19: In sqrt(1 - x^2) : NaNs produced20: In asin(x) : NaNs produced21: In sqrt(1 - x^2) : NaNs produced22: In sqrt(1 - x^2) : NaNs produced23: In asin(x) : NaNs produced
Trang 23x x
y
y− =
2 0
Trang 24> nghiem <- ode(y = dieukien, func = ham,times = 166:176, parms = 0)
> plot(nghiem, type = "l", which = "y",lwd = 2, xlab = "Truc x", ylab = "Truc y",main =
Trang 25> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2")
> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
Trang 26T not in interval TCUR - HU (= R1) to TCUR (=R2)
In above message, R1 = 168, R2 = 168
DLSODA- Trouble in DINTDY ITASK = I1, TOUT = R1
In above message, I1 = 1
In above message, R1 = 170
Error in lsoda(y, times, func, parms, ) :
illegal input detected before taking any integration steps - see written message
> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2") Error in plot(nghiem, type = "l", which = "y1", lwd = 2, ylab = "Truc y", :
object 'nghiem' not found
3) ) 4y” – 20y’ + 25y = 0
> library(deSolve)
> ham <- function (x, y,parms) {list(c(4*y[2], 20*y[2]-25*y[1]))}
> dieukien <- c(y1 = 2, y2 = 1)
> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2")
*Đồ thị
Trang 27> library(deSolve)
> ham <- function (x, y,parms) {list(c(y[2], 4*y[1]-12*x^2-6*x-4))}
> dieukien <- c(y1 = 2, y2 = 1)
> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP
> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
Trang 28Error in lsoda(y, times, func, parms, ) :
illegal input detected before taking any integration steps - see written message
> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2")
6) y” – 5y’ + 4y = 4
> library(deSolve)
> ham <- function (x, y,parms) {list(c(y[2], 5 * y[2] - 4 * y[1] + 4 * x^2 * exp(1)^x))}
> dieukien <- c(y1 = 2, y2 = 1)
> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-81
Trang 29such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway.
In above message, R1 = 168, R2 = 1.93588e-81
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-77
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-77
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-77
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-76
Trang 30DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway.
In above message, R1 = 168, R2 = 1.93588e-76
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-76
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-76
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 1.93588e-75
DLSODA- Above warning has been issued I1 times
It will not be issued again for this problem
In above message, I1 = 10
Trang 31> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2")
> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2")
*Đồ thị
Trang 32> nghiem <- ode(y = dieukien, func = ham,times = 168:178, parms = 1)
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-79
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
Trang 33DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway.
In above message, R1 = 168, R2 = 5.58639e-75
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-75
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-75
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-74
DLSODA- Warning Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step
Trang 34(H = step size) Solver will continue anyway.
In above message, R1 = 168, R2 = 5.58639e-74
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-73
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-73
DLSODA- Warning Internal T (=R1) and H (=R2) are
such that in the machine, T + H = T on the next step
(H = step size) Solver will continue anyway
In above message, R1 = 168, R2 = 5.58639e-73
DLSODA- Above warning has been issued I1 times
It will not be issued again for this problem
In above message, I1 = 10
> plot(nghiem, type = "l", which = "y1",lwd = 2, ylab = "Truc y",main = "PTVP cấp 2")
*Đồ thị