InputMode:=Word PrecisionDigits:=64 LOAD("c1999.mth") "This is an example of a elliptic integral." int1:='(INT(1/(SQRT((t+a1)*(t+a2)*(t+a3)*(t+a4))*(t+a5)^2*(t+a6)^2),t,0,1)) "This elliptic integral is to this type:" IA(-2*e5-2*e6) at:=[a1,a2,a3,a4,a5,a6] bt:=[1,1,1,1,1,1] mm:=[0,0,0,0,-2,-2] "Since all the values of b are 1, we can simplify the dij difference." DFA(i,j):=at SUB i-at SUB j "This is the symbolic solution in terms of basic integrals." int3:=D219A(1,mm,6,4) "Check the answer using numerical integration and a random example." "Generate random values of a." an:=VECTOR(RANDOM(128)/RANDOM(128),i,1,6) "Substute the values of a in the integral and evaluate it to 12 digits." int2:=APPROX(SUBST(int1,[a1,a2,a3,a4,a5,a6],an),12) "Substute the values of a in the symbolic solution." int4:=SUBST(int3,[a1,a2,a3,a4,a5,a6],an) "Expand the symbolic solution to reveal the basic integrals." int5:=TERMS(EXPAND(int4)) "The first term is not a basic integral, but a function that can be evaluated." int5 SUB 1 "The function is:" AA(e1+e2+e3+e4-e5)=AF([1,1,1,1,-1,0],4,6,an,bt,1,0) "The second term is not a basic integral, but a function that can be evaluated." int5 SUB 2 "The function is:" AA(e1+e2+e3+e4-e6)=AF([1,1,1,1,0,-1],4,6,an,bt,1,0) "The third term is not a basic integral, but a function that can be evaluated." int5 SUB 3 "The function is:" AA(e2+e3+e4)=AF([0,1,1,1,0,0],4,6,an,bt,1,0) "The fourth term is a basic integral." int5 SUB 4 "The basic integral is:" IA(-e1) "The fifth term is a basic integral." int5 SUB 5 "The basic integral is:" IA(-e5) "The sixth term is a basic integral." int5 SUB 6 "The basic integral is:" IA(-e6) "I(-e6) and I(-e5) are the same basic integral with different parameters." IA(-e6)=SUBST(IA(-e5),[a5],[a6]) "The siventh term is a basic integral." int5 SUB 7 "The basic integral is:" IA(0) "Find the basic integrals in a table of integrals." IS([IA(-e1),IA(-e5),IA(-e5),IA(0)],4) "Evaluate the basic integrals." int6:=APPROX([I428(an,bt,1,0),I427(an,bt,1,0),I427([an SUB 1,an SUB 2,an SUB ~ 3,an SUB 4,an SUB 6],bt,1,0),I414(an,bt,1,0)]) "Put the values of the A functions in an array." int7:=[[e1+e2+e3+e4-e5,AF([1,1,1,1,-1,0],4,6,an,bt,1,0)],~ [e1+e2+e3+e4-e6,AF([1,1,1,1,0,-1],4,6,an,bt,1,0)],~ [e2+e3+e4,AF([0,1,1,1,0,0],4,6,an,bt,1,0)]] "Put the values of the basic integrals in an array." int8:=[[-e1,int6 SUB 1],[-e5,int6 SUB 2],[-e6,int6 SUB 3],[0,int6 SUB 4]] "Substitute the values of the basic integrals and A functions values." AA(v):='(SELECT(k SUB 1=v,k,int7)) SUB 1 SUB 2 IA(v):='(SELECT(k SUB 1=v,k,int8)) SUB 1 SUB 2 "Evaluate the integral." int9:=APPROX(int4) "Compare results to numerical integration." APPROX(int9-int2) "The results match." "Compare results to MAPLE." "Generate the rational expression." int10:=1/(SQRT((t+a1)*(t+a2)*(t+a3)*(t+a4))*(t+a5)^2*(t+a6)^2) "Factor the polynomial so MAPLE can integrate it easier." int11:=FACTOR(SUBST(int10,[a1,a2,a3,a4,a5,a6],an)) "Digits:=64;" "evalf(int(1455723360*sqrt(465)/((28*t+53)^2*(69*t+116)^2*sqrt((65*t+29)*(75*~ t+43)*(117*t+73)*(124*t+119))),t=0..1));" ".5446814508174694901018489489557609990731103509573270910308616e-1" int12:=0.05446814508174694901018489489557609990731103509573270910308616 APPROX(int9-int12) "The results match to 61 digits."