Question: How to avoid float undefined

Dear Sir/Madam,

Greetings of the day.

If I am considering the value of "gam=0.5,0.7,0.9" in the code other than 1, I am unbale to draw figure using this code. Also, I can not evaluate the values of  A1[200]; A1[400]; A1[600]; A1[800]; A1[1000]. It is showing float undefined.

Please help me in this regard. Thanks in advance

restart 

 

   

f1 := proc (y, t) options operator, arrow; y*sin(t) end proc

NULL

y[0] := .3678794412

h := 0.1e-2; alpha := proc (t) options operator, arrow; .97+0.3e-1*cos((1/10)*t) end proc; gam := .5
NULLNULL

 
for n from 0 to 999 do t[n] := n*h end do

for n from 0 to 0 do y[n+1] := y[n]+h^alpha(t[n])*f1(y[n], t[n])/GAMMA(alpha(t[n])+1) end do

.3678794412

(1)

for n to 999 do y[n+1] := y[0]+gam*h^alpha(t[n])*(sum(t[j]^(gam-1)*((n+1-j)^alpha(t[n])*(n-j+2+alpha(t[n]))-(n-j)^alpha(t[n])*(n-j+2+2*alpha(t[n])))*f1(y[j], t[j])-t[j-1]^(gam-1)*((n+1-j)^(alpha(t[n])+1)-(n-j)^alpha(t[n])*(n-j+1+alpha(t[n])))*f1(y[j-1], t[j-1]), j = 1 .. n))/GAMMA(2+alpha(t[n])) end do

A1[1] := .3678794412

for i to 1000 do A1[i+1] := y[i] end do

NULL

NULL

L := [seq((i-1)*h, i = 1 .. 1001)]NULLNULLNULLNULL

  A1 := [seq(A1[i], i = 1 .. 1001)] 

plot(L, A1, color = red)

 

NULL

A1[200]; A1[400]; A1[600]; A1[800]; A1[1000]

Float(undefined)

 

Float(undefined)

 

Float(undefined)

 

Float(undefined)

 

Float(undefined)

(2)

NULL

``

Download Plot_undefined.mw

Please Wait...