maple2015

110 Reputation

4 Badges

4 years, 134 days

MaplePrimes Activity


These are questions asked by maple2015

Hi

Two sets of ordered pairs (i.e. A and B) are calculated in a problem.

A = {[0.5, 3.15], [1, 4.87], [1.5, 6.56], [2, 8.22]}

B = {[0.5, 3.67], [1, 4.94], [1.5, 5.29], [2, 5.93]}

Two control points are considered to check the validity of interpolated polynomials as follows:

- Control point for A:

  Calculated by interpolation [1.75, 7.3959] ... Exact amount [1.75, 7.3971]

- Control point for B:

  Calculated by interpolation [1.75, 5.4981] ... Exact amount [1.75, 5.6225]

The calculated polynomial via interpolation for sets A and B are plotted for independent variable between 0.5 and  2. The plot of interpolated polynomial for A is a curve without local extremum. However ordered pairs in B show that the polynomial should be a strictly increasing function, but the plot of interpolated polynomial for B has many local extremums. By increasing ordered pairs in B, the local extremums are increased. Moreover, the control point for B shows that the interpolated polynomial is not reliable. 

The more exact ordered pairs for B are presented in below. If more ordered pairs are required for interpolation, you can use them.

{[0.75, 4.1457],[1.25, 4.9448],[1.75,5.62]}

How can I find the best curve fitting for ordered pairs in B?

Thank you for taking your time

Hi

However I run similar codes in Maple and Matlab, but the different results are observed.

By increasing number of basis (i.e. m) The convergence is observed, but results are different from each other.

The convergence for Maple: (m,P) =(10,10.8154),(20,10.8081),(30,10.8067),(50,10.8061)

The convergence for Matlab: (m,P) =(10,10.0474),(20,10.0194),(30,10.0143),(40,10.0125)

I have two questions:

1-which answer is correct?

2-why the different results for the same  number of basis  are obtained?

 

Maple code (Maple 2016)

restart;

tm := time():

with(LinearAlgebra):

Digits := 500:

beta := 1:

nu := 0.3:

lambda := 2:

G := 5:

ko := .5*0.1e7:

Ec := 0.380e12:

Em := 0.70e11:

ri := 0:

ro := 0.5:

ti := 0.1e-1:

K := 0.4e-1*0.1e10:

n := 1:

m := 20:

alpha := 0.1:

t := ti*(1+alpha*r/ro)^beta:

Er := (Ec-Em)*(r/ro)^n+Em:

W := simplify(add(a[n]*ChebyshevT(n, r), n = 0 .. m)):

sys := {eval(W, r = ro), eval(diff(W, r), r = ri)}:

W := subs(solve(sys, {a[0], a[1]}), W):

d1 := diff(W, r):

d2 := diff(d1, r):

W := subs(solve({eval(ko*d1-Ec*ti^3*(1+alpha)^(3*beta)*(d1*nu+d2*r)/(12*r*(-nu^2+1)), r = ro) = 0}, {a[2]}), W):

d1 := diff(W, r):

d2 := diff(d1, r):

Uf := int(K*(1+lambda*r/ro+G*(r/ro)^2)*W^2*r, r = ri .. ro):

NUM := int(((d2+d1/r)^2-(2*(1-nu))*d2*d1/r)*Er*t^3*r/(12*(-nu^2+1)), r = ri .. ro)+ko*ro*(eval(d1, r = ro))^2+Uf:

DEN := int(d1^2*r, r = ri .. ro):

PT := NUM-Em*ti^3*P*DEN/ro^2:

for c from 3 to m do

eq[c] := diff(PT, a[c]) end do:

MT := GenerateMatrix([seq(eq[j], j = 3 .. m)], [a[j]$j = 3 .. m])[1]:

solve(Determinant(MT)):

evalf[10](%[1]);

____________________________________________________________________________

Matlab Code (R2014a)

clear all;
digits(10);
tic
m = 20;
n = 1;
alpha = 0.1;
beta = 1;
nu = 0.3;
lambda = 2;
G = 5;
ko = 0.5*1e6;
Ec = 0.380e12;
Em = 0.70e11;
ro = 0.5;
ti = 0.1e-1;
K = 0.04*0.1e10;
ri=0;
syms r P;
c=sym('c%d',[1,m+1]);
c(1)=1;
c(2)=r;
for j=3:m+1
    c(j)=simplify(2*r*c(j-1)-c(j-2));
