fem report

23
Project Report AE675A – Finite Element Method Topic – code for 1-D Problem Name – Swatantra Verma Roll no. – 11757 Instructure – C. S. Upadhyay

Upload: swatantra-verma

Post on 14-Sep-2015

32 views

Category:

Documents


2 download

DESCRIPTION

A 1 Code for FEM Analysis

TRANSCRIPT

  • Project Report

    AE675A Finite Element Method

    Topic code for 1-D Problem

    Name Swatantra Verma

    Roll no. 11757

    Instructure C. S. Upadhyay

  • Code

    % FEM 1D Code for AE675A % By % Swatantra Verma % 11757 %

    % defining variables clc; clear all; syms EA k Ldom Nsub Lsub Nimelem x m n k_e Q1 Q2 EAp fsum k_ep k_ef syms intK Intp Sum Fp f fp ff intF intp FFp Degf Degk nk nf wt Wt power syms bndcD bndcDp bndcN bndcNp bndcM_del bndcM_k bndcMp chkc nodei nodej

    %taking bar property as input Ldom=input('Enter the length of the domain = '); Nsub=input('Enter the number of subdomains = '); Telem=0; for i=1:Nsub fprintf(' for subdomain %d=>\n',i); Lsub(i)=input('Enter the length of subdomain = '); Nelem(i)=input('Enter the number of elements in subdomain = '); Lelem(i)=Lsub(i)/Nelem(i); Telem=Telem+Nelem(i); end

    %check on input sum=0; for i=1:Nsub sum=sum+Lsub(i); end if sum~=Ldom ('Wrong Input ..!!') else xn(1,1)=0;

    %meshing of bar for i=2:Nsub xn(i,1)=xn(i-1,1)+Lsub(i-1); end for i=1:Nsub for j=2:Nelem(i)+1 xn(i,j)=xn(i,j-1)+Lelem(i); end end X=zeros(1,Telem+1); k=0; X(1,1)=0; for i=1:Nsub z=xn([i],:); for j=2:Nelem(i)+1 X(1,j+k)=X(1,j+k)+z(1,j); end

  • k=k+Nelem(i); end W=X'; deg=input('Enter the desired order of approximation = '); power=deg; intpoint = deg-1;%the number of intermediate points we want for i=1:Nsub Limt(i)=(Lsub(i)/(Nelem(i)*(intpoint+1))); end %number of intermediade elements Nimelem=0; for i=1:Nsub Nimelemsub(i)=((Lsub(i))/(Limt(i))); Nimelem=Nimelem+Nimelemsub(i); end N=Nimelem+1; end k=0; for i=1:Telem for j=1 imx(i,j)=W(i,j); end end for i=1:Telem for j=intpoint+2 imx(i,j)=W(i+1,1); end end for l=1:Nsub for i=1:Nelem(l) for j=2:intpoint+1 imx(i+k,j)=imx(i+k,j-1)+Limt(l); end end k=k+Nelem(l); end

    %basis function generation num=1 ; den=1; if deg==0 nimt=0; else nimt=deg-1; end nosf=nimt+2; for h=1:Telem for i= 1:nosf for j=1:nosf if i~=j num=num*(x-imx(h,j)); den=den*(imx(h,i)-imx(h,j)); else end end fract=num/den; fract; M{h,i}=fract; num=1; den=1; end

  • end for h=1:Telem for i=1:nosf M{h,i}; m(h,i)=vpa(M{h,i}); n(h,i)=diff(m(h,i)); end end shapefunction = m; %shape fhape function derivativeofshapefunction = n; %derivative of shape function

    %input of EA, k and f per subdomain

    for i=1:Nsub fprintf(' for subdomain %d=>\n',i); EAp= input('Enter a polynomial for EA in [] brackets (highest power coefficient first) = '); EA(i)= poly2sym(EAp,x); k_ep = input('Enter a polynomial for k in [] brackets(highest power

    coefficient first) = '); k_e(i) = poly2sym(k_ep,x); fp= input('Enter a polynomial for f in [] brackets(highest power

    coefficient first) = '); f(i)= poly2sym(fp,x); end

    %formulation of EA, k and f matrix over bar

    r=0; for i=1:Nsub for j=1:Nelem(i) r=r+1; for k=1:nosf EAf(r,k)=EA(i); k_ef(r,k)=k_e(i); end ff(r)=f(i); end end p=0; q=0;

    %formulation of global matrix of K(stiffness matrix) and F(force matrix)

    intK=zeros((Telem*(nosf-1))+1,(Telem*(nosf-1))+1); Sum=zeros(nosf,nosf); for i=1:Telem for j=1:nosf p=p+1; for k=1:nosf q=q+1; Fp = sym2poly((EAf(i)*n(i,j)*n(i,k))+(k_ef(i)*m(i,j)*m(i,k))); Degk = numel(Fp)-1; nk=ceil((Degk+1)/2); [Intp,wt] = gauleg(X(i),X(i+1),nk); Val = polyval(Fp,Intp);

  • for l=1:nk Sum(j,k) = Sum(j,k)+(Val(l)*wt(l)); end intK(p,q) = intK(p,q)+Sum(j,k); end q=q-nosf; end Sum=zeros(nosf,nosf); p=(nosf-1)*i; q=(nosf-1)*i; end p=0; q=0; intF=zeros(((Telem*(nosf-1))+1),1); Sum=zeros(nosf,1); for i=1:Telem for j=1:nosf p=p+1; FFp = sym2poly(ff(i)*m(i,j)); Degf = numel(FFp)-1; nf=ceil((Degf+1)/2); [intp,Wt] = gauleg(X(i),X(i+1),nf); Val = polyval(FFp,intp); for l=1:nf Sum(j) = (Sum(j)+Val(l)*Wt(l)); end intF(p) = intF(p)+Sum(j); end Sum=zeros(nosf,1); p=(nosf-1)*i; end

    %taking boundry conditions as input and changing global matrix of

    K(stiffness matrix) and F(force matrix)

    bndc_no = input('input total boundry no. of condition = '); for j=1:bndc_no fprintf(' for boundry condition no. %d=>\n',j); chkc = input('input boundry condition type (0,1,2)= '); if chkc == 0 bndcDp = input('input the node point point coordinate = '); bndcD = input('input the value of u = '); [nodei] = find(W==bndcDp); for i=1:(Telem*(nosf-1))+1 if i~=nodei intF(i) = intF(i)-intK(i,nodei)*bndcD; else intF(nodei) = 0; end end for i=1:(Telem*(nosf-1))+1 if i~=nodei intK(nodei,i) = 0; intK(i,nodei) = 0; else intK(nodei,nodei) = 1; end end elseif chkc == 1 bndcNp = input('input the node point coordinate = '); bndcN = input('input the value of p = ');

  • [nodei] = find(W==bndcNp); intF(nodei)= intF(nodei)+bndcN; elseif chkc == 2 bndcMp = input('input the node point coordinate = '); bndcM_k = input('input the value of k = '); bndcM_del = input('input the value of delta(disp) = '); [nodei] = find(W==bndcMp); intK(nodei,nodei)=intK(nodei,nodei)-bndcM_k; intF(nodei)= intF(nodei)-(bndcM_k*bndcM_del); else ('Wrong Input ..!!') end end

    %calculating Alfa

    Alfa = (inv(intK)*intF);

    %calculating U

    syms U U_diff a M deg U=sym(zeros(Telem,1)); a=0; for i=1:Telem for j=1:nosf a=a+1; U(i,1)=U(i,1)+(m(i,j)*Alfa(a)); end a=a-1; end U

    %calculating diffrentiate of U

    U_diff = diff(U); U_diff

    %ploting U and U_diff

    subplot(3,1,1); for i=1:Telem ezplot(x,U(i),[W(i),W(i+1)]); if(i~= Telem) hold on; else hold off; end end subplot(3,1,2); for j=1:Telem ezplot(x,U_diff(j),[W(j),W(j+1)]); if(j~= Telem) hold on; else hold off; end end

  • %-------------recovery--------%

    %Calculation of K and F for recovery

    for i= 1:Telem nr=power; if i~=1 && i~=Telem [intpr,wr]=gauleg(X(i),X(i+1),nr); [intpr_next,wr_next]=gauleg(X(i+1),X(i+2),nr); [intpr_prev,wr_prev]=gauleg(X(i-1),X(i),nr); for q=1:nr+1 for r=1:nr+1 kmat(q,r,i)=(x^(q-1)) * (x^(r-1)); for s=1:3 j=i+(s-2); fmat(r,1,i)= (x^(r-1)) * (U_diff(j,1)); for m=1 :nr if s==1

    kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr_prev(m));

    temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr_prev(m)); elseif s==2 kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr(m)); temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr(m)); else

    kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr_next(m));

    temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr_next(m)); end if m~=1 kmat_temp(s,m)=kmat_temp(s,m)+kmat_temp(s,m-1); temp_fmat(s,m)=temp_fmat(s,m)+temp_fmat(s,m-1); end end end

    kmat(q,r,i)=kmat_temp(1,nr)+kmat_temp(2,nr)+kmat_temp(3,nr);

    fmat(r,1,i)=temp_fmat(1,nr)+temp_fmat(2,nr)+temp_fmat(3,nr); end end

    elseif i==1 [intpr,wr]=gauleg(X(i),X(i+1),nr); [intpr_next,wr_next]=gauleg(X(i+1),X(i+2),nr); for q=1:nr+1 for r=1:nr+1 kmat(q,r,i)=(x^(q-1)) * (x^(r-1)); for s=1:2 j=i+(s-1); fmat(r,1,i)= (x^(r-1)) * (U_diff(j,1)); for m=1 :nr if s==1 kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr(m)); temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr(m)); else

  • kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr_next(m));

    temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr_next(m)); end if m~=1 kmat_temp(s,m)=kmat_temp(s,m)+kmat_temp(s,m-1); temp_fmat(s,m)=temp_fmat(s,m); end end end kmat(q,r,i)=kmat_temp(1,nr)+kmat_temp(2,nr); fmat(r,1,i)=temp_fmat(1,nr)+temp_fmat(2,nr); end end

    elseif i==Telem [intpr,wr]=gauleg(X(i),X(i+1),nr); [intpr_prev,wr_prev]=gauleg(X(i-1),X(i),nr); for q=1:nr+1 for r=1:nr+1 kmat(q,r,i)=(x^(q-1)) * (x^(r-1)); for s=1 :2 j=i+(s-2); fmat(r,1,i)= (x^(r-1)) * (U_diff(j,1)); for m=1 :nr if s==1

    kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr_prev(m));

    temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr_prev(m)); else kmat_temp(s,m)=subs(kmat(q,r,i),x,intpr(m)); temp_fmat(s,m)=subs(fmat(r,1,i),x,intpr(m)); end if m~=1 kmat_temp(s,m)=kmat_temp(s,m)+kmat_temp(s,m-1); temp_fmat(s,m)=temp_fmat(s,m)+temp_fmat(s,m-1); end end end kmat(q,r,i)=kmat_temp(1,nr)+kmat_temp(2,nr); fmat(r,1,i)=temp_fmat(1,nr)+temp_fmat(2,nr); end end end end

    %calculation of Alfar = Alfa for recovery

    for i=1:Telem Alfar(:,:,i)= inv(kmat(:,:,i))*fmat(:,1,i); end

    % calculation and plot of recovery of dudx

    subplot(3,1,3) for i=1 : Telem

  • for j=1:nr+1 temp_dudx_r(j)= (x^(j-1))*Alfar(j,1,i); if j~=1 temp_dudx_r(j)=temp_dudx_r(j)+temp_dudx_r(j-1); end end dudx_r(i,1)=temp_dudx_r(nr+1); ezplot(x,dudx_r(i,1),[W(i),W(i+1)]); if(i~= Telem) hold on; else hold off; end end dudx_r

    %-------- END-----------%

  • Test Cases

    Test -1 Enter the length of the domain = 1

    Enter the number of subdomains = 2

    for subdomain 1=>

    Enter the length of subdomain = .5

    Enter the number of elements in subdomain = 2

    for subdomain 2=>

    Enter the length of subdomain = .5

    Enter the number of elements in subdomain = 2

    Enter the desired order of approximation = 1

    for subdomain 1=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [0]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [0]

    for subdomain 2=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [0]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [0]

    input total boundry no. of condition = 2

    for boundry condition no. 1=>

    input boundry condition type (0,1,2)= 0

    input the node point coordinate = 0

    input the value of u = 0

    for boundry condition no. 2=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = 1

    input the value of p = 1

    U =

  • 1.0*x

    1.0*x

    1.0*x

    1.0*x

    U_diff =

    1.0

    1.0

    1.0

    1.0

    dudx_r =

    1

    1

    1

    1

    -1 0 1 20

    0.5

    1

    x

    y

    x = x, y = 1.0 x

    0 0.2 0.4 0.6 0.8 10.9

    1

    1.1

    x

    y

    x = x, y = 1.0

    0 0.2 0.4 0.6 0.8 10.9

    1

    1.1

    x

    y

    x = x, y = 1

  • Test -2 Enter the length of the domain = 1 Enter the number of subdomains = 2

    for subdomain 1=>

    Enter the length of subdomain = .5

    Enter the number of elements in subdomain = 2

    for subdomain 2=>

    Enter the length of subdomain = .5

    Enter the number of elements in subdomain = 2

    Enter the desired order of approximation = 1

    for subdomain 1=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [0]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [0]

    for subdomain 2=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [0]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [0]

    input total boundry no. of condition = 3

    for boundry condition no. 1=>

    input boundry condition type (0,1,2)= 0

    input the node point coordinate = 0

    input the value of u = 0

    for boundry condition no. 2=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = 1

    input the value of p = 0

    for boundry condition no. 3=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = .5

    input the value of p = 1

  • U =

    1.0*x

    1.0*x

    0.5

    0.5

    U_diff =

    1.0

    1.0

    0

    0

    dudx_r =

    1

    17/12 - 2*x

    19/12 - 2*x

    0

    -0.5 0 0.5 1 1.50

    0.5

    x

    y

    x = x, y = 0.5

    -1 0 1 20

    0.5

    1

    x

    y

    x = x, y = 0

    -1 0 1 20

    0.5

    1

    x

    y

    x = x, y = 0

  • Test -3 Enter the length of the domain = 1

    Enter the number of subdomains = 2

    for subdomain 1=>

    Enter the length of subdomain = .5

    Enter the number of elements in subdomain = 2

    for subdomain 2=>

    Enter the length of subdomain = .5

    Enter the number of elements in subdomain = 2

    Enter the desired order of approximation = 1

    for subdomain 1=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [0]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [0]

    for subdomain 2=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [10]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [0]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [0]

    input total boundry no. of condition = 3

    for boundry condition no. 1=>

    input boundry condition type (0,1,2)= 0

    input the node point coordinate= 0

    input the value of u = 0

    for boundry condition no. 2=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = 1

    input the value of p = 1

    for boundry condition no. 3=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = .5

    input the value of p = 1

  • U = 2.0*x

    2.0*x

    0.1*x + 0.95

    0.1*x + 0.95

    U_diff =

    2.0

    2.0

    0.1

    0.1

    dudx_r =

    2

    67/24 - (19*x)/5

    373/120 - (19*x)/5

    1/10

    -2 -1 0 1 2 30

    0.5

    1

    x

    y

    x = x, y = 0.1 x + 0.95

    -4 -2 0 2 4

    0.5

    1

    1.5

    2

    x

    y

    x = x, y = 0.1

    -4 -2 0 2 4

    0.5

    1

    1.5

    2

    x

    y

    x = x, y = 1/10

  • Test -4

    Enter the length of the domain = 3

    Enter the number of subdomains = 2

    for subdomain 1=>

    Enter the length of subdomain = 1

    Enter the number of elements in subdomain = 2

    for subdomain 2=>

    Enter the length of subdomain = 2

    Enter the number of elements in subdomain = 4

    Enter the desired order of approximation = 2

    for subdomain 1=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [5,5]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [2,1]

    for subdomain 2=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [10]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [2,3]

    input total boundry no. of condition = 3

    for boundry condition no. 1=>

    input boundry condition type (0,1,2)= 0

    input the node point coordinate = 0

    input the value of u = 0

    for boundry condition no. 2=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = 1

    input the value of p = 0

    for boundry condition no. 3=>

    input boundry condition type (0,1,2)= 1

  • input the node point coordinate = 3

    input the value of p = 10

    U =

    11.455727100577016486226966662798*x*(x - 0.25) -

    12.65920726287530762022015551338*x*(x - 0.5)

    19.443284052978029308178520295769*(x - 0.75)*(x - 0.5) +

    11.455727100577016486226966662798*(x - 0.75)*(x - 1.0) -

    31.500336401663126650873891776428*(x - 0.5)*(x - 1.0)

    19.443284052978029308178520295769*(x - 1.5)*(x - 1.25) -

    45.641474734517053946092346450314*(x - 1.5)*(x - 1.0) +

    26.065737487366590130477561615407*(x - 1.25)*(x - 1.0)

    28.122007064902827977448396268301*(x - 1.75)*(x - 1.5) +

    26.065737487366590130477561615407*(x - 1.75)*(x - 2.0) -

    54.343019685597958812195429345593*(x - 1.5)*(x - 2.0)

    28.122007064902827977448396268301*(x - 2.5)*(x - 2.25) -

    57.796389103442578516478533856571*(x - 2.5)*(x - 2.0) +

    29.479874159144934253617975628003*(x - 2.25)*(x - 2.0)

    29.479874159144934253617975628003*(x - 3.0)*(x - 2.75) -

    59.691426964999351412188843823969*(x - 3.0)*(x - 2.5) +

    29.97293934828370964851274038665*(x - 2.75)*(x - 2.5)

    U_diff =

    3.4656718562933996885533360909903 - 2.4069603245965822679863777011633*x

    2.8988771102623744901904956350336 - 1.2026504962161617129368096357211*x

    1.9867463440282264741654216777533 - 0.26490638834486901487252907827497*x

    1.0575303610339519266858587798197 - 0.31055026665708140853894292376935*x

    1.2147522308371998533971236611251 - 0.38901575878963257082432392053306*x

    1.4356403139235851540433941408992 - 0.47722691514141502011625561863184*x

  • dudx_r =

    - (168981288381493*x^2)/70368744177664 + (8468238993012299*x)/2251799813685248 +

    68689443268471/13510798882111488

    (149361901570707*x^2)/140737488355328 - (7117189074733225*x)/2533274790395904 +

    11765527698663083/3377699720527872

    - (162480030621297*x^2)/281474976710656 + (99967898607503*x)/1688849860263936 +

    5235534440893573/2251799813685248

    (1053749989888677*x^2)/1125899906842624 - (90819771376623499*x)/20266198323167232 +

    456962077195719595/81064793292668928

    - (187505158257477*x^2)/2251799813685248 - (73197444396387*x)/4503599627370496 +

    43198453784032199/54043195528445952

    - (6207308294935*x^2)/70368744177664 + (9541701212105*x)/1125899906842624 +

    2596945644605905/3377699720527872

    -5 0 5 100

    2

    x

    y

    x = x, y = 29.479874159144934253617975628003 (x - 3.0) (x - 2.75) -...+ 29.97293934828370964851274038665 (x - 2.75) (x - 2.5)

    -6 -4 -2 0 2 4 6 8

    1

    2

    3

    x

    y

    x = x, y = 1.4356403139235851540433941408992 - 0.47722691514141502011625561863184 x

    -4 -2 0 2 4 6

    0.51

    1.52

    x

    y

    x = x, y = -...+ 2596945644605905/3377699720527872

  • Test - 5

    Enter the length of the domain = 3

    Enter the number of subdomains = 2

    for subdomain 1=>

    Enter the length of subdomain = 1

    Enter the number of elements in subdomain = 2

    for subdomain 2=>

    Enter the length of subdomain = 2

    Enter the number of elements in subdomain = 4

    Enter the desired order of approximation = 3

    for subdomain 1=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [5,5]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [2,1]

    for subdomain 2=>

    Enter a polynomial for EA in [] brackets (highest power coefficient first) = [10]

    Enter a polynomial for k in [] brackets (highest power coefficient first) = [1]

    Enter a polynomial for f in [] brackets (highest power coefficient first) = [2,3]

    input total boundry no. of condition = 3

    for boundry condition no. 1=>

    input boundry condition type (0,1,2)= 0

    input the node point coordinate = 0

    input the value of u = 0

    for boundry condition no. 2=>

    input boundry condition type (0,1,2)= 1

    input the node point coordinate = 1

    input the value of p = 0

    for boundry condition no. 3=>

  • input boundry condition type (0,1,2)= 1

    input the node point coordinate = 3

    input the value of p = 10

    U =

    53.245999008315026301829675503541*x*(x - 0.16666666666666666666666666666667)*(x -

    0.33333333333333333333333333333333) - 113.66305623331731577962955270777*x*(x -

    0.16666666666666666666666666666667)*(x - 0.5) + 61.110124903685870467739960076869*x*(x -

    0.33333333333333333333333333333333)*(x - 0.5)

    90.435290567012934559443237958476*(x - 0.83333333333333333333333333333333)*(x -

    0.66666666666666666666666666666667)*(x - 0.5) - 237.72231576904152561269256693777*(x -

    0.66666666666666666666666666666667)*(x - 0.5)*(x - 1.0) -

    53.245999008315026301829675503541*(x - 0.83333333333333333333333333333333)*(x -

    0.66666666666666666666666666666667)*(x - 1.0) + 200.77056079448808834087003560853*(x -

    0.83333333333333333333333333333333)*(x - 0.5)*(x - 1.0)

    103.3167268551962649780762149021*(x - 1.3333333333333333333333333333333)*(x -

    1.1666666666666666666666666666667)*(x - 1.0) - 90.435290567012934559443237958476*(x -

    1.5)*(x - 1.3333333333333333333333333333333)*(x - 1.1666666666666666666666666666667) +

    285.01720555797356482230497931596*(x - 1.5)*(x - 1.3333333333333333333333333333333)*(x -

    1.0) - 297.92004802842554056496737757698*(x - 1.5)*(x -

    1.1666666666666666666666666666667)*(x - 1.0)

    113.37519908266103740857033699285*(x - 1.8333333333333333333333333333333)*(x -

    1.6666666666666666666666666666667)*(x - 1.5) - 103.3167268551962649780762149021*(x -

    1.8333333333333333333333333333333)*(x - 1.6666666666666666666666666666667)*(x - 2.0) +

    321.04115323106015189580375590594*(x - 1.8333333333333333333333333333333)*(x - 1.5)*(x -

    2.0) - 331.12364113464954407106688449858*(x - 1.6666666666666666666666666666667)*(x -

    1.5)*(x - 2.0)

    347.97218363337871416263169521699*(x - 2.5)*(x -

    2.3333333333333333333333333333333)*(x - 2.0) - 113.37519908266103740857033699285*(x -

    2.5)*(x - 2.3333333333333333333333333333333)*(x - 2.1666666666666666666666666666667) -

    354.58502585450562527569218218559*(x - 2.5)*(x - 2.1666666666666666666666666666667)*(x -

    2.0) + 119.96081538733189297829540009843*(x - 2.3333333333333333333333333333333)*(x -

    2.1666666666666666666666666666667)*(x - 2.0)

    363.77934232691515958890704496298*(x - 3.0)*(x -

    2.8333333333333333333333333333333)*(x - 2.5) - 119.96081538733189297829540009843*(x -

    3.0)*(x - 2.8333333333333333333333333333333)*(x - 2.6666666666666666666666666666667) -

    366.18632569249823305312929733191*(x - 3.0)*(x - 2.6666666666666666666666666666667)*(x -

  • 2.5) + 122.33668142811212220522065763362*(x - 2.8333333333333333333333333333333)*(x -

    2.6666666666666666666666666666667)*(x - 2.5)

    U_diff =

    114.35612391200089676956963558041*x*(x -

    0.33333333333333333333333333333333) - 60.417057225002289477799877204234*x*(x -

    0.16666666666666666666666666666667) + 53.245999008315026301829675503541*(x -

    0.16666666666666666666666666666667)*(x - 0.33333333333333333333333333333333) -

    52.552931329631445311889592630905*x*(x - 0.5) - 113.66305623331731577962955270777*(x -

    0.16666666666666666666666666666667)*(x - 0.5) + 61.110124903685870467739960076869*(x -

    0.33333333333333333333333333333333)*(x - 0.5)

    37.189291558697908257613562454935*(x - 0.83333333333333333333333333333333)*(x -

    0.66666666666666666666666666666667) + 291.20585136150102290031327356701*(x -

    0.83333333333333333333333333333333)*(x - 0.5) + 147.52456178617306203904036010499*(x -

    0.83333333333333333333333333333333)*(x - 1.0) - 147.28702520202859105324932897929*(x -

    0.66666666666666666666666666666667)*(x - 0.5) - 290.96831477735655191452224244131*(x -

    0.66666666666666666666666666666667)*(x - 1.0) - 36.951754974553437271822531329235*(x -

    0.5)*(x - 1.0)

    194.58191499096063026286174135748*(x - 1.5)*(x - 1.3333333333333333333333333333333) -

    388.35533859543847512441061553545*(x - 1.5)*(x - 1.1666666666666666666666666666667) -

    12.902842470451975742662398261018*(x - 1.5)*(x - 1.0) +

    12.881436288183330418632976943627*(x - 1.3333333333333333333333333333333)*(x -

    1.1666666666666666666666666666667) + 388.33393241316982980038119421806*(x -

    1.3333333333333333333333333333333)*(x - 1.0) - 194.60332117322927558689116267487*(x -

    1.1666666666666666666666666666667)*(x - 1.0)

    10.058472227464772430494122090749*(x - 1.8333333333333333333333333333333)*(x -

    1.6666666666666666666666666666667) + 434.4163523137211893043740928988*(x -

    1.8333333333333333333333333333333)*(x - 1.5) - 217.74844205198850666249654750573*(x -

    1.6666666666666666666666666666667)*(x - 1.5) + 217.72442637586388691772754100384*(x -

    1.8333333333333333333333333333333)*(x - 2.0) - 434.44036798984580904914309940068*(x -

    1.6666666666666666666666666666667)*(x - 2.0) - 10.082487903589392175263128592633*(x -

    1.5)*(x - 2.0)

    234.59698455071767675406135822413*(x - 2.5)*(x - 2.3333333333333333333333333333333) -

    467.96022493716666268426251917845*(x - 2.5)*(x - 2.1666666666666666666666666666667) -

    6.6128422211269111130604869686067*(x - 2.5)*(x - 2.0) +

    6.5856163046708555697250631055795*(x - 2.3333333333333333333333333333333)*(x -

    2.1666666666666666666666666666667) + 467.93299902071060714092709531542*(x -

    2.3333333333333333333333333333333)*(x - 2.0) - 234.62421046717373229739678208716*(x -

    2.1666666666666666666666666666667)*(x - 2.0)

  • 243.81852693958326661061164486455*(x - 3.0)*(x - 2.8333333333333333333333333333333)

    - 486.14714107983012603142469743034*(x - 3.0)*(x - 2.6666666666666666666666666666667) -

    2.406983365583073464222252368927*(x - 3.0)*(x - 2.5) +

    2.3758660407802292269252575351857*(x - 2.8333333333333333333333333333333)*(x -

    2.6666666666666666666666666666667) + 486.1160237550272817941277025966*(x -

    2.8333333333333333333333333333333)*(x - 2.5) - 243.84964426438611084790863969829*(x -

    2.6666666666666666666666666666667)*(x - 2.5)

    dudx_r =

    (75802571805425125*x^3)/2814749767108072 -

    (126855265433737628830063288564415*x^2)/3119608899000834054019639934976 +

    (108396595568312186272489881267505*x)/6239217798001668108039279869952 -

    56873317228221958625800777197961/49913742384013344864314238959616

    (753339013326251825*x^3)/1066350357082473088 -

    (8554717007507696568850763736845*x^2)/6155439238700161385149614784512 -

    (36674738663846536148987489073205*x)/24621756954800645540598459138048 +

    42837296449935338790493127815969/12310878477400322770299229569024

    (7341157905953026960215433999698002841862465*x^3)/18336705731462315260764552868370

    786878358552 -

    (39874908145552851532014995979907753193769335*x^2)/2200404687775477831291746344204

    49442540302624 -

    (2604958408736338170330911931138826351206767455*x)/8801618751101911325166985376817

    97770161210496 +

    2620687069848158858114218980915442722410326778325538511485/6451654773391884476532

    77421778661559863999782927690891264

    -

    (799862640358850681582821309690860801325395*x^3)/137525292984980758364131997809513

    956897424672 -

    (68902969800308697212507163316504832983506005*x^2)/1650303515819769100369583973714

    167482769096064 -

    (326504567569256428009713275689773275970181725*x)/22004046877596921338261119649522

    23310358794752 +

    21317688405838307152923424139592918029157912379644696695195/217743348600414010870

    53940777660640226385646943321056083968

  • -

    (81337120763564480615557319800159592055805*x^3)/1146044108199897514994141689689621

    2707129856 -

    (14051145657869595247517625314309523076565135*x^2)/4125758789519631053978910082882

    63657456674816 -

    (89967857426886844561487528002353372231410905*x)/550101171935950807197188011051018

    209942233088 +

    1345689638394018849669239850754843848675601364295631278535/1360895928742760672780

    192984041388044340555421409395867648

    -

    (730106081404517119631012978696112457*x^3)/93790327337722225707791894815319949056 -

    (32594498243675222207692225519502326835*x^2)/1125483928052666708493502737783839388

    672 -

    (132069105194355344270731747974952010855*x)/75032261870177780566233515852255959244

    8 +

    1236101360151818265516523432236110013245944762584235/1237482665768914042513295279

    940621745065695454953472

    -6 -4 -2 0 2 4 6 80

    2

    x

    y

    x = x, y = 363.77934232691515958890704496298 (x - 3.0) (x - 2.8333333333333333333333333333333) (x - 2.5) -...+ 122.33668142811212220522065763362 (x - 2.8333333333333333333333333333333) (x - 2.6666666666666666666666666666667) (x - 2.5)

    -5 0 5 10

    1

    2

    3

    x

    y

    x = x, y = 243.81852693958326661061164486455 (x - 3.0) (x - 2.8333333333333333333333333333333) -...- 243.84964426438611084790863969829 (x - 2.6666666666666666666666666666667) (x - 2.5)

    -5 0 5 10-1

    0

    1

    2

    x

    y

    x = x, y = -...+ 1236101360151818265516523432236110013245944762584235/1237482665768914042513295279940621745065695454953472