0% found this document useful (0 votes)
11 views

Assignment 2

1. The document contains MATLAB code that defines symbolic variables, functions, and performs differentiation. It defines N=0.13 and uses it in functions containing sin, log, exp, and other terms. 2. The code takes derivatives of the defined functions up to the second derivative. It performs the derivatives symbolically and simplifies the results. 3. The code also calculates N multiplied by the second derivative to observe the effect of the constant N on the derivative.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Assignment 2

1. The document contains MATLAB code that defines symbolic variables, functions, and performs differentiation. It defines N=0.13 and uses it in functions containing sin, log, exp, and other terms. 2. The code takes derivatives of the defined functions up to the second derivative. It performs the derivatives symbolically and simplifies the results. 3. The code also calculates N multiplied by the second derivative to observe the effect of the constant N on the derivative.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

%Marben L.

Viernes BSCE - 4A
%CNSC/CoEng/CAM Prelim/Activity 2
syms x y N
N=0.13

diff(diff(y))
N = 0.1300

y=log(4*N*x+2)+x^4 ans =12*x^2 - 169/(625*((13*x)/25 + 2)^2)

pretty(ans)
y =log((13*x)/25 + 2) + x^4
2 169
pretty(y) 12 x - -----------------
/ 13 x \ 4 / 13 x \2
log| ---- + 2 | + x 625 | ---- + 2 |
\ 25 / \ 25 /

diff(y) N*diff(diff(y))

ans =13/(25*((13*x)/25 + 2)) + 4*x^3 ans =(39*x^2)/25 - 2197/(62500*((13*x)/25 + 2)^2)

pretty(ans) pretty(ans)
13 3 2
--------------- + 4 x 39 x 2197
/ 13 x \ ----- - -------------------
| ---- + 2 | 25 25 / 13 x \2
\ 25 / 62500| ---- + 2 |
\ 25 /
syms x y N
N=0.13

N =0.1300

y=sin((N*x^3)+exp(x*(4*x+1)))

y =sin(exp(x*(4*x + 1)) + (13*x^3)/100)

pretty(y)
/ 3 \
| 13 x |
sin| exp(x (4 x + 1)) + ----- |
\ 100 /

diff(y)

ans =cos(exp(x*(4*x + 1)) + (13*x^3)/100)*(exp(x*(4*x + 1))*(8*x + 1) + (39*x^2)/100)

pretty(ans)
/ 3 \ / 2 \
| 13 x | | 39 x |
cos| exp(x (4 x + 1)) + ----- | | exp(x (4 x + 1)) (8 x + 1) + ----- |
\ 100 / \ 100 /

diff(diff(y))

ans =cos(exp(x*(4*x + 1)) + (13*x^3)/100)*((39*x)/50 + 8*exp(x*(4*x + 1)) + exp(x*(4*x + 1))*(8*x + 1)^2) - sin(exp(x*(4*x + 1)) +
(13*x^3)/100)*(exp(x*(4*x + 1))*(8*x + 1) + (39*x^2)/100)^2

pretty(ans)
/ 3 \ / 3 \ / 2 \2
| 13 x | / 39 x 2\ | 13 x | | 39 x |
cos | #1 + ----- | | ---- + 8 #1 + #1 (8 x + 1) | - sin | #1 + ----- | | #1 (8 x + 1) + ----- |
\ 100 / \ 50 / \ 100 / \ 100 /
where

#1 == exp(x (4 x + 1))

N*diff(diff(y))

ans =(13*cos(exp(x*(4*x + 1)) + (13*x^3)/100)*((39*x)/50 + 8*exp(x*(4*x + 1)) + exp(x*(4*x + 1))*(8*x + 1)^2))/100 - (13*sin(exp(x*(4*x + 1)) +
(13*x^3)/100)*(exp(x*(4*x + 1))*(8*x + 1) + (39*x^2)/100)^2)/100

pretty(ans)
/ 3 \ / 3 \ / 2 \2
| 13 x | / 39 x 2 \ | 13 x | | 39 x |
cos | #1 + ----- || ---- + 8 #1 + #1 (8 x + 1) | 13 sin| #1 + ----- | | #1 (8 x + 1) + ----- | 13
\ 100 / \ 50 / \ 100 / \ 100 /
---------------------------------------------------- - ----------------------------------------------
100 100

where

#1 == exp(x (4 x + 1))
syms x y N
N=0.13

N =0.1300

y=(x-3)*log(sin(x)/cos(4*x))+cos(exp(N*x+3))

