Question:
A doubt about trapezoidal-integration rule?
2013-03-08 10:08:25 UTC
I used this method for solving a differential equation in which the initial conditions are provided. should i incorporate this value? or take y1 as y0 instead.runge kutta method needs this initial value, but how can i do the same with trapezoidal method? please help.
Three answers:
2013-03-08 10:41:20 UTC
when using numerical integration strategies, there are two errors to consider -- the step-wise error and the global error.



in principle, the objective is to estimate the solution y = y(x) at some value of x > x0, where you are given the initial condition y(x=x0) = y0. the (initial) basic strategy is to divide the interval between x0 and the target x (call it xN) into N+1 evenly sized steps of size h, then advance the solution from y(x=x{j}) to y(x=x{j}+h = x{j+1}) using some strategy y(x{j+1}) = y(x{j}) + F(x{j},x{j+1},y{j},y{j+1}) such that the strategy F is CONSISTENT with the governing ODE dy/dx = f(x,y).



when doing the step-wise error analaysis, you usually expand each of the terms in a Taylor series expansion about x=x0, then you should find that the zero-th order terms in x go away, the ODE provides the relationship that ensures the 1st order terms (in x) go away, then what remains is the step-wise discretization error of the method. centered differencing schemes tend to get you an extra order of accuracy -- the 2nd order terms also go away due to the nature of the centered differencing (as opposed to an upwind differencing strategy). Using these techniques, you should be able to estimate the step-wise error associated with your trapezoidal method, and how the step-wise error is largely a function of the third derivative of f(x,y). [so if your f(x,y) is well-approximated by a 1st or 2nd order polynomial in (x,y), then that explains why your error doesn't change much with decreasing h.]



so with your trapezoidal rule, you've written the step-wise strategy -- how you go from one discrete value of x to estimate y at the next discrete value of x -- but you haven't specified anything about the global limits (how many steps you are taking to get from x0 to x1.) if you are only taking one step, then you're done, your global error and your local error are the same. however, your "take y1 as y0" question indicates that you might be taking more than one step, that you'll be stepping through y2,y3,y4, ... , yN.



in that case, you have little choice but to take y1 as y0 and implement your strategy again to get y2 from y1. then again to get y3 from y2, until you get yN from y{N-1}. In this case, you should see the local error changes with the third derivative in f(x,y) [if f(x,y) starts getting steep, your local error will skyrocket, but if f(x,y) remains smooth and slowly changing, your local error will always remain small and well behaved], and your global error is where the step-wise error will accumulate. The smaller your step, the smaller the step-wise error, but the more steps you take -- and so there may be an optimum step-size that minimizes the global error between step-size and number of steps. Generally, for well-behaved functions f(x,y) [smooth and continuous] there is no such optimum, and the multiplication of step-size and local-error leads to a saturated global error. However, if your f(x,y) is particularly badly behaved (not smooth or not continuous) then you should find that the decreasing the step size reduces the error over the smooth and continuous intervals, and that most of the global error comes from the regions where f(x,y) is not well-behaved.



that's where the hybrid methods come from -- they detect how rapidly f(x,y) is changing locally, then automagically adjust their step size to negotiate the rapidly changing part of the solution with better resolutions, then takes comparatively large steps over the well-behaved parts so as not to waste time/money/computing time doing high-resolution calculations over regions where not much is happening.
2016-12-12 21:29:05 UTC
ted s is right, different than he forgot the component, ½, needed to get the component to a trapezoid, given the perfect and the two bases: A = (ave of bases) x perfect = ½(B + b)h for this reason, the "perfect" is horizontal, and is in basic terms the sub-era width, it fairly is a million. So :3 ? f(x) dx ? ½[f(a million) + f(2)] + ½[f(2) + f(3)] = ½[f(a million) + 2f(2) + f(3)] = ½[f(a million) + f(3)] + f(2) a million and thank you to the fact the, for this reason, f(a million) = 0, this simplifies to f(2) + ½f(3) = ln2 + ½ln3 ? a million.242453 EDIT: For assessment, utilising Simpson's Rule with those comparable 3 sampled factors, A ? ?•2[f(a million) + 4f(2) + f(3)] = ?[4ln2 + ln3] ? a million.290400 and the perfect needed is : : : : : : : : : : |3 A = x(lnx - a million) | = 3 ln3 - 2 ? a million.295837 : : : : : : : : : : |a million
2013-03-08 10:10:22 UTC
WTF


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...