CoCalc Public Filessupport / bill-page-broken-worksheet-debug.sagews
Authors: Harald Schilly, ℏal Snyder, William A. Stein
Description: Jupyter notebook support/2015-06-04-141749-bokeh.ipynb

I would like to be able to (symbolically) compute the Jacobian matrix for the Octave lsode backward differentiation method for "stiff" differential equations. The result is considerably more complicated than I expected!

sys.path.insert(0,'%s/lib/python2.7/site-packages'%os.environ['HOME'])

import pexpect
pexpect.__version__
import expect
from fricas import fricas

<module 'pexpect' from '/projects/b04b5777-e269-4c8f-a4b8-b21dbe1c93c6/lib/python2.7/site-packages/pexpect/__init__.pyc'> '3.3' <module 'expect' from './expect.pyc'>
%sage
os.environ['PATH'] = '%s/bin:%s'%(os.environ['HOME'],os.environ['PATH'])
execfile('fricas_md.py')
%default_mode fricas_md

)version
)clear completely
)set output tex on
)set output algebra off
)set output mathml off
)set message type off


Value = "FriCAS 2014-12-18 compiled at Tue May 5 18:13:01 UTC 2015"

All user variables and function definitions have been cleared.

All )browse facility databases have been cleared.

Internally cached functions and constructors have been cleared.

)clear completely is finished.

