Hello all together,
I would like to calculate a formula which consists of the alternating (positive/negative) summation of very large values. For small values of N (for example N=3) ist works well. Also for larger values of N, if the gaps between the "Mueh" values are large enough. For the planned application of the formula, however, the values must be quite close together and N should nevertheless be able to reach at least values of 20 or 30. HereĀ“s my current version using symbolic functions and vpa:
% Definition of values
N=11;Mueh=[0.83 0.84 0.85 0.86 0.87 0.89 0.90 0.91 0.92 0.93 0.94];Muehc=num2cell(Mueh);T=25;% Creating symbolic variables
syms C zaehler nenner CfF MfF;mueh=sym('m',[1,N]);syms t;% Symbolic computing of the C-Values
for k=1:1:N C(1,k)=1;endfor i=2:1:N for k=1:1:N zaehler=1; nenner=1; for j=0:1:(i-2) zaehler=vpa((zaehler*mueh(N-j)),50); end for l=0:1:(i-1) if (l~=(k-1)) nenner=vpa((nenner*(mueh(N-l)-mueh(N-k+1))),50); end end C(i,k)=vpa((zaehler/nenner),50); endend% Symbolic computing of the function (here only for n=1)
for n=1:1:1 for j=1:1:N-n+1 CfF(n,j)=vpa(C((N+1-n),j),50); end for l=1:1:N-n+1 MfF(n,l)= vpa(mueh(N-l+1),50); end f(t,mueh)=sum(vpa((vpa(CfF(n,:),50)) .* vpa(exp(-vpa(MfF(n,:),50)*t),50),50)) h(t)=f(t,Muehc{:}) end% Plot h
fplot(h, [0 5]);
The current result – although using sym and vpa looks like this:
I also tryed XSum without success.
Do you have an idea how to fix it?
Many thanks and best regards, Johannes
Best Answer