Document Details

PleasedSavannah

Uploaded by PleasedSavannah

MAP Department | Eulogio 'Amang' Rodriguez Institute of Science and Technology

Tags

numerical problems mathematics quadratic equations programming

Summary

This document presents an overview of numerical problems, focusing on topics like quadratic equations and programming. The presentation appears to be part of a course or curriculum material within the MAP department of EARIST Manila.

Full Transcript

First Numerical Problem: MAP Department|EARIST Manila Content Quadratic Equation 1st Order Differential Equation Euler’s Method An Introduction To Files And File Processing Radioactive Decay Quadratic Equation Quadratic Equation: from the Latin quadratus...

First Numerical Problem: MAP Department|EARIST Manila Content Quadratic Equation 1st Order Differential Equation Euler’s Method An Introduction To Files And File Processing Radioactive Decay Quadratic Equation Quadratic Equation: from the Latin quadratus for "square“ where x represents an unknown, and a, b, and c represent known numbers, where a ≠ 0 A quadratic equation with real or complex coefficients has two solutions, called roots. These two solutions may or may not be distinct, and they may or may not be real. Quadratic Equation can be solved: Factoring by inspection ( 𝑝𝑥 +𝑞 ) ( 𝑟𝑥+ 𝑠 ) =0 2 2 2 Completing the square 𝑥 + 2 h𝑥+ h =( 𝑥+ h ) − 𝑏 ± √ 𝑏 − 4 𝑎𝑐 2 Quadratic formula 𝑥= 2𝑎 1. PROGRAM quad 19. f=max(abs(a),abs(b),abs(c)) 2. IMPLICIT none 20. r=a/f 3. double precision:: a,b,c,f 21. s=b/f 4. double precision:: root1,root2 22. t=c/f 5. logical:: error 23. d=sqrt(s*s-4.0*r*t) 6. write(*,*)"Enter the value of a,b,c" 24. if (s>0.0) then 7. read (*,*) a,b,c 25. root1=(-s-d)/(r+r) 8. CALL quad_roots(a,b,c,root1,root2,error) 26. else 9. write(*,*)"root1=",root1,"root2=",root2 27. root1=(-s+d)/(r+r) 10. end PROGRAM quad 28. end if 11. subroutine quad_roots(a,b,c,root1,root2,error) 29. root2=(t/r)/root1 12. implicit none 30. end subroutine quad_roots 13. double precision :: a,b,c 14. double precision :: root1,root2 15. logical :: error 16. double precision :: f,r,s,t,d 17. error = a==0 18. if (a==0) STOP Avoiding Loss of Significance Line 19-22 uses MAX to find the largest value for the scaled coefficients Scaled coefficients are used for faster calculation assuming the coefficient Line 29 is for roots that are very close to each other. Scaled coefficient serves as approximations which sacrifices the range and precision The program shown works for coefficient in same magnitude and for a

Use Quizgecko on...
Browser
Browser