Taylor serie limitation??

2 次查看(过去 30 天)
MartinM
MartinM 2018-4-25
Dear all I am blocked with a taylor serie. Sorry the code is not very nice, but to summarized it, all the parameter ngas, A, B ...depend of lam. Together they creat BETA, wich depends on lam too. I need to found the taylor serie of BETA, but I have this warning : "Warning: Cannot compute a Taylor expansion of : " I acn found the Taylor serie of ngas, or A, or k_0 etc but not BETA...et I need to finish with taylorBETA=taylor(taylorBETA,lam,'ExpansionPoint', 1030e-9); If someone have an idea...? Thanks
clc,
clf
clear all
close all
format long
n_g = 1.45 ; % clad index
c=300000000;
n=1e-6;
E=1e-9;
%%%%%%%%%%%%%%%%%%TO BE CHANGED%%%%%%%%%%%%%%%%
r=30;
T=840 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a=2.405*2.405; %coef pour les ordres de bessel
t=T*E;
rc=r*n;
dc=2*rc;
int=0.0001;
L_start=800 ;
L_stop= 1300 ;
x1=L_start * E;
x2=L_stop * E;
xx=(L_stop-L_start)/int;
lambda = (x1 : 5e-9 : x2)';
%syms variable
%subs (f,variable,ordre)
pgas = 150;
pgas=pgas *1e5;
pgas= pgas/101325;
syms lam
syms lamm
ngas= 1 + pgas.* ( (3.22869e-3 ./ (46.301-(lam.*1000).^-2) ) + (3.55393e-3 ./ (59.578-(lam.*1000).^-2) ) + (6.06764e-2 ./ (112.74-(lam.*1000).^-2) )); %XENON
k_0= 2*3.14./(lam);
phi = k_0.*t.* sqrt(n_g.^2-ngas.^2) ;
epsi= n_g.^2 ./ ngas.^2;
A=a./( 2.*ngas .*(k_0.*rc).^2);
B=a./ ( ngas(i,j).^2 .*(k_0(i,j).*rc).^3 );
C = epsi;
D = 0.5 .* (C+1) ./ sqrt(C-1);
neff2= ngas - A - B.*D.*cot(phi);
BETA= (ngas - A - B.*D.*cot(phi)).*k_0;
taylorBETA=taylor(BETA,lam,'ExpansionPoint', 1030e-9);
  9 个评论
MartinM
MartinM 2018-4-25
Thanks for that answer, I will read it carefully later. I will discuss it with my collegue. On on the point to take care, is that each coeff from the taylor serie will determine a physical parameter used in the second parto of the code. But this first solution seem nice. THANKS
Torsten
Torsten 2018-4-25
Note that
lim (x->0+) cot(x) = Inf.
Best wishes
Torsten.

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2018-4-25
编辑:John D'Errico 2018-4-25
To make this into an answer, I'll compute the first few terms of a series, expanded around lam = 1.03e-6. n=8 is as far as I bothered to go, and that took a few minutes to get an answer on my computer.
C(1) = vpa(subs(BETA,lam,1.03e-6));
for n = 1:8,
C(n+1) = vpa(subs(diff(BETA,lam,n),lam,1.03e-6)/factorial(n));
end
C
C =
[ 6096502.4190565957838395137805456, -5920135585248.8976060067604718056, 5747320343726944021.8419750661176, -5581556315823124919223366.8235646, 5429269510660844571193986936400.4, -5.3413066400589435608804519200757e36, 5.6571437723662232853187257751051e42, -8.6696749577345104686166441304681e48, 2.981901322970591677439778972521e55]
So the Taylor series will be a polynomial in powers of (lam-1.03e-6)
C(1) + C(2)*(lam - 1.03e-6) + ...
with the general n'th term being:
C(n+1)*(lam - 1.03e-6)^(n)
MATLAB was bogging down for me to go past about the 6th terms or so, so I stopped it there.
As long as lam stays in the very near vicinity of 1.03e-6, this should be acceptably convergent. For example, if I plot that polynomial on top of BETA itself, we will see:
Cpol = flip(double(C));
ezplot(BETA,[2e-7,2e-6])
hold on
grid on
ezplot(@(x) polyval(Cpol,x - 1.03e-6),[2e-7,2e-6])
The green curve is the polynomial series, the blue is BETA. As you can see, even for small deviations from the expansion point, the series has insufficient terms to be convergent. But if you stay within a VERY small radius of convergence, the two curves do overlay reasonably well.

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by