Tölvunarfræði Kraftbendilsglærur Vikublað 12. Dæmi 1a.

Slides:



Advertisements
Similar presentations
Lecture 5 Fixed point iteration Download fixedpoint.m From math.unm.edu/~plushnik/375.
Advertisements

Regula-Falsi Method. Type of Algorithm (Equation Solver) The Regula-Falsi Method (sometimes called the False Position Method) is a method used to find.
Solving Equations = 4x – 5(6x – 10) -132 = 4x – 30x = -26x = -26x 7 = x.
Bisection Method (Midpoint Method for Equations).
ART á Suðurlandi - Kynning - Bjarni Bjarnason verkefnisstjóri.
Scripts and Flow Control. Scripts So far we have been entering commands directly into the command line But there is a better way Script files (and functions)
Áhugasamir nemendur – Árangursríkt skólastarf Þróunarverkefni í Heiðarskóla 2010.
CIS 101: Computer Programming and Problem Solving Lecture 7 Usman Roshan Department of Computer Science NJIT.
Allskonar kynjasamþætting Halldóra Gunnarsdóttir Mannréttindaskrifstofu Reykjavíkurborgar.
Mánudagshlaup, Hlaupari: Ágúst Vegalengd: km Tími:1:24:33 Meðaltempó: 5:11 min/km.
©2001 Þórdís Hrefna Ólafsdótttir
Líkamstjáning mannsins Þróun mannsins Kolbrún Franklín.
Normaldreifing  Graf sérhverrar normaldreifingar er bjöllulaga.
Aðgengi fatlaðra að vefsíðum. Áætlað er að um 20% af notendum Internetsins á aldrinum ára eigi við einhvers konar fötlun að stríða. Margar lausnir.
Lectures on Numerical Methods 1 Numerical Methods Charudatt Kadolkar Copyright 2000 © Charudatt Kadolkar.
Second-line treatment in advanced colon cancer: are multiple phase II trials informative enough to guide clinical practice? Bjarki Þorvaldur Sigurbjartsson.
Tölvunarfræði Vikublað 10. Einkunnargjöf Dæmi 1 - 4stig Dæmi 2 - 0stig Dæmi 3 - 4stig Dæmi 4 - 0stig Dæmi 5 - 4stig.
5.5 Solving Trigonometric Equations Example 1 A) Is a solution to ? B) Is a solution to cos x = sin 2x ?
Technical Question Technical Question
6-5 The Quadratic Formula and the Discriminant
Lífeyrissjóður bankamanna Helstu atriði breytingartillagna Framhalds ársfundur 20. september 2007.
16/07/2015Dr Andy Brooks1 TFV0103 Tölfræði og fræðileg vinnubrögð Fyrirlestur 12 Kafli 9.1 Inference about the mean μ (σ unknown) Ályktun um meðaltalið.
The Midpoint Formula. The purpose of the midpoint formula The midpoint formula is used to find the midpoint or the halfway point of a line segment or.
Fin500J: Mathematical Foundations in Finance Topic 3: Numerical Methods for Solving Non-linear Equations Philip H. Dybvig Reference: Numerical Methods.
- + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Scientific Computing Algorithm Convergence and Root Finding Methods.
Algorithmic Recursion. Recursion Alongside the algorithm, recursion is one of the most important and fundamental concepts in computer science as well.
Solving equations numerically The sign - change rule If the function f(x) is continuous for an interval a  x  b of its domain, if f(a) and f(b) have.
ROOTS OF EQUATIONS. Bracketing Methods The Bisection Method The False-Position Method Open Methods Simple Fixed-Point Iteration The Secant Method.
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
Solution of Nonlinear Equations Topic: Bisection method
Numerical Methods Solution of Equation.
Jarrod Asuncion Period 1 Brose. Equation f(b) – f(a) = f’(c) b – a Slope = f’(c)
Loops CS 103 February 13, 2009 Author: Nate Hamm.
Solving a Trigonometric Equation Find the general solution of the equation.
Recursive Methods for Finding Roots of Functions Bisection & Newton’s Method.
Chapter 5 Numerical Root Findings
EEE 244-3: MATRICES AND EQUATION SOLVING
Engineering Problem Solution
Solution of Nonlinear Equations (Root finding Problems
Using Technology to Solve More Complex Equations 5.3
Notes Over 9.6 An Equation with One Solution
تصمیم‌گیری و کنترل روند، استفاده از حلقه‌ها و دستورات شرطی در متلب
Rými Reglulegir margflötungar
Mismunandi bylgjuhreyfingar: þverbylgja, langsbylgja, yfirborðsbylgja
Find all solutions of the equation
Helstu hreyfingar beina út frá liðum
What is an equation? An equation is a mathematical statement that two expressions are equal. For example, = 7 is an equation. Note: An equation.
Ritstuldarvarnir með Turnitin
FYLGJUMST MEÐ ! MSN spjallið Um hvað eru krakkarnir að spjalla ?
með Turnitin gegnum Moodle
 (skilgreining þrýstings)
FYLGJUMST MEÐ ! MSN spjallið Um hvað eru krakkarnir að spjalla ?
SOLUTION OF NONLINEAR EQUATIONS
Þuríður Hjálmtýsdóttir Fjölskylduráðgjafi/sálfræðingur
Examples Double Angle Formulas
Hypothesis Testing Kenningapróf
KÆL 102 Á heimasíðu danfoss
ROOTS OF EQUATIONS.
sin x cos x tan x 360o 90o 180o 270o 360o 360o 180o 90o C A S T 0o
Umhverfisvæn tækni Sóknarfæri fyrir Ísland
Nonparametric Statistics Tölfræði sem ekki byggir á mati stika
EEE 244-3: MATRICES AND EQUATION SOLVING
Print the following triangle, using nested loops
Nonparametric Statistics Tölfræði sem ekki byggir á mati stika
Solving Systems of Equations by Elimination Part 2
Goodness-of-Fit Tests and Contingency Tables
Objective: Finding solutions of trigonometric equations.
Upptaka á hvalahljóðum
Presentation transcript:

Tölvunarfræði Kraftbendilsglærur Vikublað 12

Dæmi 1a

% I = a, b, n) finnur heildið af f frá a til b með Simpsonsreglu og % n hlutbilum. function I = simpson(f, a, b, n) h = (b-a)/n; S1 = 0; S2 = 0; for i = 1:n yi = a + (i-0.5)*h; S1 = S1 + f(yi); end for i = 1:n-1 xi = a + i*h; S2 = S2 + f(xi); end I = (h/6)*(f(a) + 4*S1 + 2*S2 + f(b)); end

