how to resolve this integral, i have the function in s and i want to integrate this function between t and infinity and get an explicit solution, can someone help me
2 views (last 30 days)
Show older comments
genesio torge
on 22 Aug 2020
Answered: Devineni Aslesha
on 25 Aug 2020
alpha=0.2
beta=0.05
sigma=0.01
r0=0.05
epsilon=-0.46
NRepl=60
NSteps=60
T=60
dt=T/NSteps
model='vasicek'
rng(75)
T=60
%t=0:1:60
r = pr_1(r0, alpha, beta, sigma, T, NSteps, NRepl, model)
a=mean(r)
%r1 = pr(r0, alpha, beta, sigma, T, NSteps, NRepl, model)
%b=mean(r1)
%r2 = pr_2(r0, alpha, beta, sigma, T, NSteps, NRepl, model)
%c=mean(r2)
figure;
plot(a,'r')
%hold on
%plot(b,'k')
%hold on
%plot(c,'b')
%hold off
%%
alpha1=-0.095
phi=0.001
sigma1=0.001
v0=0.00123
rng(1075)
v= mortalitysimulation(alpha1,phi,sigma1,v0,T, NSteps, NRepl, model)
m=mean(v)
v2= mortalitysimulation1(alpha1,phi,sigma1,v0,T, NSteps, NRepl, model)
z=mean(v2)
v1= mortalitysimulation2(alpha1,phi,sigma1,v0,T, NSteps, NRepl, model)
l=mean(v1)
figure;
plot(m)
%hold on
%plot(z,'--')
%hold on
%plot(l,'--')
%hold off
%%
B=alpha*beta
A=-alpha
sigma1=sigma^2
h=3
rho=0.05
H=h-1/h
B1=alpha1*phi
A1=-alpha1
sigma11=sigma1^2
k=1/h
%t=1:1:60
d=[epsilon;0]
D=d*d'
%%
ZZ=k*(1/A1)*(B1-(3/4)*k*sigma11/(A1^2))
XX=k*(B1-(1/2)*k*sigma11/(A1^2))
CC=k*(B1-k*sigma11/(A1^2))*(1/A1)
NN=(1/4)*k^2*sigma11/(A1^2)*(1/A1)
MM=H*(1/A)*(B-(3/4)*H*sigma1/(A^2))
LL=H*(B-(1/2)*H*sigma1/(A^2))
KK=H*(B-H*sigma1/(A^2))*(1/A)
JJ=1/4*((H^2)*sigma1/(A^2))*(1/A)
syms t
syms s
fun=@(s) exp(ZZ-XX*s-CC*exp(-A1*s)-NN*exp(-2*A1*s)-k*(1/A1)*(1-exp(-A1*s))*m+MM-LL*(s-t)-KK*exp(-A*(s-t))-JJ*exp(-2*A*(s-t))-H*(1/A)*(1-exp(-A*(s-t))*a-H*(1/2)*epsilon^2*(s-t)-k*rho*s))
I=int(fun,s,t,Inf)
0 Comments
Accepted Answer
Devineni Aslesha
on 25 Aug 2020
In the given code, the way the int is used caculates the integral of fun with respect to the variable s from to to Inf. However, int function is unable resolve the integral of the given expression. You can refer the Approximate Indefinite Integrals in int function where it returns the unresolved integral. You can either approximate the integrand function (fun) or take care of the braces while defining fun so that it can be solved. Also, before computing the integral with the limits, try to compute the integral w.r.t variable 's'.
Use I=int(fun,s) instead of I=int(fun,s,t,Inf)).
Once the integral is resolved, then apply the limits from t to Inf.
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!