end
Er = (Ec-Em)*(r/ro)^n+Em;
a=sym('a%d',[1,m+1]);
t = ti*(1+alpha*r/ro)^beta;
W = simplify(a*transpose(c));
[a(1),a(2)] = solve(subs(W,r,ro)==0,subs(diff(W,r),r,ri)==0,a(1),a(2));
W = simplify(a*transpose(c));
d1 = diff(W, r);
d2 = diff(d1, r);
a(3)=solve(subs(ko*d1-Ec*ti^3*(1+alpha)^(3*beta)*(d1*nu+d2*r)/(12*r*(-nu^2+1)),r,ro)==0,a(3));
W = simplify(a*transpose(c));
d1 = diff(W, r);
d2 = diff(d1, r);
Uf = int(K*(1+lambda*r/ro+G*(r/ro)^2)*W^2*r,r,ri,ro);
NUM = int(((d2+d1/r)^2-(2*(1-nu))*d2*d1/r)*Er*t^3*r/(12*(-nu^2+1)),r,ri,ro)+ko*ro*(subs(d1,r,ro))^2+Uf;
DEN = int(d1^2*r, r , ri , ro);
PT = NUM-Em*ti^3*P*DEN/ro^2;
for q=1:m-2
    eq(q)= diff(PT, a(q+3));
end;
for q = 1:m-2
    for u = 1:m-2
        T = coeffs(eq(q),a(u+3));
        tt(q,u) = T(2);
    end;
end;
F=sort(vpa(solve(det(tt))));
F(1)
toc

___________________________________________________________

Hi

Why Maple can't  calculate following definite double integral:

Error, (in simpl/Re) too many levels of recursion

The approximated midpoint intgration gives the value -0.4552861717e-1

The Legendre root nodes with Christoffle weights gives the value -0.4552311444e-1

 

Thanks

Hi
I have the serious problem with time consuming integrations!
Is there a way to calculate the integrations in less possible time?

restart;

m := 40:

L := 5:

E :=70*(1-(y+0.5)^2)+380*(y+0.5)^2:

beta := Pi^2/L^2:

phi := add(a[n]*y^n, n = 0 .. m):

Eq := diff(phi, y$2)+(diff(E, y))*(diff(phi, y))/E+((diff(E, y$2))/E-((diff(E, y))/E)^2)*phi-2*beta*(1.3)*(phi-1):

st := [seq(coeftayl(Eq, y = 0, j), j = 0 .. m-2)]:

for k to m-1 do

a[m-k+1] := solve(st[m-k], a[m-k+1])

end do:

phi := subs(solve({eval(phi, y = -sqrt(-z^2+1)), eval(phi, y = sqrt(-z^2+1))}, {a[0], a[1]}), phi):

# One of the following integrations must be computed:

# Cartesian

int(int(E*phi, z = -sqrt(-y^2+1) .. sqrt(-y^2+1)), y = -1 .. 1);

# Polar

int(int(subs(z = r*cos(t), y = r*sin(t), E*phi*r), r = 0 .. 1), t = 0 .. 2Pi);

_____________________________________________________________________________

Moreover, I had the same problem before:

https://www.mapleprimes.com/questions/223886-Time-Consuming-Integration

 

Dear Friends
Is there a way to solve a complicated integration in less possible time?

Thanks

_________________________________________________________________________________
 

restart;
Digits := 100:
tm := time():
with(LinearAlgebra):

m := 6:
a := 0.1:
b := 10*a:
E := 1:
h := 1:
nu := 0.3:

w := (r-b)^2*(r-a)^2*add(add(W[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m):
ur := -z*(diff(w, r)):
ut := -z*(diff(w, t))/r:
er := diff(ur, r)+(1/2)*(diff(w, r))^2:
et := ur/r+(diff(ut, t))/r+(diff(w, t))^2/(2*r^2):
grt := diff(ut, r)-ut/r+(diff(ur, t))/r+(diff(diff(w, t), r))/r:
u := -(1/2)*E*(2*er*et*nu+er^2+et^2)/(nu^2-1)+(1/2)*E*grt^2/(2*(1+nu)):

PI := int(int(int(u*r, z = -(1/2)*h .. (1/2)*h), t = 0 .. 2*Pi), r = a .. b)-0.5*P*(int(int(r*(diff(w, r))^2, r = a .. b), t = 0 .. 2*Pi)):

Time = time()-tm;

2 3 4 5 6 7 8 Page 4 of 11