Dæmi 1b Athugum að markgildið af sin(x)/x þegar x stefnir á 0 er 1 svo það er vandalaust að nálga svarið með því að heilda frá ε til pi/2. Með num2str(simpson(f,eps,pi/2,500),'%.5f') fæst að með 5 aukastöfum er heildið Með því að prófa sig áfram með mismunandi n komumst við að því að 4 hlutbil duga til að fá þessa 5 aukastafi rétta, en n = 3 gefur Til að fá þetta rétt með heildinu úr sýnidæmi 23 reynist þurfa n = 108 hlutbil.

Dæmi 7.1 Búa til töflu yfir horn Tafla yfir sin(x) á 10 mínútna bili x ° 0' 10' 20' 30' … …

Dæmi 7.1 for i=1:90 for j=1:6 G(i,j) = (i-1) + (j-1)/6; end sinG = sin(G); fprintf('Tafla yfir sin(x) á 10 mínútna bili\n'); fprintf('xº 0'' 10'' 20'' 30'' 40'' 50''\n'); for i=1:90 gradur = i-1; fprintf('%-3d', gradur) fprintf('%8.4f', sinG(i,:)) fprintf('\n') end

Næst

9.1 Write a command script that asks the user for a number n and subsequently displays a Pascal triangle with n lines. This is a Pascal triangle with 4 lines:

Given a function f and and interval [a, b] such that the sign of f at a is different form the sign at b then the bisection method for solving f (x) = 0 with accuracy e is described by the following algorithm: loop while b – a < 2e m  if sign of f at a is different from sign of f at m then b  m else a  m end-if end-loop x  Write a matlab function that solves f (x) = 0 with this method. The function shall have the function f, the interval [a, b], and the accuracy required eps as parameters. It should return the solution, the needed number of iterations (n). The function head could for example be [x,n] = bisection(f,a,b,eps). Try the function by determining the three smallest solutions to the equation x + 1 = tan x.