Hi. I am quite new to using phyton is SAGE, but what I did here is that I have tried my best to come up with the code based on reading multiple notes on SAGE.
The values of alpha, n, eta, lambda, h, T, t, kappa, k(x-s) and gamma values are given.
I have tried to do the coding from scratch and this is what I have obtained:
from __future__ import print_function
alpha = 1.2
n = 2
eta = 1.3
lamda = 1
h = 1
T = 1
t = 0.1
h, t, x, s = var('h t x s')
U[t] = 1/3*t^3+1
P[t] = 2*t-lamda*(-t^4/24+t^5/15-t^7/126+t^8/72)
b[k] = 1
def X(m):
if m <= 1:
return 0
else:
return 1
k[x,s]=s-x
gamma[z]=integrate(x^(z-1)*e^(-x),x, 0, infinity)
u[0]=1
for m in range(1,4):
u[m] = sum(b[k]/factorial(k)*t^k,k,0,n-1) + X[m]*u[m-1]-X[m]*sum(𝚍𝚎𝚛𝚒𝚟𝚊𝚝𝚒𝚟𝚎(u[m-1][0],t,k)/factorial(k)*t^k,k,0,n-1)+h/gamma[eta-alpha]*integrate((t-tau)^(eta-alpha-1)*u[m-1].subs(t=tau)*P[t].subs(t=tau),tau, 0, t); print(u[m].full_simplify())
UU=u[1]+u[2]+u[3]+u[4]:
What I am trying to achieve here is the values of u_1, u_2, u_3, u_4
. Then calculate UU = u_1 + u_2 + u_3 + u_4
.
At the moment, I am not getting the answer. Not sure what is causing the error. It took me so much time and effort to come up with this from scratch, hope someone can help me indicate what's wrong with this coding. Thank you in advance.