y =cos(exp((13*x)/100 + 3)) + log(sin(x)/cos(4*x))*(x - 3)

pretty(y)
/ / 13 x \ \ / sin(x) \
cos| exp| ---- + 3 | | + log| -------- | (x - 3)
\ \ 100 / / \ cos(4 x) /

diff(y)

ans =log(sin(x)/cos(4*x)) - (13*sin(exp((13*x)/100 + 3))*exp((13*x)/100 + 3))/100 + (cos(4*x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2)*(x


- 3))/sin(x)

pretty(ans)
/ cos(x) sin(4 x) sin(x) 4 \
cos(4 x) | -------- + ----------------- | (x - 3)
| cos(4 x) 2 |
/ sin(x) \ sin(#1) #1 13 \ cos(4 x) /
log| -------- | - ------------- + -------------------------------------------------
\ cos(4 x)/ 100 sin(x)

where

/ 13 x \
#1 == exp| ---- + 3 |
\ 100 /
diff(diff(y))

ans =(2*cos(4*x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2))/sin(x) - (169*exp((13*x)/50 + 6)*cos(exp((13*x)/100 + 3)))/10000 -


(169*sin(exp((13*x)/100 + 3))*exp((13*x)/100 + 3))/10000 - (4*sin(4*x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2)*(x - 3))/sin(x) +
(cos(4*x)*(x - 3)*((15*sin(x))/cos(4*x) + (8*sin(4*x)*cos(x))/cos(4*x)^2 + (32*sin(4*x)^2*sin(x))/cos(4*x)^3))/sin(x) -
(cos(4*x)*cos(x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2)*(x - 3))/sin(x)^2
N*diff(diff(y))

ans =(13*cos(4*x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2))/(50*sin(x)) - (2197*exp((13*x)/50 + 6)*cos(exp((13*x)/100 + 3)))/1000000 -


(2197*sin(exp((13*x)/100 + 3))*exp((13*x)/100 + 3))/1000000 - (13*sin(4*x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2)*(x - 3))/(25*sin(x))
+ (13*cos(4*x)*(x - 3)*((15*sin(x))/cos(4*x) + (8*sin(4*x)*cos(x))/cos(4*x)^2 + (32*sin(4*x)^2*sin(x))/cos(4*x)^3))/(100*sin(x)) -
(13*cos(4*x)*cos(x)*(cos(x)/cos(4*x) + (4*sin(4*x)*sin(x))/cos(4*x)^2)*(x - 3))/(100*sin(x)^2)
syms x y a N
N=0.13

N =0.1300

y=((a*x^(3*N))/5*x-sin(3*x+2))/((N*exp(x-2*N))/(3*x-N))

y =-(100*exp(13/50 - x)*(3*x - 13/100)*(sin(3*x + 2) - (a*x^(139/100))/5))/13

diff(y)

ans =(100*exp(13/50 - x)*(3*x - 13/100)*(sin(3*x + 2) - (a*x^(139/100))/5))/13 - (100*exp(13/50 - x)*(3*x - 13/100)*(3*cos(3*x + 2) -


(139*a*x^(39/100))/500))/13 - (300*exp(13/50 - x)*(sin(3*x + 2) - (a*x^(139/100))/5))/13
diff(diff(y))

ans =(600*exp(13/50 - x)*(sin(3*x + 2) - (a*x^(139/100))/5))/13 - (600*exp(13/50 - x)*(3*cos(3*x + 2) - (139*a*x^(39/100))/500))/13 + (200*exp(13/50


- x)*(3*x - 13/100)*(3*cos(3*x + 2) - (139*a*x^(39/100))/500))/13 + (100*exp(13/50 - x)*(9*sin(3*x + 2) + (5421*a)/(50000*x^(61/100)))*(3*x - 13/100))/13
- (100*exp(13/50 - x)*(3*x - 13/100)*(sin(3*x + 2) - (a*x^(139/100))/5))/13
N*diff(diff(y))

ans =6*exp(13/50 - x)*(sin(3*x + 2) - (a*x^(139/100))/5) - 6*exp(13/50 - x)*(3*cos(3*x + 2) - (139*a*x^(39/100))/500) + 2*exp(13/50 - x)*(3*x -


13/100)*(3*cos(3*x + 2) - (139*a*x^(39/100))/500) + exp(13/50 - x)*(9*sin(3*x + 2) + (5421*a)/(50000*x^(61/100)))*(3*x - 13/100) - exp(13/50 - x)*(3*x
- 13/100)*(sin(3*x + 2) - (a*x^(139/100))/5)

You might also like