# Homework Help: Some problems about the Numerical Integration

1. Nov 20, 2007

### sigma665

there are 5 examples as follows:

%%% example01 %%%%
z=linspace(-0.1,0.1);
a=0.1;
kesi=(z+sqrt(z.^2-a^2))./a;
for j=1:length(z)
f=@(b) log(1-((b+sqrt(b.^2-a^2))./a)./kesi(j));
end

%%% example02 %%%%
z=linspace(-0.1,0.1);
a=0.1;
kesi=(z+sqrt(z.^2-a^2))./a;
for i=1:length(z)
k=kesi(i);
fun=strcat('log(1-((b+sqrt(b.^2-0.1^2))./0.1)./',num2str(k),')');
end

%%% example03 %%%%
z=linspace(-0.1,0.1);
a=0.1;
kesi=(z+sqrt(z.^2-a^2))./a;
for i=1:length(z)
k=kesi(i);
fun=inline(subs('log(1-((b+sqrt(b^2-0.1^2))/0.1)/kesi)','kesi',k));
end

%%% example04 %%%%
z=linspace(-0.1,0.1);
a=0.1;
kesi=(z+sqrt(z.^2-a^2))./a;
ff=@(k) ['log(1-((b+sqrt(b.^2-0.1^2))./0.1)./',num2str(k),')'];
for i=1:length(z)
IIII(i)=f(kesi(i));
end

%%% example05 %%%%
clear all;clc;
a=0.1;
z=linspace(-0.1,0.1);
kesi=(z+sqrt(z.^2-a^2))./a;
y=zeros(size(z));
for ii=1:length(z)
IIIII(ii)=f(kesi(ii));
end

%%example06 %%%%
a=0.1;
z=linspace(-0.1,0.1);
kesi=(z+sqrt(z.^2-a^2))./a;

example 1,3,5,6 get the same results, but 2,4 get the anoth results.

anybody know why?

2. Nov 20, 2007