x:=operator('x);
--hbar:=ℏ;

-- Equations 24,25 of HEW paper
R(x,i) == (hbar^2/(4*m))*(sigma(x,i+1)-sigma(x,i))

sigma(x,i) == sif(x,i)^2*(sif(x,i+1)-2*sif(x,i)+sif(x,i-1))

sif(x,i) ==
--i>N or i<2 => 0
1/(x(i)-x(i-1))

numer sigma(x,i)
factor denom sigma(x,i)


Compiling function sif with type (BasicOperator,Variable(i)) -> Expression(Integer)

Compiling function sif with type (BasicOperator,Polynomial(Integer)) -> Expression(Integer)

Compiling function sigma with type (BasicOperator,Variable(i)) -> Expression(Integer)

$${{\left( {x \left( {i} \right)} -{3 \ {x \left( {{i -1}} \right)}}+{2 \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {{i+1}} \right)}} -{{{x \left( {i} \right)}} ^{2}}+{{\left( {4 \ {x \left( {{i -1}} \right)}} -{3 \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {i} \right)}} -{{{x \left( {{i -1}} \right)}} ^{2}}+{{x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}}$$

$${\left( {x \left( {{i -1}} \right)} -{x \left( {{i -2}} \right)} \right)} \ {{{\left( {x \left( {i} \right)} -{x \left( {{i -1}} \right)} \right)}} ^{3}} \ {\left( {x \left( {{i+1}} \right)} -{x \left( {i} \right)} \right)}$$

Many Worlds Interaction

Ri:=R(x,i);
factor numer Ri
factor denom Ri


Compiling function sigma with type (BasicOperator,Polynomial(Integer)) -> Expression(Integer)

Compiling function R with type (BasicOperator,Variable(i)) -> Expression(Integer)

$$-{{{hbar} ^{2}} \ {\left( {{\left( {{\left( {x \left( {i} \right)} -{3 \ {x \left( {{i -1}} \right)}}+{2 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( -{3 \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {{10} \ {x \left( {{i -1}} \right)}} -{7 \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {i} \right)}} -{{{x \left( {{i -1}} \right)}} ^{2}}+{{x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( {3 \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{{12} \ {x \left( {{i -1}} \right)}}+{9 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {4 \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{4 \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {i} \right)}} -{{{x \left( {{i -1}} \right)}} ^{3}}+{{x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {x \left( {{i+1}} \right)}} -{{{x \left( {i} \right)}} ^{4}}+{{\left( {7 \ {x \left( {{i -1}} \right)}} -{6 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{9 \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{9 \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {7 \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{7 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {x \left( {i} \right)}} -{2 \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{2 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {{i+2}} \right)}}+{{\left( -{x \left( {i} \right)}+{3 \ {x \left( {{i -1}} \right)}} -{2 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{4}}}+{{\left( {3 \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{{10} \ {x \left( {{i -1}} \right)}}+{7 \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {i} \right)}}+{{{x \left( {{i -1}} \right)}} ^{2}} -{{x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( -{3 \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{12} \ {x \left( {{i -1}} \right)}} -{9 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{4 \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{4 \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {i} \right)}}+{{{x \left( {{i -1}} \right)}} ^{3}} -{{x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( {{{x \left( {i} \right)}} ^{4}}+{{\left( -{8 \ {x \left( {{i -1}} \right)}}+{7 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{12} \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{{10} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{10} \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {x \left( {i} \right)}}+{3 \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{3 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {{i+1}} \right)}}+{{\left( {x \left( {{i -1}} \right)} -{x \left( {{i -2}} \right)} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{3 \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{3 \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {3 \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{3 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{{{x \left( {{i -1}} \right)}} ^{4}}+{{x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {i} \right)}} \right)}}$$

$$4 \ m \ {\left( {x \left( {{i -1}} \right)} -{x \left( {{i -2}} \right)} \right)} \ {{{\left( {x \left( {i} \right)} -{x \left( {{i -1}} \right)} \right)}} ^{3}} \ {{{\left( {x \left( {{i+1}} \right)} -{x \left( {i} \right)} \right)}} ^{3}} \ {\left( {x \left( {{i+2}} \right)} -{x \left( {{i+1}} \right)} \right)}$$

We let the two particles to the left be infinity far away.

limit(limit(eval(eval(R(x,1),x(0)=b0),x(-1)=b1),b1=%minusInfinity),b0=%minusInfinity)


Compiling function sif with type (BasicOperator,PositiveInteger) -> Expression(Integer)

Compiling function sif with type (BasicOperator,Integer) -> Expression(Integer)

Compiling function sigma with type (BasicOperator,PositiveInteger) -> Expression(Integer)

Compiling function R with type (BasicOperator,PositiveInteger) -> Expression(Integer)

$${{\left( -{2 \ {x \left( {3} \right)}}+{3 \ {x \left( {2} \right)}} -{x \left( {1} \right)} \right)} \ {{hbar} ^{2}}} \over {{\left( {{\left( {4 \ {{{x \left( {2} \right)}} ^{3}}} -{{12} \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {x \left( {2} \right)}} -{4 \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {x \left( {3} \right)}} -{4 \ {{{x \left( {2} \right)}} ^{4}}}+{{12} \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{3}}} -{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {{{x \left( {2} \right)}} ^{2}}}+{4 \ {{{x \left( {1} \right)}} ^{3}} \ {x \left( {2} \right)}} \right)} \ m}$$

Similarly on the right.

limit(limit(eval(eval(R(x,N),x(N+1)=b0),x(N+2)=b1),b1=%plusInfinity),b0=%plusInfinity)


Compiling function sif with type (BasicOperator,Variable(N)) -> Expression(Integer)

Compiling function sigma with type (BasicOperator,Variable(N)) -> Expression(Integer)

Compiling function R with type (BasicOperator,Variable(N)) -> Expression(Integer)

$${-{{{hbar} ^{2}} \ {x \left( {N} \right)}}+{3 \ {{hbar} ^{2}} \ {x \left( {{N -1}} \right)}} -{2 \ {{hbar} ^{2}} \ {x \left( {{N -2}} \right)}}} \over {{{\left( {4 \ m \ {x \left( {{N -1}} \right)}} -{4 \ m \ {x \left( {{N -2}} \right)}} \right)} \ {{{x \left( {N} \right)}} ^{3}}}+{{\left( -{{12} \ m \ {{{x \left( {{N -1}} \right)}} ^{2}}}+{{12} \ m \ {x \left( {{N -2}} \right)} \ {x \left( {{N -1}} \right)}} \right)} \ {{{x \left( {N} \right)}} ^{2}}}+{{\left( {{12} \ m \ {{{x \left( {{N -1}} \right)}} ^{3}}} -{{12} \ m \ {x \left( {{N -2}} \right)} \ {{{x \left( {{N -1}} \right)}} ^{2}}} \right)} \ {x \left( {N} \right)}} -{4 \ m \ {{{x \left( {{N -1}} \right)}} ^{4}}}+{4 \ m \ {x \left( {{N -2}} \right)} \ {{{x \left( {{N -1}} \right)}} ^{3}}}}$$

Classical Force

c:=0; b:=1; F(x) == (x-c)/(a^3*%pi)*exp(-(x-c)^2/a^2)*b

F(x(i))


Compiling function F with type Expression(Integer) -> Expression(Integer)

$${{x \left( {i} \right)} \ {{e} ^{-{{{{x \left( {i} \right)}} ^{2}} \over {{a} ^{2}}}}}} \over {{{a} ^{3}} \ \pi}$$

FRx:=F(x(i))+R(x,i);

kernels FRx


$$\left[ {{e} ^{-{{{{x \left( {i} \right)}} ^{2}} \over {{a} ^{2}}}}}, : {x \left( {{i+2}} \right)}, : {x \left( {{i+1}} \right)}, : {x \left( {i} \right)}, : {x \left( {{i -1}} \right)}, : {x \left( {{i -2}} \right)}, : \pi, : m, : hbar, : a \right]$$

%sage
def fricas2octave(name,ex):
fr=fricas(ex).unparsed_input_form()
f =("function result=%s(x,i)\n"%name)
f+=("  global m hbar a;\n")
f+=("  result= ...\n")
i=0; cpl=80
while i<len(fr):
if i+cpl>=len(fr):
f+= "    "+fr[i:i+cpl]+";\n"
i=i+cpl
else:
line=fr[i:i+cpl]
p=line.rfind('*', 0, cpl)+1
if p==0:
p=line.rindex('+', 0, cpl)+1
f+= "    "+fr[i:i+p]+"...\n"
i=i+p
f+= "endfunction\n"
ff = open('%s.m'%name, 'w')
ff.write(f)
ff.close()
return f3


︠0e560dd3-ea55-4efa-9786-1bf7f0468a31s︠
FRx1:=eval(D(eval(FRx,x(i-2)=xm2),xm2),xm2=x(i-2));
factor numer FRx1 /factor denom FRx1


$$-{{{hbar} ^{2}} \over {4 \ m \ {{{\left( {x \left( {{i -1}} \right)} -{x \left( {{i -2}} \right)} \right)}} ^{2}} \ {{{\left( {x \left( {i} \right)} -{x \left( {{i -1}} \right)} \right)}} ^{2}}}}$$

%sage print fricas2octave('fr1','FRx1')

function result=fr3(x,i) global m hbar a; result= ... (((((-4*m*x(i -1)+4*m*x(i -2))*x(i)^6+(16*m*x(i -1)^2 -16*m*x(i -2)*x(i -1))*... x(i)^5+(-24*m*x(i -1)^3+24*m*x(i -2)*x(i -1)^2+2*a^2*m*x(i -1) -2*a^2*m*... x(i -2))*x(i)^4+(16*m*x(i -1)^4 -16*m*x(i -2)*x(i -1)^3 -8*a^2*m*x(i -1)^2+8*... -2)*x(i -1))*x(i)^3+(-4*m*x(i -1)^5+4*m*x(i -2)*x(i -1)^4+12*a^2*m*... x(i -1)^3 -12*a^2*m*x(i -2)*x(i -1)^2)*x(i)^2+(-8*a^2*m*x(i -1)^4+8*a^2*m*... x(i -2)*x(i -1)^3)*x(i)+(2*a^2*m*x(i -1)^5 -2*a^2*m*x(i -2)*x(i -1)^4))*... -16*m*x(i -2))*x(i)^7+(-64*m*x(i -1)^2+64*m*x(i -2)*... x(i -1))*x(i)^6+(96*m*x(i -1)^3 -96*m*x(i -2)*x(i -1)^2 -8*a^2*m*x(i -1)+8*a^2*... m*x(i -2))*x(i)^5+(-64*m*x(i -1)^4+64*m*x(i -2)*x(i -1)^3+32*a^2*m*... -1))*x(i)^4+(16*m*x(i -1)^5 -16*m*x(i -2)*... x(i -1)^4 -48*a^2*m*x(i -1)^3+48*a^2*m*x(i -2)*x(i -1)^2)*x(i)^3+(32*a^2*m*... x(i -1)^4 -32*a^2*m*x(i -2)*x(i -1)^3)*x(i)^2+(-8*a^2*m*x(i -1)^5+8*a^2*m*... -1)+24*m*x(i -2))*x(i)^8+(96*m*...)^3+((-24*m*x(i x(i -1)^2 -96*m*x(i -2)*x(i -1))*x(i)^7+(-144*m*x(i -1)^3+144*m*x(i -2)*... x(i -1)^2+12*a^2*m*x(i -1) -12*a^2*m*x(i -2))*x(i)^6+(96*m*x(i -1)^4 -96*m*... -1))*x(i)^5+(-24*m*...-48*a^2*m*x(i -1)^2+48*a^2*m*x(i -2)*x(i x(i -1)^5+24*m*x(i -2)*x(i -1)^4+72*a^2*m*x(i -1)^3 -72*a^2*m*x(i -2)*... x(i -1)^2)*x(i)^4+(-48*a^2*m*x(i -1)^4+48*a^2*m*x(i -2)*x(i -1)^3)*x(i)^3+(12*... a^2*m*x(i -1)^5 -12*a^2*m*x(i -2)*x(i -1)^4)*x(i)^2)*x(i+1)^2+((16*m*... -16*m*x(i -2))*x(i)^9+(-64*m*x(i -1)^2+64*m*x(i -2)*x(i -1))*... x(i)^8+(96*m*x(i -1)^3 -96*m*x(i -2)*x(i -1)^2 -8*a^2*m*x(i -1)+8*a^2*m*... x(i -2))*x(i)^7+(-64*m*x(i -1)^4+64*m*x(i -2)*x(i -1)^3+32*a^2*m*x(i -1)^2 -32*... -1))*x(i)^6+(16*m*x(i -1)^5 -16*m*x(i -2)*x(i -1)^4 -48*a^2*... m*x(i -1)^3+48*a^2*m*x(i -2)*x(i -1)^2)*x(i)^5+(32*a^2*m*x(i -1)^4 -32*a^2*m*... x(i -2)*x(i -1)^3)*x(i)^4+(-8*a^2*m*x(i -1)^5+8*a^2*m*x(i -2)*x(i -1)^4)*... -1)+4*m*x(i -2))*x(i)^10+(16*m*x(i -1)^2 -16*m*... x(i -2)*x(i -1))*x(i)^9+(-24*m*x(i -1)^3+24*m*x(i -2)*x(i -1)^2+2*a^2*m*... x(i -1) -2*a^2*m*x(i -2))*x(i)^8+(16*m*x(i -1)^4 -16*m*x(i -2)*x(i -1)^3 -8*a^2*... -1))*x(i)^7+(-4*m*x(i -1)^5+4*m*x(i -2)*... x(i -1)^4+12*a^2*m*x(i -1)^3 -12*a^2*m*x(i -2)*x(i -1)^2)*x(i)^6+(-8*a^2*m*... x(i -1)^4+8*a^2*m*x(i -2)*x(i -1)^3)*x(i)^5+(2*a^2*m*x(i -1)^5 -2*a^2*m*x(i -2)*... -2))*x(i)^6+(-16*m*...)*x(i+2)+(((4*m*x(i -1) -4*m*x(i x(i -1)^2+16*m*x(i -2)*x(i -1))*x(i)^5+(24*m*x(i -1)^3 -24*m*x(i -2)*... x(i -1)^2 -2*a^2*m*x(i -1)+2*a^2*m*x(i -2))*x(i)^4+(-16*m*x(i -1)^4+16*m*... x(i -2)*x(i -1)^3+8*a^2*m*x(i -1)^2 -8*a^2*m*x(i -2)*x(i -1))*x(i)^3+(4*m*... -4*m*x(i -2)*x(i -1)^4 -12*a^2*m*x(i -1)^3+12*a^2*m*x(i -2)*... x(i -1)^2)*x(i)^2+(8*a^2*m*x(i -1)^4 -8*a^2*m*x(i -2)*x(i -1)^3)*x(i)+(-2*a^2*m*... x(i -1)^5+2*a^2*m*x(i -2)*x(i -1)^4))*x(i+1)^5+((-16*m*x(i -1)+16*m*x(i -2))*... -64*m*x(i -2)*x(i -1))*x(i)^6+(-96*m*x(i -1)^3+96*m*... x(i -2)*x(i -1)^2+8*a^2*m*x(i -1) -8*a^2*m*x(i -2))*x(i)^5+(64*m*x(i -1)^4 -64*... m*x(i -2)*x(i -1)^3 -32*a^2*m*x(i -1)^2+32*a^2*m*x(i -2)*x(i -1))*x(i)^4+(-16*m*... -1)^4+48*a^2*m*x(i -1)^3 -48*a^2*m*x(i -2)*... x(i -1)^2)*x(i)^3+(-32*a^2*m*x(i -1)^4+32*a^2*m*x(i -2)*x(i -1)^3)*x(i)^2+(8*... a^2*m*x(i -1)^5 -8*a^2*m*x(i -2)*x(i -1)^4)*x(i))*x(i+1)^4+((24*m*x(i -1) -24*m*... -2)*x(i -1))*x(i)^7+(144*m*... -1)^2+96*m*x(i x(i -1)^3 -144*m*x(i -2)*x(i -1)^2 -12*a^2*m*x(i -1)+12*a^2*m*x(i -2))*... x(i)^6+(-96*m*x(i -1)^4+96*m*x(i -2)*x(i -1)^3+48*a^2*m*x(i -1)^2 -48*a^2*m*... -72*a^2*m*...(i -1))*x(i)^5+(24*m*x(i -1)^5 -24*m*x(i -2)*x(i -1)^4 x(i -1)^3+72*a^2*m*x(i -2)*x(i -1)^2)*x(i)^4+(48*a^2*m*x(i -1)^4 -48*a^2*m*... x(i -2)*x(i -1)^3)*x(i)^3+(-12*a^2*m*x(i -1)^5+12*a^2*m*x(i -2)*x(i -1)^4)*... x(i)^2)*x(i+1)^3+((-16*m*x(i -1)+16*m*x(i -2))*x(i)^9+(64*m*x(i -1)^2 -64*m*... -2)*x(i -1))*x(i)^8+(-96*m*x(i -1)^3+96*m*x(i -2)*x(i -1)^2+8*a^2*m*... x(i -1) -8*a^2*m*x(i -2))*x(i)^7+(64*m*x(i -1)^4 -64*m*x(i -2)*x(i -1)^3 -32*... a^2*m*x(i -1)^2+32*a^2*m*x(i -2)*x(i -1))*x(i)^6+(-16*m*x(i -1)^5+16*m*x(i -2)*... -1)^4+48*a^2*m*x(i -1)^3 -48*a^2*m*x(i -2)*x(i -1)^2)*x(i)^5+(-32*a^2*m*... x(i -1)^4+32*a^2*m*x(i -2)*x(i -1)^3)*x(i)^4+(8*a^2*m*x(i -1)^5 -8*a^2*m*... x(i -2)*x(i -1)^4)*x(i)^3)*x(i+1)^2+((4*m*x(i -1) -4*m*x(i -2))*x(i)^10+(-16*m*... -2)*x(i -1))*x(i)^9+(24*m*x(i -1)^3 -24*m*x(i -2)*... x(i -1)^2 -2*a^2*m*x(i -1)+2*a^2*m*x(i -2))*x(i)^8+(-16*m*x(i -1)^4+16*m*... x(i -2)*x(i -1)^3+8*a^2*m*x(i -1)^2 -8*a^2*m*x(i -2)*x(i -1))*x(i)^7+(4*m*... -1)^3+12*a^2*m*x(i -2)*...*x(i -1)^4 -12*a^2*m*x(i x(i -1)^2)*x(i)^6+(8*a^2*m*x(i -1)^4 -8*a^2*m*x(i -2)*x(i -1)^3)*x(i)^5+(-2*a^2*... m*x(i -1)^5+2*a^2*m*x(i -2)*x(i -1)^4)*x(i)^4)*x(i+1)))*exp((-1*... -1)+3*a^5*...a^2))+(((a^5*hbar^2*pi()*x(i)+(-4*a^5*hbar^2*pi()*x(i hbar^2*pi()*x(i -2)))*x(i+1)^4+(-4*a^5*hbar^2*pi()*x(i)^2+(17*a^5*hbar^2*pi()*... x(i -1) -13*a^5*hbar^2*pi()*x(i -2))*x(i)+(-1*a^5*hbar^2*pi()*x(i -1)^2+a^5*... -1)))*x(i+1)^3+(6*a^5*hbar^2*pi()*x(i)^3+(-28*a^5*... hbar^2*pi()*x(i -1)+22*a^5*hbar^2*pi()*x(i -2))*x(i)^2+(5*a^5*hbar^2*pi()*... x(i -1)^2 -5*a^5*hbar^2*pi()*x(i -2)*x(i -1))*x(i)+(-1*a^5*hbar^2*pi()*... -1)^2))*x(i+1)^2+(-4*a^5*hbar^2*pi()*...i x(i)^4+(22*a^5*hbar^2*pi()*x(i -1) -18*a^5*hbar^2*pi()*x(i -2))*x(i)^3+(-10*a^5*... hbar^2*pi()*x(i -1)^2+10*a^5*hbar^2*pi()*x(i -2)*x(i -1))*x(i)^2+(5*a^5*hbar^2*... -1)^2)*x(i)+(-1*a^5*hbar^2*pi()*...()*x(i -2)*x(i x(i -1)^4+a^5*hbar^2*pi()*x(i -2)*x(i -1)^3))*x(i+1)+(a^5*hbar^2*pi()*... x(i)^5+(-10*a^5*hbar^2*pi()*x(i -1)+9*a^5*hbar^2*pi()*x(i -2))*x(i)^4+(18*a^5*... -1))*x(i)^3+(-22*a^5*...2 -18*a^5*hbar^2*pi()*x(i -2)*x(i hbar^2*pi()*x(i -1)^3+22*a^5*hbar^2*pi()*x(i -2)*x(i -1)^2)*x(i)^2+(13*a^5*... hbar^2*pi()*x(i -1)^4 -13*a^5*hbar^2*pi()*x(i -2)*x(i -1)^3)*x(i)+(-3*a^5*... -1)^4)))*x(i+2)+((-1*a^5*...a^5*hbar^2*pi()*x(i -2)*x(i hbar^2*pi()*x(i)+(4*a^5*hbar^2*pi()*x(i -1) -3*a^5*hbar^2*pi()*x(i -2)))*... x(i+1)^5+(4*a^5*hbar^2*pi()*x(i)^2+(-17*a^5*hbar^2*pi()*x(i -1)+13*a^5*hbar^2*... -2)*...)*x(i -2))*x(i)+(a^5*hbar^2*pi()*x(i -1)^2 -1*a^5*hbar^2*pi()*x(i x(i -1)))*x(i+1)^4+(-6*a^5*hbar^2*pi()*x(i)^3+(28*a^5*hbar^2*pi()*x(i -1) -22*... a^5*hbar^2*pi()*x(i -2))*x(i)^2+(-5*a^5*hbar^2*pi()*x(i -1)^2+5*a^5*hbar^2*pi()*... x(i -2)*x(i -1))*x(i)+(a^5*hbar^2*pi()*x(i -1)^3 -1*a^5*hbar^2*pi()*x(i -2)*... -1)^2))*x(i+1)^3+(4*a^5*hbar^2*pi()*x(i)^4+(-22*a^5*hbar^2*pi()*x(i -1)+18*... a^5*hbar^2*pi()*x(i -2))*x(i)^3+(10*a^5*hbar^2*pi()*x(i -1)^2 -10*a^5*hbar^2*... pi()*x(i -2)*x(i -1))*x(i)^2+(-5*a^5*hbar^2*pi()*x(i -1)^3+5*a^5*hbar^2*pi()*... -1)^2)*x(i)+(a^5*hbar^2*pi()*x(i -1)^4 -1*a^5*hbar^2*pi()*x(i -2)*... x(i -1)^3))*x(i+1)^2+(-1*a^5*hbar^2*pi()*x(i)^5+(11*a^5*hbar^2*pi()*x(i -1) -10*... a^5*hbar^2*pi()*x(i -2))*x(i)^4+(-22*a^5*hbar^2*pi()*x(i -1)^2+22*a^5*hbar^2*... -1))*x(i)^3+(28*a^5*hbar^2*pi()*x(i -1)^3 -28*a^5*hbar^2*pi()*... x(i -2)*x(i -1)^2)*x(i)^2+(-17*a^5*hbar^2*pi()*x(i -1)^4+17*a^5*hbar^2*pi()*... x(i -2)*x(i -1)^3)*x(i)+(4*a^5*hbar^2*pi()*x(i -1)^5 -4*a^5*hbar^2*pi()*x(i -2)*... -1)^4))*x(i+1)+((-1*a^5*hbar^2*pi()*x(i -1)+a^5*hbar^2*pi()*x(i -2))*... x(i)^5+(4*a^5*hbar^2*pi()*x(i -1)^2 -4*a^5*hbar^2*pi()*x(i -2)*x(i -1))*... x(i)^4+(-6*a^5*hbar^2*pi()*x(i -1)^3+6*a^5*hbar^2*pi()*x(i -2)*x(i -1)^2)*... -1)^4 -4*a^5*hbar^2*pi()*x(i -2)*x(i -1)^3)*... x(i)^2+(-1*a^5*hbar^2*pi()*x(i -1)^5+a^5*hbar^2*pi()*x(i -2)*x(i -1)^4)*... x(i)))))/((((2*a^5*m*pi()*x(i -1) -2*a^5*m*pi()*x(i -2))*x(i)^4+(-8*a^5*m*pi()*... -1))*x(i)^3+(12*a^5*m*pi()*x(i -1)^3 -12*... a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^2+(-8*a^5*m*pi()*x(i -1)^4+8*a^5*m*pi()*... x(i -2)*x(i -1)^3)*x(i)+(2*a^5*m*pi()*x(i -1)^5 -2*a^5*m*pi()*x(i -2)*... -1)+8*a^5*m*pi()*x(i -2))*x(i)^5+(32*...*x(i a^5*m*pi()*x(i -1)^2 -32*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^4+(-48*a^5*m*pi()*... x(i -1)^3+48*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^3+(32*a^5*m*pi()*x(i -1)^4 -32*... -1)^3)*x(i)^2+(-8*a^5*m*pi()*x(i -1)^5+8*a^5*m*pi()*... x(i -2)*x(i -1)^4)*x(i))*x(i+1)^3+((12*a^5*m*pi()*x(i -1) -12*a^5*m*pi()*... x(i -2))*x(i)^6+(-48*a^5*m*pi()*x(i -1)^2+48*a^5*m*pi()*x(i -2)*x(i -1))*... -72*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^4+(-48*... a^5*m*pi()*x(i -1)^4+48*a^5*m*pi()*x(i -2)*x(i -1)^3)*x(i)^3+(12*a^5*m*pi()*... x(i -1)^5 -12*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^2)*x(i+1)^2+((-8*a^5*m*pi()*... -2))*x(i)^7+(32*a^5*m*pi()*x(i -1)^2 -32*a^5*m*pi()*... x(i -2)*x(i -1))*x(i)^6+(-48*a^5*m*pi()*x(i -1)^3+48*a^5*m*pi()*x(i -2)*... x(i -1)^2)*x(i)^5+(32*a^5*m*pi()*x(i -1)^4 -32*a^5*m*pi()*x(i -2)*x(i -1)^3)*... -1)^5+8*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^3)*... x(i+1)+((2*a^5*m*pi()*x(i -1) -2*a^5*m*pi()*x(i -2))*x(i)^8+(-8*a^5*m*pi()*... x(i -1)^2+8*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^7+(12*a^5*m*pi()*x(i -1)^3 -12*a^5*... -1)^2)*x(i)^6+(-8*a^5*m*pi()*x(i -1)^4+8*a^5*m*pi()*x(i -2)*... x(i -1)^3)*x(i)^5+(2*a^5*m*pi()*x(i -1)^5 -2*a^5*m*pi()*x(i -2)*x(i -1)^4)*... x(i)^4))*x(i+2)+(((-2*a^5*m*pi()*x(i -1)+2*a^5*m*pi()*x(i -2))*x(i)^4+(8*a^5*m*... -8*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^3+(-12*a^5*m*pi()*... x(i -1)^3+12*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^2+(8*a^5*m*pi()*x(i -1)^4 -8*... a^5*m*pi()*x(i -2)*x(i -1)^3)*x(i)+(-2*a^5*m*pi()*x(i -1)^5+2*a^5*m*pi()*... -1)^4))*x(i+1)^5+((8*a^5*m*pi()*x(i -1) -8*a^5*m*pi()*x(i -2))*... x(i)^5+(-32*a^5*m*pi()*x(i -1)^2+32*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^4+(48*a^5*... m*pi()*x(i -1)^3 -48*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^3+(-32*a^5*m*pi()*... -2)*x(i -1)^3)*x(i)^2+(8*a^5*m*pi()*x(i -1)^5 -8*... a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i))*x(i+1)^4+((-12*a^5*m*pi()*x(i -1)+12*a^5*m*... pi()*x(i -2))*x(i)^6+(48*a^5*m*pi()*x(i -1)^2 -48*a^5*m*pi()*x(i -2)*x(i -1))*... -1)^3+72*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^4+(48*... a^5*m*pi()*x(i -1)^4 -48*a^5*m*pi()*x(i -2)*x(i -1)^3)*x(i)^3+(-12*a^5*m*pi()*... x(i -1)^5+12*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^2)*x(i+1)^3+((8*a^5*m*pi()*... -2))*x(i)^7+(-32*a^5*m*pi()*x(i -1)^2+32*a^5*m*pi()*... x(i -2)*x(i -1))*x(i)^6+(48*a^5*m*pi()*x(i -1)^3 -48*a^5*m*pi()*x(i -2)*... x(i -1)^2)*x(i)^5+(-32*a^5*m*pi()*x(i -1)^4+32*a^5*m*pi()*x(i -2)*x(i -1)^3)*... -8*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^3)*... x(i+1)^2+((-2*a^5*m*pi()*x(i -1)+2*a^5*m*pi()*x(i -2))*x(i)^8+(8*a^5*m*pi()*... x(i -1)^2 -8*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^7+(-12*a^5*m*pi()*x(i -1)^3+12*... -1)^2)*x(i)^6+(8*a^5*m*pi()*x(i -1)^4 -8*a^5*m*pi()*... x(i -2)*x(i -1)^3)*x(i)^5+(-2*a^5*m*pi()*x(i -1)^5+2*a^5*m*pi()*x(i -2)*... x(i -1)^4)*x(i)^4)*x(i+1))); endfunction 
%sage
fr1=fricas('FRx1').unparsed_input_form()
f1 =("function result=fr1(x,i)\n")
f1+=("  global m hbar;\n")
f1+=("  result= ...\n")
i=0; cpl=80
while i<len(fr1):
if i+cpl>=len(fr1):
f1+= fr1[i:i+cpl]+";\n"
i=i+cpl
else:
line=fr1[i:i+cpl]
p=line.rfind('+', 0, cpl)+1
f1+= fr1[i:i+p]+"...\n"
i=i+p
f1+= "endfunction\n"
ff = open('fr1.m', 'w')
ff.write(f1)
ff.close()
print f1

function result=fr1(x,i) global m hbar; result= ... (-1*hbar^2)/((4*m*x(i -1)^2 -8*m*x(i -2)*x(i -1)+4*m*x(i -2)^2)*x(i)^2+... (-8*m*x(i -1)^3+16*m*x(i -2)*x(i -1)^2 -8*m*x(i -2)^2*x(i -1))*x(i)+... (4*m*x(i -1)^4 -8*m*x(i -2)*x(i -1)^3+4*m*x(i -2)^2*x(i -1)^2)); endfunction
%octave
clear all
global m;
global hbar;
global a;

%octave
m = 1;
hbar = 1;
a = 1;

%octave
F1=fr1([1;2;3;4;5],3)

F1 = -0.25
FRx2:=eval(D(eval(FRx,x(i-1)=xm1),xm1),xm1=x(i-1));
factor numer FRx2/factor denom FRx2


$${{{hbar} ^{2}} \ {\left( {{\left( {{{x \left( {i} \right)}} ^{2}}+{{\left( -{4 \ {x \left( {{i -1}} \right)}}+{2 \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {i} \right)}}+{9 \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{14} \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}}+{6 \ {{{x \left( {{i -2}} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( -{2 \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {8 \ {x \left( {{i -1}} \right)}} -{4 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{{20} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{32} \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} -{{14} \ {{{x \left( {{i -2}} \right)}} ^{2}}} \right)} \ {x \left( {i} \right)}}+{2 \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{4 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{2 \ {{{x \left( {{i -2}} \right)}} ^{2}} \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {{i+1}} \right)}}+{{{x \left( {i} \right)}} ^{4}}+{{\left( -{4 \ {x \left( {{i -1}} \right)}}+{2 \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{20} \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}}+{9 \ {{{x \left( {{i -2}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{4 \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{8 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{4 \ {{{x \left( {{i -2}} \right)}} ^{2}} \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {i} \right)}}+{{{x \left( {{i -1}} \right)}} ^{4}} -{2 \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{{{x \left( {{i -2}} \right)}} ^{2}} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)}} \over {4 \ m \ {{{\left( {x \left( {{i -1}} \right)} -{x \left( {{i -2}} \right)} \right)}} ^{2}} \ {{{\left( {x \left( {i} \right)} -{x \left( {{i -1}} \right)} \right)}} ^{4}} \ {{{\left( {x \left( {{i+1}} \right)} -{x \left( {i} \right)} \right)}} ^{2}}}$$

%sage
fr2=fricas('FRx2').unparsed_input_form()
f2 =("function result=fr2(x,i)\n")
f2+=("  global m hbar;\n")
f2+=("  result= ...\n")
i=0; cpl=80
while i<len(fr2):
if i+cpl>=len(fr2):
f2+= fr2[i:i+cpl]+";\n"
i=i+cpl
else:
line=fr2[i:i+cpl]
p=line.rfind('+', 0, cpl)+1
f2+= fr2[i:i+p]+"...\n"
i=i+p
f2+= "endfunction\n"
ff = open('fr2.m', 'w')
ff.write(f2)
ff.close()
print f2

function result=fr2(x,i) global m hbar; result= ... ((hbar^2*x(i)^2+(-4*hbar^2*x(i -1)+2*hbar^2*x(i -2))*x(i)+... (9*hbar^2*x(i -1)^2 -14*hbar^2*x(i -2)*x(i -1)+6*hbar^2*x(i -2)^2))*x(i+1)^2+... (-2*hbar^2*x(i)^3+(8*hbar^2*x(i -1) -4*hbar^2*x(i -2))*x(i)^2+... -2)*x(i -1) -14*hbar^2*x(i -2)^2)*x(i)+... (2*hbar^2*x(i -1)^3 -4*hbar^2*x(i -2)*x(i -1)^2+... 2*hbar^2*x(i -2)^2*x(i -1)))*x(i+1)+(hbar^2*x(i)^4+(-4*hbar^2*x(i -1)+... 2*hbar^2*x(i -2))*x(i)^3+(12*hbar^2*x(i -1)^2 -20*hbar^2*x(i -2)*x(i -1)+... -2)^2)*x(i)^2+(-4*hbar^2*x(i -1)^3+... 8*hbar^2*x(i -2)*x(i -1)^2 -4*hbar^2*x(i -2)^2*x(i -1))*x(i)+... (hbar^2*x(i -1)^4 -2*hbar^2*x(i -2)*x(i -1)^3+... hbar^2*x(i -2)^2*x(i -1)^2)))/(((4*m*x(i -1)^2 -8*m*x(i -2)*x(i -1)+... -1)^3+...2)^2)*x(i)^4+(-16*m*x(i 32*m*x(i -2)*x(i -1)^2 -16*m*x(i -2)^2*x(i -1))*x(i)^3+... (24*m*x(i -1)^4 -48*m*x(i -2)*x(i -1)^3+24*m*x(i -2)^2*x(i -1)^2)*x(i)^2+... (-16*m*x(i -1)^5+32*m*x(i -2)*x(i -1)^4 -16*m*x(i -2)^2*x(i -1)^3)*x(i)+... -1)^5+4*m*x(i -2)^2*x(i -1)^4))*x(i+1)^2+... ((-8*m*x(i -1)^2+16*m*x(i -2)*x(i -1) -8*m*x(i -2)^2)*x(i)^5+... (32*m*x(i -1)^3 -64*m*x(i -2)*x(i -1)^2+32*m*x(i -2)^2*x(i -1))*x(i)^4+... -1)^2)*x(i)^3+...96*m*x(i -2)*x(i -1)^3 -48*m*x(i -2)^2*x(i (32*m*x(i -1)^5 -64*m*x(i -2)*x(i -1)^4+32*m*x(i -2)^2*x(i -1)^3)*x(i)^2+... (-8*m*x(i -1)^6+16*m*x(i -2)*x(i -1)^5 -8*m*x(i -2)^2*x(i -1)^4)*x(i))*x(i+1)+... -1)^3+... -1)^2 -8*m*x(i -2)*x(i -1)+4*m*x(i -2)^2)*x(i)^6+(-16*m*x(i 32*m*x(i -2)*x(i -1)^2 -16*m*x(i -2)^2*x(i -1))*x(i)^5+... (24*m*x(i -1)^4 -48*m*x(i -2)*x(i -1)^3+24*m*x(i -2)^2*x(i -1)^2)*x(i)^4+... (-16*m*x(i -1)^5+32*m*x(i -2)*x(i -1)^4 -16*m*x(i -2)^2*x(i -1)^3)*x(i)^3+... -1)^5+4*m*x(i -2)^2*x(i -1)^4)*x(i)^2)); endfunction 
%octave
F2=fr2([1;2;3;4;5],3)

F2 = 1


FRx3:=eval(D(eval(FRx,x(i)=x1),x1),x1=x(i));

factor numer FRx3


$$-{\left( {{\left( {{\left( {{\left( {{\left( {4 \ m \ {x \left( {{i -1}} \right)}} -{4 \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( -{{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{16} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( {{24} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{24} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{2 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}}+{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {4 \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{4 \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{12} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {i} \right)}} -{2 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{4}}}+{{\left( {{\left( -{{16} \ m \ {x \left( {{i -1}} \right)}}+{{16} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( {{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{64} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( -{{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{96} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( {{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{64} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {x \left( {i} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( {{\left( {{24} \ m \ {x \left( {{i -1}} \right)}} -{{24} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{8}}}+{{\left( -{{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{96} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( {{144} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{144} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}}+{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( -{{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{96} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( {{24} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{{24} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{72} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{72} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{{12} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( {{\left( -{{16} \ m \ {x \left( {{i -1}} \right)}}+{{16} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{9}}}+{{\left( {{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{64} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{8}}}+{{\left( -{{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{96} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( {{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{64} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( -{{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}} \right)} \ {x \left( {{i+1}} \right)}}+{{\left( {4 \ m \ {x \left( {{i -1}} \right)}} -{4 \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{{10}}}}+{{\left( -{{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{16} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{9}}}+{{\left( {{24} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{24} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{2 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}}+{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{8}}}+{{\left( -{{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( {4 \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{4 \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{12} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( {8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{2 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {i} \right)}} ^{4}}} \right)} \ {x \left( {{i+2}} \right)}}+{{\left( {{\left( -{4 \ m \ {x \left( {{i -1}} \right)}}+{4 \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( {{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{16} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{{24} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{24} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{2 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}} -{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{4 \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{4 \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{12} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {i} \right)}}+{2 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{5}}}+{{\left( {{\left( {{16} \ m \ {x \left( {{i -1}} \right)}} -{{16} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( -{{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{64} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( {{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{96} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{64} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {x \left( {i} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{4}}}+{{\left( {{\left( -{{24} \ m \ {x \left( {{i -1}} \right)}}+{{24} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{8}}}+{{\left( {{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{96} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( -{{144} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{144} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}} -{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( {{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{96} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{{24} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{{24} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{72} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{72} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{12} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( {{\left( {{16} \ m \ {x \left( {{i -1}} \right)}} -{{16} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{9}}}+{{\left( -{{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{64} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{8}}}+{{\left( {{96} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{96} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{8 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( -{{64} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{64} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( {{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{48} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{48} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( {{32} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{32} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( {{\left( -{4 \ m \ {x \left( {{i -1}} \right)}}+{4 \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{{10}}}}+{{\left( {{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{16} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{9}}}+{{\left( -{{24} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{24} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{2 \ {{a} ^{2}} \ m \ {x \left( {{i -1}} \right)}} -{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{8}}}+{{\left( {{16} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{16} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{7}}}+{{\left( -{4 \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{4 \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{12} \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{12} \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{6}}}+{{\left( -{8 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{8 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( {2 \ {{a} ^{2}} \ m \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{2 \ {{a} ^{2}} \ m \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {{{x \left( {i} \right)}} ^{4}}} \right)} \ {x \left( {{i+1}} \right)}} \right)} \ {{e} ^{-{{{{x \left( {i} \right)}} ^{2}} \over {{a} ^{2}}}}}}+{{\left( {{\left( -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {i} \right)}}+{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}} -{3 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{4}}}+{{\left( {4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{{17} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}}+{{13} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {i} \right)}}+{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( -{6 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{28} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}} -{{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {i} \right)}}+{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( {4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}}+{{18} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{10} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{10} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {x \left( {i} \right)}}+{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {{i+1}} \right)}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( {{10} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}} -{9 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( -{{18} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{18} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( {{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( -{{13} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{13} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {i} \right)}}+{3 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{3 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {x \left( {{i+2}} \right)}}+{{\left( {{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {i} \right)}} -{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}}+{3 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{5}}}+{{\left( -{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {{17} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}} -{{13} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {x \left( {i} \right)}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{4}}}+{{\left( {6 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{{28} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}}+{{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {i} \right)}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( -{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}} -{{18} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{{10} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{{10} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{5 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {x \left( {i} \right)}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( {{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{{11} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}}+{{10} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}} -{{22} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{{28} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}}+{{28} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {{17} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{4}}} -{{17} \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {x \left( {i} \right)}} -{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{5}}}+{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {x \left( {{i+1}} \right)}}+{{\left( {{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -1}} \right)}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{5}}}+{{\left( -{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{2}}}+{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {i} \right)}} ^{4}}}+{{\left( {6 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{3}}} -{6 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{\left( -{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{4}}}+{4 \ {{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{3}}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{{\left( {{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {{{x \left( {{i -1}} \right)}} ^{5}}} -{{{a} ^{5}} \ {{hbar} ^{2}} \ \pi \ {x \left( {{i -2}} \right)} \ {{{x \left( {{i -1}} \right)}} ^{4}}} \right)} \ {x \left( {i} \right)}} \right)}$$

factor denom FRx3


$$2 \ {{a} ^{5}} \ m \ \pi \ {\left( {x \left( {{i -1}} \right)} -{x \left( {{i -2}} \right)} \right)} \ {{{\left( {x \left( {i} \right)} -{x \left( {{i -1}} \right)} \right)}} ^{4}} \ {{{\left( {x \left( {{i+1}} \right)} -{x \left( {i} \right)} \right)}} ^{4}} \ {\left( {x \left( {{i+2}} \right)} -{x \left( {{i+1}} \right)} \right)}$$

%sage
def fricas2octave(name,ex)
fr=fricas(ex).unparsed_input_form()
f =("function result=%s(x,i)\n"%name)
f+=("  global m hbar a;\n")
f+=("  result= ...\n")
i=0; cpl=80
while i<len(fr):
if i+cpl>=len(fr):
f+= "    "+fr[i:i+cpl]+";\n"
i=i+cpl
else:
line=fr[i:i+cpl]
p=line.rfind('*', 0, cpl)+1
if p==0:
p=line.rindex('+', 0, cpl)+1
f+= "    "+fr[i:i+p]+"...\n"
i=i+p
f+= "endfunction\n"
ff = open('%s.m'%name, 'w')
ff.write(f)
ff.close()
return f3
︠f8fc4d51-c1d3-439f-8b78-5069d5034e0ds︠
%sage print fricas2octave('fr3','FR')

function result=fr3(x,i) global m hbar a; result= ... (((((-4*m*x(i -1)+4*m*x(i -2))*x(i)^6+(16*m*x(i -1)^2 -16*m*x(i -2)*x(i -1))*... x(i)^5+(-24*m*x(i -1)^3+24*m*x(i -2)*x(i -1)^2+2*a^2*m*x(i -1) -2*a^2*m*... x(i -2))*x(i)^4+(16*m*x(i -1)^4 -16*m*x(i -2)*x(i -1)^3 -8*a^2*m*x(i -1)^2+8*... -2)*x(i -1))*x(i)^3+(-4*m*x(i -1)^5+4*m*x(i -2)*x(i -1)^4+12*a^2*m*... x(i -1)^3 -12*a^2*m*x(i -2)*x(i -1)^2)*x(i)^2+(-8*a^2*m*x(i -1)^4+8*a^2*m*... x(i -2)*x(i -1)^3)*x(i)+(2*a^2*m*x(i -1)^5 -2*a^2*m*x(i -2)*x(i -1)^4))*... -16*m*x(i -2))*x(i)^7+(-64*m*x(i -1)^2+64*m*x(i -2)*... x(i -1))*x(i)^6+(96*m*x(i -1)^3 -96*m*x(i -2)*x(i -1)^2 -8*a^2*m*x(i -1)+8*a^2*... m*x(i -2))*x(i)^5+(-64*m*x(i -1)^4+64*m*x(i -2)*x(i -1)^3+32*a^2*m*... -1))*x(i)^4+(16*m*x(i -1)^5 -16*m*x(i -2)*... x(i -1)^4 -48*a^2*m*x(i -1)^3+48*a^2*m*x(i -2)*x(i -1)^2)*x(i)^3+(32*a^2*m*... x(i -1)^4 -32*a^2*m*x(i -2)*x(i -1)^3)*x(i)^2+(-8*a^2*m*x(i -1)^5+8*a^2*m*... -1)+24*m*x(i -2))*x(i)^8+(96*m*...)^3+((-24*m*x(i x(i -1)^2 -96*m*x(i -2)*x(i -1))*x(i)^7+(-144*m*x(i -1)^3+144*m*x(i -2)*... x(i -1)^2+12*a^2*m*x(i -1) -12*a^2*m*x(i -2))*x(i)^6+(96*m*x(i -1)^4 -96*m*... -1))*x(i)^5+(-24*m*...-48*a^2*m*x(i -1)^2+48*a^2*m*x(i -2)*x(i x(i -1)^5+24*m*x(i -2)*x(i -1)^4+72*a^2*m*x(i -1)^3 -72*a^2*m*x(i -2)*... x(i -1)^2)*x(i)^4+(-48*a^2*m*x(i -1)^4+48*a^2*m*x(i -2)*x(i -1)^3)*x(i)^3+(12*... a^2*m*x(i -1)^5 -12*a^2*m*x(i -2)*x(i -1)^4)*x(i)^2)*x(i+1)^2+((16*m*... -16*m*x(i -2))*x(i)^9+(-64*m*x(i -1)^2+64*m*x(i -2)*x(i -1))*... x(i)^8+(96*m*x(i -1)^3 -96*m*x(i -2)*x(i -1)^2 -8*a^2*m*x(i -1)+8*a^2*m*... x(i -2))*x(i)^7+(-64*m*x(i -1)^4+64*m*x(i -2)*x(i -1)^3+32*a^2*m*x(i -1)^2 -32*... -1))*x(i)^6+(16*m*x(i -1)^5 -16*m*x(i -2)*x(i -1)^4 -48*a^2*... m*x(i -1)^3+48*a^2*m*x(i -2)*x(i -1)^2)*x(i)^5+(32*a^2*m*x(i -1)^4 -32*a^2*m*... x(i -2)*x(i -1)^3)*x(i)^4+(-8*a^2*m*x(i -1)^5+8*a^2*m*x(i -2)*x(i -1)^4)*... -1)+4*m*x(i -2))*x(i)^10+(16*m*x(i -1)^2 -16*m*... x(i -2)*x(i -1))*x(i)^9+(-24*m*x(i -1)^3+24*m*x(i -2)*x(i -1)^2+2*a^2*m*... x(i -1) -2*a^2*m*x(i -2))*x(i)^8+(16*m*x(i -1)^4 -16*m*x(i -2)*x(i -1)^3 -8*a^2*... -1))*x(i)^7+(-4*m*x(i -1)^5+4*m*x(i -2)*... x(i -1)^4+12*a^2*m*x(i -1)^3 -12*a^2*m*x(i -2)*x(i -1)^2)*x(i)^6+(-8*a^2*m*... x(i -1)^4+8*a^2*m*x(i -2)*x(i -1)^3)*x(i)^5+(2*a^2*m*x(i -1)^5 -2*a^2*m*x(i -2)*... -2))*x(i)^6+(-16*m*...)*x(i+2)+(((4*m*x(i -1) -4*m*x(i x(i -1)^2+16*m*x(i -2)*x(i -1))*x(i)^5+(24*m*x(i -1)^3 -24*m*x(i -2)*... x(i -1)^2 -2*a^2*m*x(i -1)+2*a^2*m*x(i -2))*x(i)^4+(-16*m*x(i -1)^4+16*m*... x(i -2)*x(i -1)^3+8*a^2*m*x(i -1)^2 -8*a^2*m*x(i -2)*x(i -1))*x(i)^3+(4*m*... -4*m*x(i -2)*x(i -1)^4 -12*a^2*m*x(i -1)^3+12*a^2*m*x(i -2)*... x(i -1)^2)*x(i)^2+(8*a^2*m*x(i -1)^4 -8*a^2*m*x(i -2)*x(i -1)^3)*x(i)+(-2*a^2*m*... x(i -1)^5+2*a^2*m*x(i -2)*x(i -1)^4))*x(i+1)^5+((-16*m*x(i -1)+16*m*x(i -2))*... -64*m*x(i -2)*x(i -1))*x(i)^6+(-96*m*x(i -1)^3+96*m*... x(i -2)*x(i -1)^2+8*a^2*m*x(i -1) -8*a^2*m*x(i -2))*x(i)^5+(64*m*x(i -1)^4 -64*... m*x(i -2)*x(i -1)^3 -32*a^2*m*x(i -1)^2+32*a^2*m*x(i -2)*x(i -1))*x(i)^4+(-16*m*... -1)^4+48*a^2*m*x(i -1)^3 -48*a^2*m*x(i -2)*... x(i -1)^2)*x(i)^3+(-32*a^2*m*x(i -1)^4+32*a^2*m*x(i -2)*x(i -1)^3)*x(i)^2+(8*... a^2*m*x(i -1)^5 -8*a^2*m*x(i -2)*x(i -1)^4)*x(i))*x(i+1)^4+((24*m*x(i -1) -24*m*... -2)*x(i -1))*x(i)^7+(144*m*... -1)^2+96*m*x(i x(i -1)^3 -144*m*x(i -2)*x(i -1)^2 -12*a^2*m*x(i -1)+12*a^2*m*x(i -2))*... x(i)^6+(-96*m*x(i -1)^4+96*m*x(i -2)*x(i -1)^3+48*a^2*m*x(i -1)^2 -48*a^2*m*... -72*a^2*m*...(i -1))*x(i)^5+(24*m*x(i -1)^5 -24*m*x(i -2)*x(i -1)^4 x(i -1)^3+72*a^2*m*x(i -2)*x(i -1)^2)*x(i)^4+(48*a^2*m*x(i -1)^4 -48*a^2*m*... x(i -2)*x(i -1)^3)*x(i)^3+(-12*a^2*m*x(i -1)^5+12*a^2*m*x(i -2)*x(i -1)^4)*... x(i)^2)*x(i+1)^3+((-16*m*x(i -1)+16*m*x(i -2))*x(i)^9+(64*m*x(i -1)^2 -64*m*... -2)*x(i -1))*x(i)^8+(-96*m*x(i -1)^3+96*m*x(i -2)*x(i -1)^2+8*a^2*m*... x(i -1) -8*a^2*m*x(i -2))*x(i)^7+(64*m*x(i -1)^4 -64*m*x(i -2)*x(i -1)^3 -32*... a^2*m*x(i -1)^2+32*a^2*m*x(i -2)*x(i -1))*x(i)^6+(-16*m*x(i -1)^5+16*m*x(i -2)*... -1)^4+48*a^2*m*x(i -1)^3 -48*a^2*m*x(i -2)*x(i -1)^2)*x(i)^5+(-32*a^2*m*... x(i -1)^4+32*a^2*m*x(i -2)*x(i -1)^3)*x(i)^4+(8*a^2*m*x(i -1)^5 -8*a^2*m*... x(i -2)*x(i -1)^4)*x(i)^3)*x(i+1)^2+((4*m*x(i -1) -4*m*x(i -2))*x(i)^10+(-16*m*... -2)*x(i -1))*x(i)^9+(24*m*x(i -1)^3 -24*m*x(i -2)*... x(i -1)^2 -2*a^2*m*x(i -1)+2*a^2*m*x(i -2))*x(i)^8+(-16*m*x(i -1)^4+16*m*... x(i -2)*x(i -1)^3+8*a^2*m*x(i -1)^2 -8*a^2*m*x(i -2)*x(i -1))*x(i)^7+(4*m*... -1)^3+12*a^2*m*x(i -2)*...*x(i -1)^4 -12*a^2*m*x(i x(i -1)^2)*x(i)^6+(8*a^2*m*x(i -1)^4 -8*a^2*m*x(i -2)*x(i -1)^3)*x(i)^5+(-2*a^2*... m*x(i -1)^5+2*a^2*m*x(i -2)*x(i -1)^4)*x(i)^4)*x(i+1)))*exp((-1*... -1)+3*a^5*...a^2))+(((a^5*hbar^2*pi()*x(i)+(-4*a^5*hbar^2*pi()*x(i hbar^2*pi()*x(i -2)))*x(i+1)^4+(-4*a^5*hbar^2*pi()*x(i)^2+(17*a^5*hbar^2*pi()*... x(i -1) -13*a^5*hbar^2*pi()*x(i -2))*x(i)+(-1*a^5*hbar^2*pi()*x(i -1)^2+a^5*... -1)))*x(i+1)^3+(6*a^5*hbar^2*pi()*x(i)^3+(-28*a^5*... hbar^2*pi()*x(i -1)+22*a^5*hbar^2*pi()*x(i -2))*x(i)^2+(5*a^5*hbar^2*pi()*... x(i -1)^2 -5*a^5*hbar^2*pi()*x(i -2)*x(i -1))*x(i)+(-1*a^5*hbar^2*pi()*... -1)^2))*x(i+1)^2+(-4*a^5*hbar^2*pi()*...i x(i)^4+(22*a^5*hbar^2*pi()*x(i -1) -18*a^5*hbar^2*pi()*x(i -2))*x(i)^3+(-10*a^5*... hbar^2*pi()*x(i -1)^2+10*a^5*hbar^2*pi()*x(i -2)*x(i -1))*x(i)^2+(5*a^5*hbar^2*... -1)^2)*x(i)+(-1*a^5*hbar^2*pi()*...()*x(i -2)*x(i x(i -1)^4+a^5*hbar^2*pi()*x(i -2)*x(i -1)^3))*x(i+1)+(a^5*hbar^2*pi()*... x(i)^5+(-10*a^5*hbar^2*pi()*x(i -1)+9*a^5*hbar^2*pi()*x(i -2))*x(i)^4+(18*a^5*... -1))*x(i)^3+(-22*a^5*...2 -18*a^5*hbar^2*pi()*x(i -2)*x(i hbar^2*pi()*x(i -1)^3+22*a^5*hbar^2*pi()*x(i -2)*x(i -1)^2)*x(i)^2+(13*a^5*... hbar^2*pi()*x(i -1)^4 -13*a^5*hbar^2*pi()*x(i -2)*x(i -1)^3)*x(i)+(-3*a^5*... -1)^4)))*x(i+2)+((-1*a^5*...a^5*hbar^2*pi()*x(i -2)*x(i hbar^2*pi()*x(i)+(4*a^5*hbar^2*pi()*x(i -1) -3*a^5*hbar^2*pi()*x(i -2)))*... x(i+1)^5+(4*a^5*hbar^2*pi()*x(i)^2+(-17*a^5*hbar^2*pi()*x(i -1)+13*a^5*hbar^2*... -2)*...)*x(i -2))*x(i)+(a^5*hbar^2*pi()*x(i -1)^2 -1*a^5*hbar^2*pi()*x(i x(i -1)))*x(i+1)^4+(-6*a^5*hbar^2*pi()*x(i)^3+(28*a^5*hbar^2*pi()*x(i -1) -22*... a^5*hbar^2*pi()*x(i -2))*x(i)^2+(-5*a^5*hbar^2*pi()*x(i -1)^2+5*a^5*hbar^2*pi()*... x(i -2)*x(i -1))*x(i)+(a^5*hbar^2*pi()*x(i -1)^3 -1*a^5*hbar^2*pi()*x(i -2)*... -1)^2))*x(i+1)^3+(4*a^5*hbar^2*pi()*x(i)^4+(-22*a^5*hbar^2*pi()*x(i -1)+18*... a^5*hbar^2*pi()*x(i -2))*x(i)^3+(10*a^5*hbar^2*pi()*x(i -1)^2 -10*a^5*hbar^2*... pi()*x(i -2)*x(i -1))*x(i)^2+(-5*a^5*hbar^2*pi()*x(i -1)^3+5*a^5*hbar^2*pi()*... -1)^2)*x(i)+(a^5*hbar^2*pi()*x(i -1)^4 -1*a^5*hbar^2*pi()*x(i -2)*... x(i -1)^3))*x(i+1)^2+(-1*a^5*hbar^2*pi()*x(i)^5+(11*a^5*hbar^2*pi()*x(i -1) -10*... a^5*hbar^2*pi()*x(i -2))*x(i)^4+(-22*a^5*hbar^2*pi()*x(i -1)^2+22*a^5*hbar^2*... -1))*x(i)^3+(28*a^5*hbar^2*pi()*x(i -1)^3 -28*a^5*hbar^2*pi()*... x(i -2)*x(i -1)^2)*x(i)^2+(-17*a^5*hbar^2*pi()*x(i -1)^4+17*a^5*hbar^2*pi()*... x(i -2)*x(i -1)^3)*x(i)+(4*a^5*hbar^2*pi()*x(i -1)^5 -4*a^5*hbar^2*pi()*x(i -2)*... -1)^4))*x(i+1)+((-1*a^5*hbar^2*pi()*x(i -1)+a^5*hbar^2*pi()*x(i -2))*... x(i)^5+(4*a^5*hbar^2*pi()*x(i -1)^2 -4*a^5*hbar^2*pi()*x(i -2)*x(i -1))*... x(i)^4+(-6*a^5*hbar^2*pi()*x(i -1)^3+6*a^5*hbar^2*pi()*x(i -2)*x(i -1)^2)*... -1)^4 -4*a^5*hbar^2*pi()*x(i -2)*x(i -1)^3)*... x(i)^2+(-1*a^5*hbar^2*pi()*x(i -1)^5+a^5*hbar^2*pi()*x(i -2)*x(i -1)^4)*... x(i)))))/((((2*a^5*m*pi()*x(i -1) -2*a^5*m*pi()*x(i -2))*x(i)^4+(-8*a^5*m*pi()*... -1))*x(i)^3+(12*a^5*m*pi()*x(i -1)^3 -12*... a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^2+(-8*a^5*m*pi()*x(i -1)^4+8*a^5*m*pi()*... x(i -2)*x(i -1)^3)*x(i)+(2*a^5*m*pi()*x(i -1)^5 -2*a^5*m*pi()*x(i -2)*... -1)+8*a^5*m*pi()*x(i -2))*x(i)^5+(32*...*x(i a^5*m*pi()*x(i -1)^2 -32*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^4+(-48*a^5*m*pi()*... x(i -1)^3+48*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^3+(32*a^5*m*pi()*x(i -1)^4 -32*... -1)^3)*x(i)^2+(-8*a^5*m*pi()*x(i -1)^5+8*a^5*m*pi()*... x(i -2)*x(i -1)^4)*x(i))*x(i+1)^3+((12*a^5*m*pi()*x(i -1) -12*a^5*m*pi()*... x(i -2))*x(i)^6+(-48*a^5*m*pi()*x(i -1)^2+48*a^5*m*pi()*x(i -2)*x(i -1))*... -72*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^4+(-48*... a^5*m*pi()*x(i -1)^4+48*a^5*m*pi()*x(i -2)*x(i -1)^3)*x(i)^3+(12*a^5*m*pi()*... x(i -1)^5 -12*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^2)*x(i+1)^2+((-8*a^5*m*pi()*... -2))*x(i)^7+(32*a^5*m*pi()*x(i -1)^2 -32*a^5*m*pi()*... x(i -2)*x(i -1))*x(i)^6+(-48*a^5*m*pi()*x(i -1)^3+48*a^5*m*pi()*x(i -2)*... x(i -1)^2)*x(i)^5+(32*a^5*m*pi()*x(i -1)^4 -32*a^5*m*pi()*x(i -2)*x(i -1)^3)*... -1)^5+8*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^3)*... x(i+1)+((2*a^5*m*pi()*x(i -1) -2*a^5*m*pi()*x(i -2))*x(i)^8+(-8*a^5*m*pi()*... x(i -1)^2+8*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^7+(12*a^5*m*pi()*x(i -1)^3 -12*a^5*... -1)^2)*x(i)^6+(-8*a^5*m*pi()*x(i -1)^4+8*a^5*m*pi()*x(i -2)*... x(i -1)^3)*x(i)^5+(2*a^5*m*pi()*x(i -1)^5 -2*a^5*m*pi()*x(i -2)*x(i -1)^4)*... x(i)^4))*x(i+2)+(((-2*a^5*m*pi()*x(i -1)+2*a^5*m*pi()*x(i -2))*x(i)^4+(8*a^5*m*... -8*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^3+(-12*a^5*m*pi()*... x(i -1)^3+12*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^2+(8*a^5*m*pi()*x(i -1)^4 -8*... a^5*m*pi()*x(i -2)*x(i -1)^3)*x(i)+(-2*a^5*m*pi()*x(i -1)^5+2*a^5*m*pi()*... -1)^4))*x(i+1)^5+((8*a^5*m*pi()*x(i -1) -8*a^5*m*pi()*x(i -2))*... x(i)^5+(-32*a^5*m*pi()*x(i -1)^2+32*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^4+(48*a^5*... m*pi()*x(i -1)^3 -48*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^3+(-32*a^5*m*pi()*... -2)*x(i -1)^3)*x(i)^2+(8*a^5*m*pi()*x(i -1)^5 -8*... a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i))*x(i+1)^4+((-12*a^5*m*pi()*x(i -1)+12*a^5*m*... pi()*x(i -2))*x(i)^6+(48*a^5*m*pi()*x(i -1)^2 -48*a^5*m*pi()*x(i -2)*x(i -1))*... -1)^3+72*a^5*m*pi()*x(i -2)*x(i -1)^2)*x(i)^4+(48*... a^5*m*pi()*x(i -1)^4 -48*a^5*m*pi()*x(i -2)*x(i -1)^3)*x(i)^3+(-12*a^5*m*pi()*... x(i -1)^5+12*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^2)*x(i+1)^3+((8*a^5*m*pi()*... -2))*x(i)^7+(-32*a^5*m*pi()*x(i -1)^2+32*a^5*m*pi()*... x(i -2)*x(i -1))*x(i)^6+(48*a^5*m*pi()*x(i -1)^3 -48*a^5*m*pi()*x(i -2)*... x(i -1)^2)*x(i)^5+(-32*a^5*m*pi()*x(i -1)^4+32*a^5*m*pi()*x(i -2)*x(i -1)^3)*... -8*a^5*m*pi()*x(i -2)*x(i -1)^4)*x(i)^3)*... x(i+1)^2+((-2*a^5*m*pi()*x(i -1)+2*a^5*m*pi()*x(i -2))*x(i)^8+(8*a^5*m*pi()*... x(i -1)^2 -8*a^5*m*pi()*x(i -2)*x(i -1))*x(i)^7+(-12*a^5*m*pi()*x(i -1)^3+12*... -1)^2)*x(i)^6+(8*a^5*m*pi()*x(i -1)^4 -8*a^5*m*pi()*... x(i -2)*x(i -1)^3)*x(i)^5+(-2*a^5*m*pi()*x(i -1)^5+2*a^5*m*pi()*x(i -2)*... x(i -1)^4)*x(i)^4)*x(i+1))); endfunction 
%octave
F3=fr3([1;2;3;4;5],3)

error: 'FR3' undefined near line 4 column 5 error: called from: error: /projects/b04b5777-e269-4c8f-a4b8-b21dbe1c93c6/fr3.m at line 3, column 9
factor numer eval(D(eval(FRx,x(i+1)=x1),x1),x1=x(i+1))/factor denom eval(D(eval(FRx,x(i+1)=x1),x1),x1=x(i+1))


$${\left( {{hbar} ^{2}} \ {\left( {{\left( {{{x \left( {{i+1}} \right)}} ^{2}}+{{\left( -{4 \ {x \left( {i} \right)}}+{2 \ {x \left( {{i -1}} \right)}} \right)} \ {x \left( {{i+1}} \right)}}+{9 \ {{{x \left( {i} \right)}} ^{2}}} -{{14} \ {x \left( {{i -1}} \right)} \ {x \left( {i} \right)}}+{6 \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+2}} \right)}} ^{2}}}+{{\left( -{2 \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( {8 \ {x \left( {i} \right)}} -{4 \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( -{{20} \ {{{x \left( {i} \right)}} ^{2}}}+{{32} \ {x \left( {{i -1}} \right)} \ {x \left( {i} \right)}} -{{14} \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {x \left( {{i+1}} \right)}}+{2 \ {{{x \left( {i} \right)}} ^{3}}} -{4 \ {x \left( {{i -1}} \right)} \ {{{x \left( {i} \right)}} ^{2}}}+{2 \ {{{x \left( {{i -1}} \right)}} ^{2}} \ {x \left( {i} \right)}} \right)} \ {x \left( {{i+2}} \right)}}+{{{x \left( {{i+1}} \right)}} ^{4}}+{{\left( -{4 \ {x \left( {i} \right)}}+{2 \ {x \left( {{i -1}} \right)}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {i} \right)}} ^{2}}} -{{20} \ {x \left( {{i -1}} \right)} \ {x \left( {i} \right)}}+{9 \ {{{x \left( {{i -1}} \right)}} ^{2}}} \right)} \ {{{x \left( {{i+1}} \right)}} ^{2}}}+{{\left( -{4 \ {{{x \left( {i} \right)}} ^{3}}}+{8 \ {x \left( {{i -1}} \right)} \ {{{x \left( {i} \right)}} ^{2}}} -{4 \ {{{x \left( {{i -1}} \right)}} ^{2}} \ {x \left( {i} \right)}} \right)} \ {x \left( {{i+1}} \right)}}+{{{x \left( {i} \right)}} ^{4}} -{2 \ {x \left( {{i -1}} \right)} \ {{{x \left( {i} \right)}} ^{3}}}+{{{{x \left( {{i -1}} \right)}} ^{2}} \ {{{x \left( {i} \right)}} ^{2}}} \right)} \right)}/{\left( 4 \ m \ {{{\left( {x \left( {i} \right)} -{x \left( {{i -1}} \right)} \right)}} ^{2}} \ {{{\left( {x \left( {{i+1}} \right)} -{x \left( {i} \right)} \right)}} ^{4}} \ {{{\left( {x \left( {{i+2}} \right)} -{x \left( {{i+1}} \right)} \right)}} ^{2}} \right)}$$

factor numer eval(D(eval(FRx,x(i+2)=x1),x1),x1=x(i+2))/factor denom eval(D(eval(FRx,x(i+2)=x1),x1),x1=x(i+2))


$${\left( -{{hbar} ^{2}} \right)}/{\left( 4 \ m \ {{{\left( {x \left( {{i+1}} \right)} -{x \left( {i} \right)} \right)}} ^{2}} \ {{{\left( {x \left( {{i+2}} \right)} -{x \left( {{i+1}} \right)} \right)}} ^{2}} \right)}$$

xdot:=concat([x(N+i) for i in 1..N],[F(x(i))+R(x,i) for i in 1..N]);

# xdot


$$10$$

xdot(6)


$${\left( {{\left( {{\left( {{\left( {{\left( {4 \ {x \left( {0} \right)}} -{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{2}}}+{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{3}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( -{4 \ {{{x \left( {0} \right)}} ^{4}}}+{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {1} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{\left( {{\left( -{{12} \ {x \left( {0} \right)}}+{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{2}}} -{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{3}}}+{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{4}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{\left( {{\left( {{12} \ {x \left( {0} \right)}} -{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{6}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{2}}}+{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{3}}} -{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{4}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {x \left( {2} \right)}}+{{\left( -{4 \ {x \left( {0} \right)}}+{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{7}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{2}}} -{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{6}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{3}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( {4 \ {{{x \left( {0} \right)}} ^{4}}} -{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{4}}} \right)} \ {x \left( {3} \right)}}+{{\left( {{\left( -{4 \ {x \left( {0} \right)}}+{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{2}}} -{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{3}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {4 \ {{{x \left( {0} \right)}} ^{4}}} -{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {1} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{4}}}+{{\left( {{\left( {{12} \ {x \left( {0} \right)}} -{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{2}}}+{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{3}}} -{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{4}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{\left( {{\left( -{{12} \ {x \left( {0} \right)}}+{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{6}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{2}}} -{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{3}}}+{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{4}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{\left( {{\left( {4 \ {x \left( {0} \right)}} -{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{7}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{2}}}+{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{6}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{3}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( -{4 \ {{{x \left( {0} \right)}} ^{4}}}+{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{4}}} \right)} \ {x \left( {2} \right)}} \right)} \ m \ {{e} ^{{{\left( -{{{x \left( {1} \right)}} ^{2}} \right)}/{\left( {a} ^{2} \right)}}}}}+{{\left( {{\left( {{\left( -{x \left( {1} \right)}+{3 \ {x \left( {0} \right)}} -{2 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{\left( {3 \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( -{{10} \ {x \left( {0} \right)}}+{7 \ {x \left( {-1} \right)}} \right)} \ {x \left( {1} \right)}}+{{{x \left( {0} \right)}} ^{2}} -{{x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{\left( -{3 \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {{12} \ {x \left( {0} \right)}} -{9 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( -{4 \ {{{x \left( {0} \right)}} ^{2}}}+{4 \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {x \left( {1} \right)}}+{{{x \left( {0} \right)}} ^{3}} -{{x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {x \left( {2} \right)}}+{{{x \left( {1} \right)}} ^{4}}+{{\left( -{7 \ {x \left( {0} \right)}}+{6 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {9 \ {{{x \left( {0} \right)}} ^{2}}} -{9 \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( -{7 \ {{{x \left( {0} \right)}} ^{3}}}+{7 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {x \left( {1} \right)}}+{2 \ {{{x \left( {0} \right)}} ^{4}}} -{2 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {3} \right)}}+{{\left( {x \left( {1} \right)} -{3 \ {x \left( {0} \right)}}+{2 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{4}}}+{{\left( -{3 \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {{10} \ {x \left( {0} \right)}} -{7 \ {x \left( {-1} \right)}} \right)} \ {x \left( {1} \right)}} -{{{x \left( {0} \right)}} ^{2}}+{{x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{\left( {3 \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{12} \ {x \left( {0} \right)}}+{9 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {4 \ {{{x \left( {0} \right)}} ^{2}}} -{4 \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {x \left( {1} \right)}} -{{{x \left( {0} \right)}} ^{3}}+{{x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{\left( -{{{x \left( {1} \right)}} ^{4}}+{{\left( {8 \ {x \left( {0} \right)}} -{7 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{2}}}+{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {{10} \ {{{x \left( {0} \right)}} ^{3}}} -{{10} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {x \left( {1} \right)}} -{3 \ {{{x \left( {0} \right)}} ^{4}}}+{3 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {2} \right)}}+{{\left( -{x \left( {0} \right)}+{x \left( {-1} \right)} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {3 \ {{{x \left( {0} \right)}} ^{2}}} -{3 \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{3 \ {{{x \left( {0} \right)}} ^{3}}}+{3 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {{{x \left( {0} \right)}} ^{4}} -{{x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {1} \right)}} \right)} \ {{a} ^{3}} \ {{hbar} ^{2}} \ \pi} \right)}/{\left( {\left( {{\left( {{\left( {{\left( {4 \ {x \left( {0} \right)}} -{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{2}}}+{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{3}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {x \left( {1} \right)}} -{4 \ {{{x \left( {0} \right)}} ^{4}}}+{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{\left( {{\left( -{{12} \ {x \left( {0} \right)}}+{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{2}}} -{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{3}}}+{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{4}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {1} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{\left( {{\left( {{12} \ {x \left( {0} \right)}} -{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{2}}}+{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{3}}} -{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{4}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}} \right)} \ {x \left( {2} \right)}}+{{\left( -{4 \ {x \left( {0} \right)}}+{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{6}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{2}}} -{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{3}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( {4 \ {{{x \left( {0} \right)}} ^{4}}} -{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {x \left( {3} \right)}}+{{\left( {{\left( -{4 \ {x \left( {0} \right)}}+{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{2}}} -{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{3}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {x \left( {1} \right)}}+{4 \ {{{x \left( {0} \right)}} ^{4}}} -{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {2} \right)}} ^{4}}}+{{\left( {{\left( {{12} \ {x \left( {0} \right)}} -{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{2}}}+{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{3}}} -{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{4}}}+{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {x \left( {1} \right)}} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{\left( {{\left( -{{12} \ {x \left( {0} \right)}}+{{12} \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( {{36} \ {{{x \left( {0} \right)}} ^{2}}} -{{36} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( -{{36} \ {{{x \left( {0} \right)}} ^{3}}}+{{36} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{4}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{2}}} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{\left( {{\left( {4 \ {x \left( {0} \right)}} -{4 \ {x \left( {-1} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{6}}}+{{\left( -{{12} \ {{{x \left( {0} \right)}} ^{2}}}+{{12} \ {x \left( {-1} \right)} \ {x \left( {0} \right)}} \right)} \ {{{x \left( {1} \right)}} ^{5}}}+{{\left( {{12} \ {{{x \left( {0} \right)}} ^{3}}} -{{12} \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{2}}} \right)} \ {{{x \left( {1} \right)}} ^{4}}}+{{\left( -{4 \ {{{x \left( {0} \right)}} ^{4}}}+{4 \ {x \left( {-1} \right)} \ {{{x \left( {0} \right)}} ^{3}}} \right)} \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {x \left( {2} \right)}} \right)} \ {{a} ^{3}} \ m \ \pi \right)}$$

limit(limit(eval(eval(xdot(6),x(0)=b0),x(-1)=b1),b1=%minusInfinity),b0=%minusInfinity)


$${\left( {{\left( {{\left( {4 \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{3}}} -{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {{{x \left( {2} \right)}} ^{2}}}+{{12} \ {{{x \left( {1} \right)}} ^{3}} \ {x \left( {2} \right)}} -{4 \ {{{x \left( {1} \right)}} ^{4}}} \right)} \ {x \left( {3} \right)}} -{4 \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{4}}}+{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {{{x \left( {2} \right)}} ^{3}}} -{{12} \ {{{x \left( {1} \right)}} ^{3}} \ {{{x \left( {2} \right)}} ^{2}}}+{4 \ {{{x \left( {1} \right)}} ^{4}} \ {x \left( {2} \right)}} \right)} \ m \ {{e} ^{{{\left( -{{{x \left( {1} \right)}} ^{2}} \right)}/{\left( {a} ^{2} \right)}}}}}+{{\left( -{2 \ {x \left( {3} \right)}}+{3 \ {x \left( {2} \right)}} -{x \left( {1} \right)} \right)} \ {{a} ^{3}} \ {{hbar} ^{2}} \ \pi} \right)}/{\left( {\left( {{\left( {4 \ {{{x \left( {2} \right)}} ^{3}}} -{{12} \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {x \left( {2} \right)}} -{4 \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {x \left( {3} \right)}} -{4 \ {{{x \left( {2} \right)}} ^{4}}}+{{12} \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{3}}} -{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {{{x \left( {2} \right)}} ^{2}}}+{4 \ {{{x \left( {1} \right)}} ^{3}} \ {x \left( {2} \right)}} \right)} \ {{a} ^{3}} \ m \ \pi \right)}$$

jac:=map(f+->map(g+->eval(D(eval(f,g=x1),x1),x1=g),[x(i) for i in 1..2*N]),xdot);

jac1:=map(f+->eval(f,[x(0)=b0,x(-1)=b1,x(N+1)=c0,x(N+2)=c1]),jac);

jac2:=map(g+->map(f+->limit(limit(f,b0=%minusInfinity)::Expression(Integer),b1=%minusInfinity)::Expression(Integer),g),jac1);

jac3:=map(g+->map(f+->limit(limit(f,c0=%plusInfinity)::Expression(Integer),c1=%plusInfinity)::Expression(Integer),g),jac1);

)set message type on

variables(numer jac(6,1))
factor denom(jac3(6,1))


$$\left[ {{e} ^{{{\left( -{{{x \left( {1} \right)}} ^{2}} \right)}/{\left( {a} ^{2} \right)}}}}, : \pi, : m, : hbar, : a, : {x \left( {3} \right)}, : {x \left( {2} \right)}, : {x \left( {1} \right)}, : {x \left( {0} \right)}, : {x \left( {-1} \right)} \right]$$

Type: List(Kernel(Expression(Integer)))

$$2 \ {{{\left( {x \left( {2} \right)} -{x \left( {1} \right)} \right)}} ^{4}} \ {\left( {x \left( {3} \right)} -{x \left( {2} \right)} \right)} \ {{a} ^{5}} \ {{{\left( b0 -{x \left( {1} \right)} \right)}} ^{4}} \ {\left( b1 -b0 \right)} \ m \ \pi$$

Type: Factored(SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer))))

numer jac3(6,2)
factor denom(jac3(6,2))


$${\left( {{\left( {6 \ {{{x \left( {3} \right)}} ^{2}}}+{{\left( -{{14} \ {x \left( {2} \right)}}+{2 \ {x \left( {1} \right)}} \right)} \ {x \left( {3} \right)}}+{9 \ {{{x \left( {2} \right)}} ^{2}}} -{4 \ {x \left( {1} \right)} \ {x \left( {2} \right)}}+{{{x \left( {1} \right)}} ^{2}} \right)} \ {{b0} ^{2}}}+{{\left( {{\left( {2 \ {x \left( {2} \right)}} -{{14} \ {x \left( {1} \right)}} \right)} \ {{{x \left( {3} \right)}} ^{2}}}+{{\left( -{4 \ {{{x \left( {2} \right)}} ^{2}}}+{{32} \ {x \left( {1} \right)} \ {x \left( {2} \right)}} -{4 \ {{{x \left( {1} \right)}} ^{2}}} \right)} \ {x \left( {3} \right)}}+{2 \ {{{x \left( {2} \right)}} ^{3}}} -{{20} \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{2}}}+{8 \ {{{x \left( {1} \right)}} ^{2}} \ {x \left( {2} \right)}} -{2 \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ b0}+{{\left( {{{x \left( {2} \right)}} ^{2}} -{4 \ {x \left( {1} \right)} \ {x \left( {2} \right)}}+{9 \ {{{x \left( {1} \right)}} ^{2}}} \right)} \ {{{x \left( {3} \right)}} ^{2}}}+{{\left( -{2 \ {{{x \left( {2} \right)}} ^{3}}}+{8 \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{2}}} -{{20} \ {{{x \left( {1} \right)}} ^{2}} \ {x \left( {2} \right)}}+{2 \ {{{x \left( {1} \right)}} ^{3}}} \right)} \ {x \left( {3} \right)}}+{{{x \left( {2} \right)}} ^{4}} -{4 \ {x \left( {1} \right)} \ {{{x \left( {2} \right)}} ^{3}}}+{{12} \ {{{x \left( {1} \right)}} ^{2}} \ {{{x \left( {2} \right)}} ^{2}}} -{4 \ {{{x \left( {1} \right)}} ^{3}} \ {x \left( {2} \right)}}+{{{x \left( {1} \right)}} ^{4}} \right)} \ {{hbar} ^{2}}$$

Type: SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer)))

$$4 \ {{{\left( {x \left( {2} \right)} -{x \left( {1} \right)} \right)}} ^{4}} \ {{{\left( {x \left( {3} \right)} -{x \left( {2} \right)} \right)}} ^{2}} \ {{{\left( b0 -{x \left( {1} \right)} \right)}} ^{2}} \ m$$

Type: Factored(SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer))))

numer jac3(6,3)
factor denom(jac3(6,3))


$$-{{hbar} ^{2}}$$

Type: SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer)))

$$4 \ {{{\left( {x \left( {2} \right)} -{x \left( {1} \right)} \right)}} ^{2}} \ {{{\left( {x \left( {3} \right)} -{x \left( {2} \right)} \right)}} ^{2}} \ m$$

Type: Factored(SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer))))

numer jac3(6,4)
factor denom(jac3(6,4))


$$0$$

Type: SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer)))

$$1$$

Type: Factored(SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer))))

unparse(numer jac3(8,2)::InputForm)
factor denom(jac3(8,2))


$$\verb#"((x(3)^2+(-4x(2)+2x(1))x(3)+(9x(2)^2 -14x(1)x(2)+6x(1)^2))x(4)^2+(-2x(3)^3+(8x(2) -4x(1))x(3)^2+(-20x(2)^2+32x(1)x(2) -14x(1)^2)x(3)+(2x(2)^3 -4x(1)x(2)^2+2x(1)^2x(2)))x(4)+(x(3)^4+(-4x(2)+2*x(1))x(3)^3+(12x(2)^2 -20x(1)x(2)+9x(1)^2)x(3)^2+(-4x(2)^3+8x(1)x(2)^2 -4x(1)^2*x(2))x(3)+(x(2)^4 -2x(1)x(2)^3+x(1)^2x(2)^2)))*hbar^2"#$$

Type: String

$$4 \ {{{\left( {x \left( {2} \right)} -{x \left( {1} \right)} \right)}} ^{2}} \ {{{\left( {x \left( {3} \right)} -{x \left( {2} \right)} \right)}} ^{4}} \ {{{\left( {x \left( {4} \right)} -{x \left( {3} \right)} \right)}} ^{2}} \ m$$

Type: Factored(SparseMultivariatePolynomial(Integer,Kernel(Expression(Integer))))

%sage fricas('eval(jac3(8,5),xs)').sage()

-1/4*hbar^2/(m*x3^2*x4^2 - 2*m*x3*x4^3 + m*x4^4 + (m*x3^2 - 2*m*x3*x4 + m*x4^2)*x5^2 - 2*(m*x3^2*x4 - 2*m*x3*x4^2 + m*x4^3)*x5)
%sage m=fricas('eval(jac3,xs)').sage()

-12*a^5*m*pi()*x3*x4^2)*x5^2+(-8*a^5*m*pi()*x4^4+8*a^5*m*pi()*x3*x4^3)*x5+(2*a^5*m*pi()*x4^5 -2*a^5*m*pi()*x3*x4^4)),0,0,0,0,0]])^5*m*pi()*x3)*x5^4+(-8*a^5*m*pi()*x4^2+8*a^5*m*pi()*x3*x4)*x5^3+(12*a^5*m*pi()*x4^3 2*m*x3)*x5^4+(16*m*x4^4 *x3^3 ^4 
Error in lines 1-1 Traceback (most recent call last): File "/projects/b04b5777-e269-4c8f-a4b8-b21dbe1c93c6/.sagemathcloud/sage_server.py", line 879, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/projects/sage/sage-6.7/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 840, in sage return self._sage_() File "./axiom.py", line 1018, in _sage_ raise NotImplementedError NotImplementedError
%sage
matrix([[1,2],[3,4]])

[1 2] [3 4]