From: Daniel V. <dan...@ya...> - 2017-11-11 14:30:40
|
Hi All, Given a numerical calculation like the result of rk, rkf45 or Eulix, I would like to obtain the numerical integral function of the result.The input is a list of lists, each sublist of equal length. The first element of each sublist is monotonically increasing, modeling time (t) or arc-length (s).The other elements of the sublist model smooth functions. My attempts have been successful but extremely wasteful. I interpolate the entire input data and convert it to a function. Then I calculate the numerical value of the integral with respect to time at each point. load(rkf45)$load(interpol)$load(grobner)$ rksol:rkf45([x*(1-y),-y*(1-x)],[x,y],[2,2],[t,0,10,0.01], absolute_tolerance=5E-8,report=true)$ plot2d([[discrete,map(lambda([u],part(u,[1,2])),rksol)], [discrete,map(lambda([u],part(u,[1,3])),rksol)]], [style,[lines,2]],[y,0,3])$ Lx:map(lambda([u],part(u,[1,2])),rksol)$ Ly:map(lambda([u],part(u,[1,3])),rksol)$ linearinterpol(Lx,varname='t)$ Fx(t):=''%$ linearinterpol(Ly,varname='t)$ Fy(t):=''%$ plot2d([Fx(t),Fy(t)],[t,0,10],[style,[lines,2]],[y,0,3])$ Ix:makelist([i,romberg(Fx(t),t,0,i)],i,0,10,0.01)$ Iy:makelist([i,romberg(Fy(t),t,0,i)],i,0,10,0.01)$ plot2d([[discrete,Ix],[discrete,Iy]],[style,[lines,2]])$ Did anyone solve this problem before?Is there a Maxima package that solves this problem?Any suggestions? Thanks, Daniel |