numeric Flashcards
How many bits of computer memory are used when storing a single
32
How many bits of computer memory are used when storing a double
64
How many bits of computer memory are used when storing a long double
80
In a double, how are the bits distrbuted among sign, exponent and significant
1 sign, 11 exponent and 52 mantissa
In a single, how are the bits distrbuted among sign, exponent and significant
1 sign, 8 exponents and 23 mantissa
What is an Mantissa
It is the part of a logarithm after the decimal point.
What are, in absolute value, the largest and smallest numbers representable as doubles?
E=0 and E=2047
Find the absolute round-off error of the numbers below when represented as a double.
- 1415
- 022140857*10^23
- 8*10^(-10)
number_one = 3.1415 *2.22*10**-16 number_two = 6.022140857*10**23*2.22*10**-16 number_three = 0.8*10**-10*2.22*10**-16
Hva kjennetegner komposittmetoder for numerisk integrasjon?
Korrekt svar: Komposittmetoder baserer seg på å splitte integrasjonsintervallet i flere
subintervaller
Rangér metodene fra mest til minst restriktive konvergensbetingelser.
Newton > secant > bisection
Newton > bisection > secant
secant > bisection > Newton
bisection > secant > Newton
Newton > sekant > biseksjon
Hva er usant om algoritmer for å finne nullpunkt til ikke-lineære funksjoner?
Korrekt svar: Biseksjonsmetoden baserer seg på å følge tangentlinjene til funksjonen
Hva er hensikten med partiell pivotering i Gauss-eliminasjon?
Korrekt svar: Å redusere regnefeil som følge av flyttallspresisjon
Heuns metode er et eksempel på…
Korrekt svar: En to-stegs metode
Adaptiv Simpsons metode er…
Korrekt svar: Et eksempel på en rekursiv algoritme
Hva er usant om flyttall?
Korrekt svar: Det er uproblematisk å sjekke likhet mellom to flyttall
Hvilken algoritme brukes for å beregne bestemte integraler?
Korrekt svar: Trapesmetoden
Hva er en rimelig kontrollstruktur å bruke når man skal implementere Newtons metode?
Korrekt svar: En while-løkke
Hva kan man ikke bruke feilestimater for integrasjonsmetoder til?
Korrekt svar: Gi eksakte svar på integralene
How can one deduce the secant method from Newton’s method
Exchange the derivative in Newton’s method for a difference approximation.
Will Newton’s method always converge to a zero?
No, because the converge is reliant on the function and the point
If no derivative is available, which method should you choose - Newton’s method or the secant method?
The secant method
Which method is the safest to use - Newton’s method, the secant method or the bisection method?
Bisection
Which method is the slowest to use - Newton’s method, the secant method or the bisection method?
Bisection
What is Tuple
Tuples are used to store multiple items in a single variable.
What characterises a composite method for numerical integration?
- Simpsons rule cannot be generalized to a composite rule
- Composite rules are based on splitting the integration interval into several subintervals
- Composite rules are based on combining the midpoint and trapezoidal rules
- It is impossible to make error estimates for composite rules
Komposittmetoder baserer seg på å splitte integrasjonsintervallet i flere
subintervaller
What is false about algorithms for finding zeroes of nonlinear functions?
- Newton’s method can be generalized to multidimensional functions by using Jacobi matrices
- The secant method does not require information about the derivative of the function
- Newton’s method requires that one decides upon a set of stopping conditions
- The bisection method is based on following the tangent lines of the function
Biseksjonsmetoden baserer seg på å følge tangentlinjene til funksjonen
What is the purpose of partial pivoting in Gaussian elimination?
- Making it easier to perform back substitution
- To have a fixed plan for which rows to swap
- Sorting the matrix
- To reduce computational errors due to floating point
precision
Å redusere regnefeil som følge av flyttallspresisjon
Heun's method is an example of... An adaptive method A first order method An implicit method A two-step method
En to-stegs metode
The adaptive Simpson’s method is…
- a version of Simpson’s method which can be adapted to find the zeroes of functions
- an ODE solver that can be implicit or explicit as needed
- an ODE solver with adaptive step lengths
- an example of a recursive algorithm
- an example of a recursive algorithm
What is untrue about floating point numbers?
- Adding large and small floating point numbers can lead to considerable roundoff errors
- It is unproblematic to check for equality between two floating point numbers
- Multiplication of floating point numbers leads to minor computational errors only
- A floating point number is represented by a sign, an exponent and a mantissa
It is unproblematic to check for equality between two floating point numbers
Which of these methods are used to approximate definite integrals?
- Gaussian elimination
- The trapezoidal rule
- The secant method
- Implicit Euler
The trapezoidal rule
What is a reasonable control structure to use when implementing Newton’s method?
- A case block
- A while loop
- An if-then-else structure
- A for loop
- A while loop
What can we not use error estimates for numerical integration methods for?
- Give exact values of the integrals
- Give uncertainty estimates on the approximated value of an integral
- Make adaptive versions of methods such as the adaptive Simpson’s rule
- Choose the amount of intervals so that you get a guaranteed upper error bound
Give exact values of the integrals
Et flyttall a representeres i datamaaskinen binært som a= (-1)^sg * 2^e-b *s, Sg står for sign og er 0 eller 1, og e er exponent. Hva er b i denne sammengen.
- bias (forskyvning), et forhåndsbestemt heltall som muliggjør negative eksponenter
- Blanks, et helltatt som sier hvor mange innledende nuller det er bak komma i det opprinnelige tallet.
- binary - Et tall som justerer eksponenten til binære form
S i formelen : a= (-1)^sg * 2^e-b *s, står for “signifikand” men hva slags tall er dette?
- Et tall mellom 1 og 2 på formen s = 1.s1s2s3s4s5… hvor hver si er en bit i s
- Et tall mellom 0 og 1 på formen 0.s1s2s3s4, hvor hver si er en byte
- Et heltall mellom -1.s1s2s3s4 og s.s1s2s3s4
Et tall mellom 1 og 2 på formen s = 1.s1s2s3s4s5… hvor hver si er en bit i s
Gitt at alle tre metodene virker i den aktuelle situasjonen. Hvilken metode konvergerer raskest av biseksjonsmetoden, newtons metode og sekantmetoden
newtons metoden
Hva er ulempen med Newtons metode?
- vi må kjenne den deriverte til funksjonen
- metoden virker ikke hvis funksjonen stiger svært raskt
- resultatet blir ikke like nøyaktig som med sekantmetoden
vi må kjenne den deriverte til funksjonen
Hva er betingelsene for at Gauss-eliminasjon skal fungere
- fungerer såfremt den andrederiverte til funksjonen er ulik null i det aktuelle området.
- Fungerer såframt ligningssystemet har en løsning
- Fungerer såframt alle koeffisientene er heltall.
Fungerer såframt ligningssystemet har en løsning
Hva er forskjellen på eksplisitt og implisitt Euler - metode?
- Eksplisitt virker med færre datapunkter enn implisitt metode
- Eksplisitt er raskere men mindre stabil enn implisitt
- eksplisitt er tregere, men gir mindre avrundingsfeil enn implisitt.
- Eksplisitt er raskere men mindre stabil enn implisitt
Hva er poenget med pivotering i gauss-eliminasjon?
- Beregninger går raskere
- Løsningen blir mer presis
- Man kan håndtere spesialtilfeller der gauss-eliminasjon uten pivotering ikke gir noen løsning.
- Løsningen blir mer presis
What is the difference between lists and tuples in Python?
- Tuples allow for direct lookup by element value, lists only by index.
- Lists can have duplicate elements, tuples can not
- Lists are mutable, tuples are non-mutable
- Lists are mutable, tuples are non-mutable
Sets in Python have…
- no duplicate elements and no fixed ordering of the elements
- no duplicate elements and elements in fixed order
- the possibility for duplicate elements, but the elements have no fixed ordering
- no duplicate elements and no fixed ordering of the elements
- 25E19 in Python is the same as
- 25*10**19
- 25math.e19
- 25**19
3.25*10**19
For which combination of variable values will this formula give very bad precision if we translate it
directly to Python as e.g. x1 = (-b - math.sqrt(b2 - 4ac))/(2a) and x2 = (-b + math.sqrt(b**2 -
4ac))/(2a) ?
a = 10^8, b = 1, c = 1 a = 1, b = 10^8 , c = 1 a = 1, b = 1, c = 10^8
a = 1, b = 10^8 , c = 1
(grunnen til dette er at her blir b**2 svært dominerende i kvadratrotuttrykket, slik at vi
subtraherer to nesten like tall, dermed mister vi presisjon)
The assignment X = { } in Python initializes X as
- an empty dictionary
- an empty set
- an empty set or dictionary, exactly which is determined once an element is added to it
an empty dictionary
What characterises a composite method for numerical integration?
- Simpsons rule cannot be generalized to a composite rule
- Composite rules are based on splitting the integration interval into several subintervals
- Composite rules are based on combining the midpoint and trapezoidal rules
It is impossible to make error estimates for composite rules
Composite rules are based on splitting the integration interval into several subintervals
Arrange the methods from most to least restrictive convergence requirements. Newton > secant > bisection Newton > bisection > secant secant > bisection > Newton bisection > secant > Newton
Newton > secant > bisection
What is false about algorithms for finding zeroes of nonlinear functions?
- Newton’s method can be generalized to multidimensional functions by using Jacobi matrices
- The secant method does not require information about the derivative of the function
- Newton’s method requires that one decides upon a set of stopping conditions
- The bisection method is based on following the tangent lines of the function
The bisection method is based on following the tangent lines of the function
What is the purpose of partial pivoting in Gaussian elimination?
- Making it easier to perform back substitution
- To have a fixed plan for which rows to swap
- Sorting the matrix
- To reduce computational errors due to floating point precision
To reduce computational errors due to floating point precision
Heun’s method is an example of… (trapez)
- An adaptive method
- A first order method
- An implicit method
- A two-step method
- A two-step method
The adaptive Simpson’s method is…
- a version of Simpson’s method which can be adapted to find the zeroes of functions
- an ODE solver that can be implicit or explicit as needed
- an ODE solver with adaptive step lengths
- an example of a recursive algorithm
an example of a recursive algorithm
What is untrue about floating point numbers?
- Adding large and small floating point numbers can lead to considerable roundoff errors
- It is unproblematic to check for equality between two floating point numbers
- Multiplication of floating point numbers leads to minor computational errors only
- A floating point number is represented by a sign, an exponent and a mantissa
- It is unproblematic to check for equality between two floating point numbers
Which of these methods are used to approximate definite integrals?
- Gaussian elimination
- The trapezoidal rule
- The secant method
- Implicit Euler
- The trapezoidal rule
What is a reasonable control structure to use when implementing Newton's method? A case block A while loop An if-then-else structure A for loop
A while loop
What can we not use error estimates for numerical integration methods for?
- Give exact values of the integrals
- Give uncertainty estimates on the approximated value of an integral
- Make adaptive versions of methods such as the adaptive Simpson’s rule
- Choose the amount of intervals so that you get a guaranteed upper error bound
Give exact values of the integrals
Select a condition that must be satisfied for Newton’s method to converge when solving a scalar non-linear
equation
- The exact solution must be near x = 0
- The function must be differentiable for all values of x
- Your initial guess must be close enough to the exact solution
Your initial guess must be close enough to the exact solution
Select the true statement about composite integration methods
- They use the same integration rule on smaller intervals
- They use different integration rules for the same function
- They are less accurate than non-composite methods
They use the same integration rule on smaller intervals
A partial pivoting step is implemented in Gaussian elimination to…
- mitigate errors due to finite-precision arithmetic
- correctly sort the matrix so we can do row operations in an easier way
- speed up the Gaussian elimination algorithm
- mitigate errors due to finite-precision arithmetic
You are solving an ordinary differential equation. Select the main reason that one would prefer to use a higher
order method over a lower order method (with the same time-step)?
- To increase the stability of the method
- To increase the accuracy of the solution
- To increase the speed of the method
To increase the accuracy of the solution
What is true about 32-bit integer data types:
- Checking for equality between integers is a safe to do
- You can represent any integer in Python using this data type
- You must take into account round off errors when adding large integers to small integers
- Checking for equality between integers is a safe to do
converging for this particular equation. You are not interested in the speed of your code and would like to switch your algorithm. Suggest an alternative algorithm that will ensure that that your code converges to the correct solution
- Use the backward Euler method
- Use the bisection method
- Use the secant method first, then swap back to Newton’s method.
Use the bisection method
Select the statement that is false about the Simpson method:
- The Simpson method is based on the exact integral of a quadratic polynomial approximation of
- The Simpson rule will exactly integrate functions whose fourth derivative (and higher derivatives) are
zero.
- The Simpson method becomes less accurate the smaller the interval becomes
The Simpson method becomes less accurate the smaller the interval becomes
What is false about the adaptive Simpson method
- It uses an optimum time step size to solve an ODE to within a user-specified tolerance level.
- It is a recursive method
- It uses an optimum interval size to solve an integral to within a user-specified tolerance level.
- It uses an optimum time step size to solve an ODE to within a user-specified tolerance level.
Floating points numbers in Python…
- are not associated with the concept of round-off errors
- can be arbitrary large
- are represented as a long sequence of bits
- are represented as a long sequence of bits