There is data that I am trying to calculate its cumulative loss using NIntegrate. Here is the example.
x = Range[1, 10, 1];
y = Range[0.91, 1, 0.01];
soldata = Transpose[{x, y}];
sol = Interpolation[soldata, InterpolationOrder -> 1];
a = Range[1.0, 0.55, -0.05];
b = sol[Range[1, 10, 1]];
c = a*b;
solwave = Range[1, 10, 1];
wtsoldata = Transpose[{solwave, c}];
wtsol = Interpolation[wtsoldata, InterpolationOrder -> 1];
intwtsol = NIntegrate[wtsol[x], {x, 1, 10}];
intsol = NIntegrate[sol[x], {x, 1, 10}];
wttran = intwtsol/intsol 100
cumulloss = 100 - wttran
sol is an example data points, and wtsol is a weighted data points, and wttran is a normalized value (Integration of wtsol / integration of sol) in full range (1~10)
I'd like to calculate "wttran" with varying the range, like 2, 3, ....9, 10. So, I can see its cumulative loss (100-wttran). But when I make it as a function of range, it keeps give me errors.
This is what I tried.
z = Range[2, 10, 1]
intwtsol[z_] = NIntegrate[wtsol[x], {x, 1, z}];
intsol[z_] = NIntegrate[sol[x], {x, 1, z}];
wttran[z_] = intwtsol/intsol 100;
cumulloss = 100 - wttran
Any help will be very appreciable.