syms x real % define x as a real symbolic variable format compact % eliminates blank lines in output format long g % show all digits of numerical output
a = int( exp(-3*x)*sin(x), x) simplify(a)
a = -1/10*exp(-3*x)*cos(x)-3/10*exp(-3*x)*sin(x) ans = -1/10*exp(-3*x)*(cos(x)+3*sin(x))
a = int( (x+1)*log(x), x) simplify(a)
a = 1/2*x^2*log(x)-1/4*x^2+x*log(x)-x ans = 1/4*x*(2*x*log(x)-x+4*log(x)-4)
This is a definite integral for x=0 to 1:
I = int( sqrt(x/(1-x)), x, 0, 1 )
I = 1/2*pi
Use Inf for infinity:
I = int(exp(-x^2), x, -Inf, Inf)
I = pi^(1/2)
I = int(sqrt(1+x^4), x, 0, 1) % symbolic answer double(I) % numerical value of symbolic answer Q = quadl('sqrt(1+x.^4)',0,1) % approximate answer using numerical integration % need ".^" here
I = 1/3*2^(1/2)+1/3*EllipticK(1/2*2^(1/2)) ans = 1.08942941322482 Q = 1.08942935729903