Solving Integral Equations - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: Solving Integral Equations (/thread-13506.html) Solving Integral Equations - Eddie W. Shore - 08-24-2019 03:34 PM The program INTEGRALSOLVE solve the following equation: (Format: ∫( integrand dvar, lower, upper) ∫( f(t) dt, 0, x) = a ∫( f(t) dt, 0, x) - a = 0 It is assumed that x>0. We can use the Second Theorem of Calculus which takes the derivative of the integral: d/dx ∫( f(t) dt, a, x) = f(x) We don't have to worry about lower limit a at all for the theorem to work. ∫( f(t) dt, 0, x) - a Take the derivative with respect to x on both sides (d/dx): = d/dx ∫( f(t) dt, 0, x) - a = d/dx ∫( f(t) dt, 0, x) - d/dx a Let F(t) be the anti-derivative of f(t): = d/dx (F(x) - F(0)) - 0 = d/dx F(x) - d/dx F(0) F(0) is a constant. = f(x) Newton's Method to find the roots of f(x) can be found by the iteration: x_(n+1) = x_n - f(x_n) / f'(x_n) Applying that to find the roots of ∫( f(t) dt, 0, x) - a: x_(n+1) = x_n - (∫( f(t) dt, 0, x_n) - a) / f(x_n) Program: Code: ```EXPORT INTEGRALSOLVE(f,a,x) BEGIN // f(X) as a string, area, guess // ∫(f(X) dX,0,x) = a // EWS 2019-07-26 // uses Function app LOCAL x1,x2,s,i,w; F0:=f; s:=0; x1:=x; WHILE s==0 DO i:=AREA(F0,0,x1)-a; w:=F0(x1); x2:=x1-i/w; IF ABS(x1-x2)<1ᴇ−12 THEN s:=1; ELSE x1:=x2; END; END; RETURN approx(x2); END;``` Example 1: ∫( 2*t^3 dt, 0, x) = 16 Guess = 2 Root ≈ 2.3784 Example 2: ∫( sin^2 t dt, 0, x) = 1.4897 Guess = 1 (Radians Mode) Root ≈ 2.4999 Source: Green, Larry. "The Second Fundamental Theorem of Calculus" Differential Calculus for Engineering and other Hard Sciences. Lake Tahoe Community College. http://www.ltcconline.net/greenl/courses/105/Antiderivatives/SECFUND.HTM Retrieved July 25, 2019 Blog entry: http://edspi31415.blogspot.com/2019/08/hp-prime-and-ti-nspire-cx-cas-solving.html RE: Solving Integral Equations - Albert Chan - 08-24-2019 09:07 PM Hi, Eddie My guess is the integral calculations will take the most time. Instead of always do integral from 0 to x, why not re-use old integral calculations ? ∫(f(u), u=0 to x) = ∫(f(u), u=0 to t) + ∫(f(u), u=t to x) (08-24-2019 03:34 PM)Eddie W. Shore Wrote:  ∫( sin^2 t dt, 0, x) = 1.4897 Guess = 1 (Radians Mode) Root ≈ 2.4999 This is my Mathematica code, only for proof of concept. Quote:f[x_] := Sin[x]^2; F[a_,b_] := Integrate[f[x], {x,a,b}]; a = 1.4897 newton[{x_,t_,Ft}] := Module[{Fx = Ft + F[t,x]}, {x - (Fx-a)/f[x], x, Fx}]; newton[x_] := newton[{x,0,0}] > NestList[newton, 1.0, 5] {1.0, ﻿ ﻿{2.71878, 1., 0.272676}, ﻿ ﻿{2.38150, 2.71878, 1.54649}, ﻿ ﻿{2.48529, 2.38150, 1.44043}, ﻿ ﻿{2.49964, 2.48529, 1.48436}, ﻿ ﻿{2.49991, 2.49964, 1.4896}} Note: x=2.49991 already converged to 1.4897. The value 1.4896 were previous integral, 0 to 2.49964