Some exercises Dr.Entesar Ganash.

Slides:



Advertisements
Similar presentations
Graphs of the Sine and Cosine Functions Section 4.5.
Advertisements

Flowchart What is a flowchart? A flowchart is a schematic representation of an algorithm or a process or a program. Why should a flowchart be produce before.
What’s Your Guess? Chapter 9: Review of Convergent or Divergent Series.
Solving Equations = 4x – 5(6x – 10) -132 = 4x – 30x = -26x = -26x 7 = x.
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
Chapter 10 Modules and programming with subroutines.
5.5 Solving Trigonometric Equations Example 1 A) Is a solution to ? B) Is a solution to cos x = sin 2x ?
FP1: Chapter 2 Numerical Solutions of Equations
Special Sum The First N Integers. 9/9/2013 Sum of 1st N Integers 2 Sum of the First n Natural Numbers Consider Summation Notation ∑ k=1 n k =
Maths revision course by Miriam Hanks
Multiple Solution Problems
Large problems can be divided into smaller sub - problems ♦ each sub - problem can be solved separately in order to reach to the solution of the original.
Fixed-Point Iteration Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm.
REVIEW 7-2. Find the derivative: 1. f(x) = ln(3x - 4) x f(x) = ln[(1 + x)(1 + x2) 2 (1 + x3) 3 ] ln(1 + x) + ln(1 + x 2 ) 2 + ln(1 + x.
AAT SEMESTER 2 REVIEW Lets Get Rich. Polynomials Find the zeroes of the polynomial f(x)= with a given factor (x-3)
Jeopardy Math Review Unit 1: Functions and Their Graphs Unit 2: Polynomial and Rational Functions Unit 3: Exponential and Logarithmic Functions Unit 4:
Double Angle Formulas T, 11.0: Students demonstrate an understanding of half-angle and double- angle formulas for sines and cosines and can use those formulas.
Sec. 5.1b HW: p odd. Solvein the interval or Reject sin(x) = 0…why??? So where is in ?
Advanced Program Design. Review  Step 1: Problem analysis and specification –Specification description of the problem’s inputs and output –Analysis generalize.
The Convergence Problem Recall that the nth Taylor polynomial for a function f about x = x o has the property that its value and the values of its first.
solve x + (-16) = -12 solve x + (-16) = X = 4.
divergent 2.absolutely convergent 3.conditionally convergent.
BY: MARIAH & JON 13.4 INVERSE OF SINE AND TANGENT.
6.3 Graphing Sine and Cosine Functions. Periodic Functions A periodic function is a function with a repeating pattern this includes sin and cos graphs.
Periodic Functions. A periodic function is a function f such the f(x) = f(x + np) for every real number x in the domain of f, every integer n, and some.
6.3 – GRAPHING SINE AND COSINE FUNCTIONS. Periodic Function and Period  A function is periodic if, for some real number α, f(x + α) = f(x) for each x.
8.1-Law of the Sines Law of the Sines & Requirements Examples Practice Problems.
Making a decision … Now that you know 3 ways to solve a system of equations, how to choose which method to use when solving systems of equations.
Inverse Trig Functions Law of the Sines Notation Inverse Trig Functions, Law of the Sines & Requirements Practice Problems.
Everything you need to know , 5.5, 5.6 Review.
Describe the vertical shift in the graph of y = -2sin3x + 4. A.) Up 2 B.) Down 2 C.) Up 4 D.) Down 4.
Why Repetition? Read 8 real numbers and compute their average REAL X1, X2, X3, X4, X5, X6, X7, X8 REAL SUM, AVG READ *, X1, X2, X3, X4, X5, X6, X7, X8.
Review of Angles. Acute Angle – Angle less than 90 degrees Right Angle – Angle that is exactly 90 degrees.
Section 3.5 Trigonometric Functions Section 3.5 Trigonometric Functions.
Fundamental of Fortran Part 2 Dr.Entesar Ganash. 1. Program layout The general structure of a simple Fortran program is given as the following:
Ch. 10 – Infinite Series 9.1 – Sequences. Sequences Infinite sequence = a function whose domain is the set of positive integers a 1, a 2, …, a n are the.
X y y = sinx. x y y = cosx.
Convergence of Taylor Series Objective: To find where a Taylor Series converges to the original function; approximate trig, exponential and logarithmic.
Numerical Calculation Part 1: Equations &Roots Dr.Entesar Ganash (Bisection's Method)
Section 9.4 – Solving Differential Equations Symbolically Separation of Variables.
CSE 330: Numerical Methods. Introduction The bisection and false position method require bracketing of the root by two guesses Such methods are called.
Match cards in pairs then try to fill in table
Chapter 5 Numerical Root Findings
Review of radian measure.
Numeric Functions Purpose:-
Numerical Calculations Part 5: Solving differential equations
Derivative of f (x) =sin (x)
Programming in C Paper – VIII B.
Numerical Methods.
Aim: How do we convert radians to degrees and degrees to radians?
Unit #7: Trig Identities & Equations
Finding polynomial roots
Radian Measure of a Central Angle
Aim: How do we convert radians to degrees and degrees to radians?
Graphs of Trig Functions
Numerical Methods.
Class Notes 9: Power Series (1/3)
Equivalent Functions Composite Angles Exact Trig Ratios
Lecture 4 : January 2001 Dr. Andrew Paul Myers
Solving Trigonometric Equations
State the period, phase shift, and vertical shift
Unit #7: Trig Identities & Equations
See A3 sheet given out in Unit 1 For more solving techniques
3.8 Newton’s Method How do you find a root of the following function without a graphing calculator? This is what Newton did.
Newton’s Method and Its Extensions
5.5-Multiple Angle Formulas
11-6. Convergent Geometric Series
Exercise Every positive number has how many real square roots? 2.
2 4 −4 −2 −5 −3 −
REPETITION Why Repetition?
Presentation transcript:

Some exercises Dr.Entesar Ganash

Exercise 1 Write a program to re-calculate the problem 1 but now using Newton’s method to solve numerically the last equation, starting with x=0 .5 and stopping either when the absolute value of the function is less than or after 20 repetitions. Using IF statements & GO TO statement instead of Do While statement. Compare the results from both problems. Solving PROGRAM NEWTON IMPLICIT NONE Integer::k ! a counter Real :: Eps ,x ! required accuracy (epsilon) & staring guess k=0 Eps=1.0E-6 x=0.5 write(*,*)' ','x',' ', 'f(x)' write(*,*)'----------------------------------‘

continue Solving 1 10 If ((ABS(f(x))<=Eps) .OR. (k> 20)) then write(*,*)x, f(x) Else x=x-f(x)/df(x) k=k+1 Go to 10 End if write(*,*)'----------------------------------' IF (ABS(f(x))<=Eps)THEN Write(*,*)'Newton converged' ELSE Write(*,*)'Newton diverged' END IF Contains !-------------------------- !Function Subprogram f is to solve f(x)=0 REAL FUNCTION f(x) Implicit none Real::f,x f=x-0.2*sin(x)-0.5 End FUNCTION f continue Solving 1

continue Solving 2 !-------------------------- !Anther Function Subprogram df REAL FUNCTION df(x) Implicit none Real::df,x df=1.0-0.2*cos(x) End FUNCTION df END PROGRAM NEWTON continue Solving 2

The result:

Exercise 2 Solving Write a program to calculate in radians for ten terms, When Then calculates the sine using the sine intrinsic function Hint: n! = n*(n-1)*(n-2)*….*3*2*1. Solving ROGRAM SUMSIN Implicit none Integer:: I,K ! counters Real :: theta ,factn,sum,PI ! angle, factorial value, summation & Constant Real :: inf ! avariable symbol PI=3.141592654 THETA=45.0 !in degree THETA=THETA*PI/180.0 ! to convert to rad

continue Solving sum=0.0 ! intial value DO K=1,10 ! number of term factn=1.0 DO I=2*K-1,1,-1 factn=factn*I ENDDO sum=sum+(-1)**(k-1)*theta**(2*k-1)/factn print*,K,SUM ! FROM intrinsic function inf=SIN(THETA) print*,'---------------------------------' PRINT*, 'SIN(THETA)from intrinsic function' PRINT*, 'SIN(THETA)=',inf END PROGRAM SUMSIN continue Solving

The result: