Julia Calculator ( Introduction)
|
|
- Percival Hunter
- 5 years ago
- Views:
Transcription
1 Julia Calculator ( Introduction) Julia can replicate the basics of a calculator with the standard notations. Binary operators Symbol Example Addition = 4 Substraction 2*3 = 6 Multify * 3*3 = 9 Division / 8/4 = 2 Basics of PEMDAS The standard order of the basic mathematical operations is remembered by many students through the mnemonic PEMDAS, which can be misleading, so we spell it out here: ( P ) First parentheses ( E ) then exponents (or powers) ( MD ) then multiplication or division ( AS ) then addition or subtraction. This has the precedence of multiplication ( MD ) higher than that of subtraction ( AS ), as just mentioned. Applying this, if we have the mathematical expression We know that the subtraction needs to be done before the division, as this is how we interpret this form of division. How to make this happen? The precedence of parentheses is used to force the subtraction before the division, as in (12 10)/2. Without parentheses you get a different answer: (12 10)/2, 12 10/2 (1.0,7.0) Same precedence what to do There is a little more to the story, as we need to understand what happens when we have more then one operation with the same level. For instance, what is 234? Is it 234 or 234.
2 Unlike addition, subtraction is *not associative8 so this really matters. The subtraction operator is left associative meaning the evaluation of 234 is done by 234. The operations are performed in a left to right manner. Most but not all operations are left associative, some are right associative and performed in a right to left manner. right to left It is the order of which operation is done first, not reading from right to left, as one might read Arabic. To see that julia has left associative subtraction, we can just check , (2 3) 4, 2 (3 4) ( 5, 5,3) Not all operations are processed left to right. The power operation, ^, is right associative, as this matches the mathematical usage. For example: 4^3^2, (4^3)^2, 4^(3^2) (262144,4096,262144) What about the case where we have different operations with the same precedence? What happens then? A simple example would be 234? Is this done in a left to right manner as in: (2 + 3) 4 1 Or a right to left manner, as in: 2 + (3 4) 1 And the answer is left to right: Practice Which of the following is a valid julia expression for 3241
3 that uses the least number of parentheses? (3 2)/ 4 1 (3 2) / (4 1) 3 2 / (4 1) Wich of the following is a valid julia expression for 324 that uses the least number of parentheses? 3 * 2 / 4 (3 * 2) / 4 Wich of the following is a valid julia expression for 242 that uses the least number of parentheses? (2 ^ 4) 2 2 ^ (4 2) 2 ^ 4 2 One of these three expressions will produce a different answer, select that one: 2 3 4
4 (2 3) 4 2 (3 4) One of these three expressions will produce a different answer, select that one: (2 3) * 4 2 (3 * 4) 2 3 * 4 Unary operator: the minus sign One of these three expressions will produce a different answer, select that one: (1^2) 1^2 ( 1)^2 Compute the value of Compute the following using julia : Compute the decimal representation of the following using julia :
5 Incorrect Compute the following using julia : Compute the following using julia : Using functions Most all calculators used are not limited to these basic arithmetic operations. So called scientific calculators provide buttons for many of the common mathematical functions, such as exponential, logs, and trigonometric functions. Julia provides these too, of course. There are special functions to perform common powers. For example, the square root function is used as: sqrt(15) This shows how to evaluate a function using its name and parentheses, as in function_name(arguments). Parentheses are also used to group expressions, as would be done to do this using the power notation: 15^(1/2) Additionally, parentheses are also used to make "tuples", a concept we don't pursue here but that is important for programming with julia. The point here is the context of how parentheses are used is important, though for the most part the usage is the same as their dual use in your calculus text. Like sqrt, there is also a cube root function: cbrt(27) 3.0
6 The cbrt and sqrt functions are not exactly the same as using ^, as they differ when the inputs are not in their domain: For cube roots, we can see that there is a difference with negative bases: cbrt( 8) ## correct 2.0 ( 8)^(1/3) ## need first parentheses, why? DomainError() (The latter is an error as the power function has an output type that depends on the power being real, not a specific value of a real. For 1/2 the above would clearly be an error, so then for 1/3 julia makes this an error.) trigonometric functions The basic trigonometric functions in julia work with radians: sin(pi/4) cos(pi/3) But students think in degrees. What to do? Well, you can always convert via the ratio π180: sin(45 * pi/180) cos(60 * pi/180) However, julia provides the student friendly functions sind, cosd, and tand to work directly with degrees: sind(45) cosd(45) Be careful, an expression like cos2π4 is a shorthand for squaring the output of the cosine of π4, hence is expressed with cos(pi/4)^2 # not cos^2(pi/4)!!!
7 Inverse trigonometric function The math notation sin1x is also a source of confusion. This is not a power, rather it indicates an inverse function, in this case the arcsine. The arcsine function is written asin in julia. For certain values, the arcsine and sine function are inverses: asin(sin(0.1)) 0.1 However, this isn't true for all values of x, as sinx is not monotonic everywhere. In particular, the above won't work for x values outside π2π2: asin(sin(100)) Other inverse trigonometric functions are acos, atan and for completeness asec, acsc, and acot are available for use. Exponential and logs The values ex can be computed with the built in constant e : e^ Or through the function exp(x) : exp(2) As, e can be redefined, it is best to use the latter style, though it takes a bit more typing. The logarithm function, log does log base e: log(exp(2)) 2.0 To do base 10, there is a log10 function: log10(e^2)
8 There is also a log2 function for base 2. However, there are many more possible choices for a base. Rather than create functions for each possible one of interest the log function has an alternative form taking two argument. The first is interpreted as the base, the second the x value. So the above, is also done through: log(10, exp(2)) Some useful functions There are some other useful functions For example, abs for the absolute value, round for rounding, floor for rounding down and ceil for rounding up. Here are some examples round(3.14) 3.0 floor(3.14) 3.0 ceil(3.14) 4.0 The observant eye will notice the answers above are not integers. (We discuss how to tell later.) What to do if you want an integer? These functions have versions iround, ifloor, and iceil to return integer values. (Why this is needed is due to the fact that julia code can run faster when the "type" of a value doesn't change during the calling of a function. So for these functions there are good reasons for the default to keep the same output type as the input value, e.g. floating point to floating point.) Practice What is the value of sinπ10? What is the value of sin52? Is sin1sin3π2 equal to 3π2?
9 yes no What is the value of round(3.5000) What is the value of sqrt(32 12) Which is greater eπ or πe? pi^e e^pi What is the value of πxsinxcosx when x3? Search the page mathematical functions for a function which finds the factorial of n. The proper julia command to find 10 would be: fact(10) factorial(10) 10! Variables With a calculator, one can store values into a memory for later usage. This useful feature with calculators is greatly enhanced with computer languages, where one can bind, or assign, a variable to a value. For example the command x=2 will bind x to the value 2:
10 x = 2 2 So, when we evaluate x^2 4 The value assigned to x is looked up and used to return 4. The word "dynamic" to describe the Julia language refers to the fact that variables can be reassigned and retyped. For example: x = sqrt(2) ## a Float64 now In julia one can have single letter names, or much longer ones, such as some_ridiculously_long_name = 3 3 some_ridiculously_long_name^2 9 The basic tradeoff being: longer names are usually more expressive and easier to remember, whereas short names are simpler to type. To get a list of the currently bound names, the whos function may be called. Not all names are syntactically valid, for example names can't begin with a number or include spaces. In fact, only most objects bound to a name can be arbitrarily redefined. When we discuss functions, we will see that redefining functions can be an issue and new names will need to be used. As such, it often works to stick to come convention for naming: numbers use values like i, j, x, y ; functions like f, g, h, etc. To work with computer languages, it is important to appreciate that the equals sign in the variable assignment is unlike that of mathematics, where often it is used to indicate an equation which may be solved for a value. With the following computer command the right hand expression is evaluated and that value is assigned to the variable. So, x =
11 does not assign the expression to x, but rather the evaluation of that expression, which yields 5. (This also shows that the precedence of the assignment operator is lower than addition, as addition is performed first in the absence of parentheses.) Multiple assignments At the prompt, a simple expression is entered and, when the return key is pressed, evaluated. At times we may want to work with multiple subexpressions. A particular case might be setting different parameters: a=0 b=1 1 Multiple expressions can be more tersely written by separating each expression using a semicolon: a=0; b=1; 1 Note that julia makes this task even easier, as one can do multiple assignments via "tuple destructuring:" a, b = 0, 1 ## printed output is a "tuple" a + b 1 Practice Let a10, b2.3, and c8. Find the value of abac. What is the answer to this computation? a = 3.2; b=2.3 a^b b^a For longer computations, it can be convenient to do them in parts, as this makes it easier to check for mistakes. (You likely do this with your calculator.)
12 For example, to compute pqp1p for p0.25 and q0.2 we might do: p, q = 0.25, 0.2 top = p q bottom = sqrt(p*(1 p)) ans = top/bottom What is the result of the above? Numbers In mathematics, there a many different types of numbers. Familiar ones are integers, rational numbers, and the real numbers. In addition, complex numbers are needed to fully discuss polynomial functions. This is not the case with calculators. Most calculators treat all numbers as floating point numbers an approximation to the real numbers. Not so with julia. Julia has types for many different numbers: Integer, Real, Rational, Complex, and specializations depending on the number of bits that are used, e.g., Int64 and Float64. For the most part there is no need to think about the details, as values are promoted to a common type when used together. However, there are times where one needs to be aware of the distinctions. Integers and floating point numbers In the real number system of mathematics, there are the familiar real numbers and integers. The integers are viewed as a subset of the real numbers. Julia provides types Integer and Real to represent these values. (Actually, the Integer type represents more than one actual storage type, either Int32 or Int64.) These are separate types. The type of an object is returned by typeof(). For example, the integer 1 is simply created by the value 1 : 1 1 The floating point value 1 is specified by using a decimal point:
13 The two values are printed differently integers never have a decimal point, floating point values always have a decimal point. This emphasizes the fact that the two values 1 and 1.0 are not the same they are stored differently, they print differently, and can give different answers. In most cases but not all uses they can be used interchangeably. For example, we can add the two: This gives back the floating point value 2.0. First the integer and floating point value are promoted to a common type (floating point in this case) and then added. Powers are different. This value will be an error 10^( 2), but 10.0^( 2) will not. In base julia, if possible, functions are type stable. This means, the type of the output depends on the type of the input not the value. In this case, integer powers and bases are expected to return integer answers, which 102 is not. When a computer is used to represent numeric values there are limitations: a computer only assigns a finite number of bits for a value. This works great in most cases, but since there are infinitely many numbers, not all possible numbers can be represented on the computer. The first limitation is numbers can not be arbitrarily large. Take for instance a 64 bit integer. A bit is just a place in computer memory to hold a 0 or a 1. Basically one bit is used to record the sign of the number and the remaining 63 to represent the numbers. This leaves the following range for such integers 263 to Julia is said to not provide training wheels. This means it doesn't put in checks for integer overflow, as these can slow things down. To see what happens, let just peek: 2^62 2^63 ## about 4.6 * 10^18 ## negative!!! So if working with really large values, one must be mindful of the difference or your bike might crash! Gotchas Look at the output of 2^3^4 0
14 Why is it 0? The value of 3481 is bigger than 63, so 281 will overflow. The following works though: 2.0 ^ 3 ^ e24 This is because the value 2.0 will use floating point arithmetic which has a much wider range of values. (The julia documentation sends you to this interesting blog post johndcook, which indicates the largest floating point value is which is roughly 1.8e308. Scientific notation is used to represent many numbers A number in julia may be represented in scientific notation. The basic canonical form is a10b, with 10a10 and b is an integer. This is written in julia as aeb where e is used to separate the value from the exponent. The value 1.8e308 means Scientific notation makes it very easy to focus on the gross size of a number, as the exponent is set off. The second limitation is numbers are often only an approximation. This means expressions which are mathematically true, need not be true once approximated on the computer. For example, 2 is an irrational number, that is, its decimal representation does not repeat the way a rational number does. Hence it is impossible to store on the computer an exact representation, at some level there is a truncation or round off. This will show up when you try something like: 2 sqrt(2) * sqrt(2) e 16 That difference of basically 1016 is roughly the machine tolerance when representing a number. (One way to imagine this is mathematically, we have two ways to write the number 1: but on the computer, you can't have the "..." in a decimal expansion it must truncate so instead values round to something like or 1, with nothing in between. Comparing values A typical expression in computer languages is to use == to compare the values on the left and right hand sides. This is not assignment, rather a question. For example: 2 == 2 2 == 3 sqrt(2) * sqrt(2) == 2 ## surprising?
15 false The last one would be surprising were you not paying attention to the last paragraph. Comparisons with == work well for integers and strings, but not with floating point numbers. (For these the isapprox function can be used.) Comparisons do a promotion prior to comparing, so even though these numbers are of different types, the == operation treats them as equal: 1 == 1.0 true The === operator has an even more precise notion of equality: 1 === 1.0 false Scientific notation As mentioned, one can write 3e8 for 3108, but in fact to julia the two values 3e8 and 3*10^8 are not quite the same, as one is stored in floating point, and one as an integer. One can use 3.0 * 10.0^8 to get a floating point equivalent to 3e8. Floating point includes the special values: NaN, Inf. (Not so with integers.) Floating point contains two special values: NaN and Inf to represent "not a number" and "infinity." These arise in some natural cases: 1/0 ## infinity. Also 1/0. Inf 0/0 ## indeterminate NaN These values can come up in unexpected circumstances. For example division by 0 can occur due to round off errors: x = 1e 17 x^2/(1 cos(x)) ## should be about 2 Inf Rational numbers
16 In addition to special classes for integer and floating point values, Julia has a special class for rational numbers, or ratios of integers. To distinguish between regular division and rational numbers, julia has the // symbol to define rational numbers: 1//2 1//2 typeof(1//2) Rational{Int64} As you know, a rational number mn can be reduced to lowest terms by factoring out common factors. Julia does this to store its rational numbers: 2//4 1//2 Rational numbers are used typically to avoid round off error when using floating point values. This is easy to do, as julia will convert them when needed: 1//2 5//2 ## still a rational 1//2 sqrt(5)/2 ## now a floating point However, we can't do the following, as the numerator would be non integer when trying to make the rational number: (1 sqrt(5)) // 2 MethodError(//,( ,2)) Complex numbers Complex numbers are an extension of the real numbers when the values i1 is added. Complex numbers have two terms: a real and imaginary part. They are typically written as abi, though the polar form reiθ is also used. The complex numbers have the usual arithmetic operations defined for them. In Julia a complex number may be constructed by the Complex function: z = Complex(1,2) 1 + 2im
17 We see that julia uses im (and not i ) for the i. It can be more direct to just use this value in constructing complex numbers: z = 1 + 2im 1 + 2im Here we see that the usual operations can be done: z^2, 1/z, conj(z) ( 3 + 4im, im,1 2im) The value of i comes from taking the square root of 1. This is almost true in julia, but not quite. As the sqrt function will return a real value for any real input, directly trying sqrt( 1.0) will give a DomainError, as in 1.0 is not in the domain of the function. However, the sqrt function will return complex numbers for complex inputs. So we have: sqrt( im) im Complex numbers have a big role to play in higher level mathematics. In calculus, they primarily occur as roots of polynomial equation. Practice question Compute the value of using 2.0 not the integer 2 : Inf e308 Domain Error question The result of sqrt(16) is A rational number (fraction)
18 A floating point number An integer question The result of 16^2` is A rational number (fraction) An integer A floating point number question The result of 1/2 is An integer A rational number (fraction) A floating point number question The result of 2/1 is A rational number (fraction) An integer A floating point number question Which number is 1.23e4?
19 question Which number is 43e 2? question What is the answer to the following: val = round( ); question If you need more bits, julia provides the BigInt and BigFloat classes which give 256 bits of precision. Using this allows one to compute 2^3^4 2^3^4precisely as an integer: x = BigInt(2) ans = x^3^4 What is the answer? e
Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy.
Math 340 Fall 2014, Victor Matveev Binary system, round-off errors, loss of significance, and double precision accuracy. 1. Bits and the binary number system A bit is one digit in a binary representation
More informationIntroduction to Engineering gii
25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationLAB 1 General MATLAB Information 1
LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by
More informationIntroduction to Computer Programming in Python Dr. William C. Bulko. Data Types
Introduction to Computer Programming in Python Dr William C Bulko Data Types 2017 What is a data type? A data type is the kind of value represented by a constant or stored by a variable So far, you have
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More information9. Elementary Algebraic and Transcendental Scalar Functions
Scalar Functions Summary. Introduction 2. Constants 2a. Numeric Constants 2b. Character Constants 2c. Symbol Constants 2d. Nested Constants 3. Scalar Functions 4. Arithmetic Scalar Functions 5. Operators
More informationCGF Lecture 2 Numbers
CGF Lecture 2 Numbers Numbers A number is an abstract entity used originally to describe quantity. i.e. 80 Students etc The most familiar numbers are the natural numbers {0, 1, 2,...} or {1, 2, 3,...},
More informationStarting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below.
What is MATLAB? MATLAB (short for MATrix LABoratory) is a language for technical computing, developed by The Mathworks, Inc. (A matrix is a rectangular array or table of usually numerical values.) MATLAB
More informationComputing Fundamentals
Computing Fundamentals Salvatore Filippone salvatore.filippone@uniroma2.it 2012 2013 (salvatore.filippone@uniroma2.it) Computing Fundamentals 2012 2013 1 / 18 Octave basics Octave/Matlab: f p r i n t f
More informationSection 1: Numerical Calculations
Section 1: Numerical Calculations In this section you will use Maple to do some standard numerical calculations. Maple's ability to produce exact answers in addition to numerical approximations gives you
More informationNumerical computing. How computers store real numbers and the problems that result
Numerical computing How computers store real numbers and the problems that result The scientific method Theory: Mathematical equations provide a description or model Experiment Inference from data Test
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationVariables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB:
Contents VARIABLES... 1 Storing Numerical Data... 2 Limits on Numerical Data... 6 Storing Character Strings... 8 Logical Variables... 9 MATLAB S BUILT-IN VARIABLES AND FUNCTIONS... 9 GETTING HELP IN MATLAB...
More informationELEMENTARY MATLAB PROGRAMMING
1 ELEMENTARY MATLAB PROGRAMMING (Version R2013a used here so some differences may be encountered) COPYRIGHT Irving K. Robbins 1992, 1998, 2014, 2015 All rights reserved INTRODUCTION % It is assumed the
More informationSECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing
SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language
More informationFloating-point representation
Lecture 3-4: Floating-point representation and arithmetic Floating-point representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However,
More informationDecimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).
DOMAIN I. NUMBER CONCEPTS Competency 00 The teacher understands the structure of number systems, the development of a sense of quantity, and the relationship between quantity and symbolic representations.
More informationLesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University
Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only
More informationCSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial
CSI31 Lecture 5 Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial 1 3.1 Numberic Data Types When computers were first developed, they were seen primarily as
More informationBasic stuff -- assignments, arithmetic and functions
Basic stuff -- assignments, arithmetic and functions Most of the time, you will be using Maple as a kind of super-calculator. It is possible to write programs in Maple -- we will do this very occasionally,
More informationPython Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science Chapter 3 Computing with Numbers Python Programming, 3/e 1 Objectives n To understand the concept of data types. n To be familiar with the basic
More informationLecture Numbers. Richard E Sarkis CSC 161: The Art of Programming
Lecture Numbers Richard E Sarkis CSC 161: The Art of Programming Class Administrivia Agenda To understand the concept of data types To be familiar with the basic numeric data types in Python To be able
More informationScript started on Thu 25 Aug :00:40 PM CDT
Script started on Thu 25 Aug 2016 02:00:40 PM CDT < M A T L A B (R) > Copyright 1984-2014 The MathWorks, Inc. R2014a (8.3.0.532) 64-bit (glnxa64) February 11, 2014 To get started, type one of these: helpwin,
More informationChapter 1. Math review. 1.1 Some sets
Chapter 1 Math review This book assumes that you understood precalculus when you took it. So you used to know how to do things like factoring polynomials, solving high school geometry problems, using trigonometric
More informationBuilt-in Types of Data
Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),
More informationGeneral MATLAB Information 1
Introduction to MATLAB General MATLAB Information 1 Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationNumerical Data. CS 180 Sunil Prabhakar Department of Computer Science Purdue University
Numerical Data CS 180 Sunil Prabhakar Department of Computer Science Purdue University Problem Write a program to compute the area and perimeter of a circle given its radius. Requires that we perform operations
More informationHelping Students Understand Pre-Algebra
Helping Students Understand Pre-Algebra By Barbara Sandall, Ed.D., & Mary Swarthout, Ph.D. COPYRIGHT 2005 Mark Twain Media, Inc. ISBN 10-digit: 1-58037-294-5 13-digit: 978-1-58037-294-7 Printing No. CD-404021
More informationLong (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000.
QuickCalc User Guide. Number Representation, Assignment, and Conversion Variables Constants Usage Double (or DOUBLE ) floating-point variables (approx. 16 significant digits, range: approx. ±10 308 The
More informationLecture 14. Daily Puzzle. Math in C. Rearrange the letters of eleven plus two to make this mathematical statement true. Eleven plus two =?
Lecture 14 Math in C Daily Puzzle Rearrange the letters of eleven plus two to make this mathematical statement true. Eleven plus two =? Daily Puzzle SOLUTION Eleven plus two = twelve plus one Announcements
More informationTable : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = (
Floating Point Numbers in Java by Michael L. Overton Virtually all modern computers follow the IEEE 2 floating point standard in their representation of floating point numbers. The Java programming language
More informationGraphics calculator instructions
Graphics calculator instructions Contents: A B C D E F G Basic calculations Basic functions Secondary function and alpha keys Memory Lists Statistical graphs Working with functions 10 GRAPHICS CALCULATOR
More informationGeneral Information. There are certain MATLAB features you should be aware of before you begin working with MATLAB.
Introduction to MATLAB 1 General Information Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting a
More informationVariables and Data Representation
You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented
More informationLecture 1: What is MATLAB?
Lecture 1: What is MATLAB? Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1. MATLAB MATLAB (MATrix LABoratory) is a numerical
More informationLESSON 5 FUNDAMENTAL DATA TYPES. char short int long unsigned char unsigned short unsigned unsigned long
LESSON 5 ARITHMETIC DATA PROCESSING The arithmetic data types are the fundamental data types of the C language. They are called "arithmetic" because operations such as addition and multiplication can be
More informationDr. Relja Vulanovic Professor of Mathematics Kent State University at Stark c 2008
MATH-LITERACY MANUAL Dr. Relja Vulanovic Professor of Mathematics Kent State University at Stark c 2008 1 Real Numbers 1.1 Sets 1 1.2 Constants and Variables; Real Numbers 7 1.3 Operations with Numbers
More informationIntroduction to Programming
Introduction to Programming Department of Computer Science and Information Systems Tingting Han (afternoon), Steve Maybank (evening) tingting@dcs.bbk.ac.uk sjmaybank@dcs.bbk.ac.uk Autumn 2017 Week 4: More
More information9 Using Equation Networks
9 Using Equation Networks In this chapter Introduction to Equation Networks 244 Equation format 247 Using register address lists 254 Setting up an enable contact 255 Equations displayed within the Network
More informationIntroduction to numerical algorithms
Introduction to numerical algorithms Given an algebraic equation or formula, we may want to approximate the value, and while in calculus, we deal with equations or formulas that are well defined at each
More informationIntegers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not.
What is an INTEGER/NONINTEGER? Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is a REAL/IMAGINARY number? A real number is
More informationIntroduction to Programming with RAPTOR
Introduction to Programming with RAPTOR By Dr. Wayne Brown What is RAPTOR? RAPTOR is a visual programming development environment based on flowcharts. A flowchart is a collection of connected graphic symbols,
More informationMacro Programming Reference Guide. Copyright 2005 Scott Martinez
Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions
More informationMatlab as a calculator
Why Matlab? Matlab is an interactive, high-level, user-friendly programming and visualization environment. It allows much faster programs development in comparison with the traditional low-level compiled
More informationMITOCW watch?v=kz7jjltq9r4
MITOCW watch?v=kz7jjltq9r4 PROFESSOR: We're going to look at the most fundamental of all mathematical data types, namely sets, and let's begin with the definitions. So informally, a set is a collection
More informationGetting to Know Maple
Maple Worksheets for rdinary Differential Equations Complimentary software to accompany the textbook: Differential Equations: Concepts, Methods, and Models (00-00 Edition) Leigh C. Becker Department of
More informationPOLYMATH POLYMATH. for IBM and Compatible Personal Computers. for IBM and Compatible Personal Computers
POLYMATH VERSION 4.1 Provides System Printing from Windows 3.X, 95, 98 and NT USER-FRIENDLY NUMERICAL ANALYSIS PROGRAMS - SIMULTANEOUS DIFFERENTIAL EQUATIONS - SIMULTANEOUS ALGEBRAIC EQUATIONS - SIMULTANEOUS
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced
More informationApplied Calculus. Lab 1: An Introduction to R
1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for
More informationExample: Which of the following expressions must be an even integer if x is an integer? a. x + 5
8th Grade Honors Basic Operations Part 1 1 NUMBER DEFINITIONS UNDEFINED On the ACT, when something is divided by zero, it is considered undefined. For example, the expression a bc is undefined if either
More informationNote: The last command (10-5) will generate an error message. Can you see why the calculator is having difficulty deciphering the command?
Arithmetic on the TI 8/84 Your calculator is incredibly powerful and relatively easy to use. This activity will touch on a small part of its capabilities. There are two keys that look very much alike,
More informationPart #1. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr
A0B17MTB Matlab Part #1 Miloslav Čapek miloslav.capek@fel.cvut.cz Filip Kozák, Viktor Adler, Pavel Valtr Department of Electromagnetic Field B2-626, Prague You will learn Scalars, vectors, matrices (class
More informationGRAPH 4.4. Megha K. Raman APRIL 22, 2015
GRAPH 4.4 By Megha K. Raman APRIL 22, 2015 1. Preface... 4 2. Introduction:... 4 3. Plotting a function... 5 Sample funtions:... 9 List of Functions:... 10 Constants:... 10 Operators:... 11 Functions:...
More informationFloating Point Arithmetic
Floating Point Arithmetic Clark N. Taylor Department of Electrical and Computer Engineering Brigham Young University clark.taylor@byu.edu 1 Introduction Numerical operations are something at which digital
More informationMost nonzero floating-point numbers are normalized. This means they can be expressed as. x = ±(1 + f) 2 e. 0 f < 1
Floating-Point Arithmetic Numerical Analysis uses floating-point arithmetic, but it is just one tool in numerical computation. There is an impression that floating point arithmetic is unpredictable and
More information1.2 Round-off Errors and Computer Arithmetic
1.2 Round-off Errors and Computer Arithmetic 1 In a computer model, a memory storage unit word is used to store a number. A word has only a finite number of bits. These facts imply: 1. Only a small set
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationIEEE Floating Point Numbers Overview
COMP 40: Machine Structure and Assembly Language Programming (Fall 2015) IEEE Floating Point Numbers Overview Noah Mendelsohn Tufts University Email: noah@cs.tufts.edu Web: http://www.cs.tufts.edu/~noah
More information16.69 TAYLOR: Manipulation of Taylor series
859 16.69 TAYLOR: Manipulation of Taylor series This package carries out the Taylor expansion of an expression in one or more variables and efficient manipulation of the resulting Taylor series. Capabilities
More informationVARIABLES Storing numbers:
VARIABLES Storing numbers: You may create and use variables in Matlab to store data. There are a few rules on naming variables though: (1) Variables must begin with a letter and can be followed with any
More informationA GUIDE FOR USING MATLAB IN COMPUTER SCIENCE AND COMPUTER ENGINEERING TABLE OF CONTENTS
A GUIDE FOR USING MATLAB IN COMPUTER SCIENCE AND COMPUTER ENGINEERING MARC THOMAS AND CHRISTOPHER PASCUA TABLE OF CONTENTS 1. Language Usage and Matlab Interface 1 2. Matlab Global Syntax and Semantic
More informationEbooks Chemical Engineering
Uploaded by: Ebooks Chemical Engineering https://www.facebook.com/pages/ebooks-chemical-engineering/238197077030 For More Books, softwares & tutorials Related to Chemical Engineering Join Us @facebook:
More informationData Types and Basic Calculation
Data Types and Basic Calculation Intrinsic Data Types Fortran supports five intrinsic data types: 1. INTEGER for exact whole numbers e.g., 1, 100, 534, -18, -654321, etc. 2. REAL for approximate, fractional
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More informationIt can be confusing when you type something like the expressions below and get an error message. a range variable definition a vector of sine values
7_april_ranges_.mcd Understanding Ranges, Sequences, and Vectors Introduction New Mathcad users are sometimes confused by the difference between range variables and vectors. This is particularly true considering
More informationIntermediate Algebra. Gregg Waterman Oregon Institute of Technology
Intermediate Algebra Gregg Waterman Oregon Institute of Technology c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license
More informationLong (LONGMATH) variables may be used the same as short variables. The syntax is the same. A few limitations apply (see below).
Working with Long Numbers. Long Variables Constants You define a long variable with the LONG statement, which works similar to the DIM statement. You can define long variables and dimension long variable
More informationRepresenting numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states).
Representing numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states). These states are usually labeled 0 and 1. Each item in memory
More informationFloating-Point Arithmetic
Floating-Point Arithmetic 1 Numerical Analysis a definition sources of error 2 Floating-Point Numbers floating-point representation of a real number machine precision 3 Floating-Point Arithmetic adding
More informationComputer Numbers and their Precision, I Number Storage
Computer Numbers and their Precision, I Number Storage Learning goal: To understand how the ways computers store numbers lead to limited precision and how that introduces errors into calculations. Learning
More informationOutline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.
CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some
More informationBasics of Computational Geometry
Basics of Computational Geometry Nadeem Mohsin October 12, 2013 1 Contents This handout covers the basic concepts of computational geometry. Rather than exhaustively covering all the algorithms, it deals
More informationScientific Computing. Error Analysis
ECE257 Numerical Methods and Scientific Computing Error Analysis Today s s class: Introduction to error analysis Approximations Round-Off Errors Introduction Error is the difference between the exact solution
More informationThe Very Basics of the R Interpreter
Chapter 2 The Very Basics of the R Interpreter OK, the computer is fired up. We have R installed. It is time to get started. 1. Start R by double-clicking on the R desktop icon. 2. Alternatively, open
More informationArithmetic. 2.2.l Basic Arithmetic Operations. 2.2 Arithmetic 37
2.2 Arithmetic 37 This is particularly important when programs are written by more than one person. It may be obvious to you that cv stands for can volume and not current velocity, but will it be obvious
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationANSI C Programming Simple Programs
ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double
More informationWelcome. Please Sign-In
Welcome Please Sign-In Day 1 Session 1 Self-Evaluation Topics to be covered: Equations Systems of Equations Solving Inequalities Absolute Value Equations Equations Equations An equation says two things
More informationOperators Functions Order of Operations Mixed Mode Arithmetic VOID Data. Syntax and type conventions Using the Script window interface
Introduction Syntax Operators Functions Order of Operations Mixed Mode Arithmetic VOID Data Introduction Map Layer Mathematics Algebraic statements are used to perform the basic mathematical operations
More informationCS321 Introduction To Numerical Methods
CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types
More informationMAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic
MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic September 28, 2018 Lecture 1 September 28, 2018 1 / 25 Floating point arithmetic Computers use finite strings of binary digits to represent
More information(Refer Slide Time: 02:59)
Numerical Methods and Programming P. B. Sunil Kumar Department of Physics Indian Institute of Technology, Madras Lecture - 7 Error propagation and stability Last class we discussed about the representation
More informationBindel, Fall 2016 Matrix Computations (CS 6210) Notes for
1 Logistics Notes for 2016-09-07 1. We are still at 50. If you are still waiting and are not interested in knowing if a slot frees up, let me know. 2. There is a correction to HW 1, problem 4; the condition
More informationOUTLINE. Number system. Creating MATLAB variables Overwriting variable Error messages Making corrections Entering multiple statements per line
1 LECTURE 2 OUTLINE Number system Integer number Decimal number Binary number Hexadecimal number Creating MATLAB variables Overwriting variable Error messages Making corrections Entering multiple statements
More informationPROGRAMMING WITH MATLAB DR. AHMET AKBULUT
PROGRAMMING WITH MATLAB DR. AHMET AKBULUT OVERVIEW WEEK 1 What is MATLAB? A powerful software tool: Scientific and engineering computations Signal processing Data analysis and visualization Physical system
More informationIs the statement sufficient? If both x and y are odd, is xy odd? 1) xy 2 < 0. Odds & Evens. Positives & Negatives. Answer: Yes, xy is odd
Is the statement sufficient? If both x and y are odd, is xy odd? Is x < 0? 1) xy 2 < 0 Positives & Negatives Answer: Yes, xy is odd Odd numbers can be represented as 2m + 1 or 2n + 1, where m and n are
More informationYOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM
YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 1 INTRODUCING SOME MATHEMATICS SOFTWARE (Matlab, Maple and Mathematica) This topic provides
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationCPS122 Lecture: From Python to Java last revised January 4, Objectives:
Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.
More informationBasic types and definitions. Chapter 3 of Thompson
Basic types and definitions Chapter 3 of Thompson Booleans [named after logician George Boole] Boolean values True and False are the result of tests are two numbers equal is one smaller than the other
More informationIntroduction to MATLAB
Introduction to MATLAB Basics MATLAB is a high-level interpreted language, and uses a read-evaluate-print loop: it reads your command, evaluates it, then prints the answer. This means it works a lot like
More informationAlgebra 1 Review. Properties of Real Numbers. Algebraic Expressions
Algebra 1 Review Properties of Real Numbers Algebraic Expressions Real Numbers Natural Numbers: 1, 2, 3, 4,.. Numbers used for counting Whole Numbers: 0, 1, 2, 3, 4,.. Natural Numbers and 0 Integers:,
More information1. Let be a point on the terminal side of θ. Find the 6 trig functions of θ. (Answers need not be rationalized). b. P 1,3. ( ) c. P 10, 6.
Q. Right Angle Trigonometry Trigonometry is an integral part of AP calculus. Students must know the basic trig function definitions in terms of opposite, adjacent and hypotenuse as well as the definitions
More informationChoose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip.
MAPLE Maple is a powerful and widely used mathematical software system designed by the Computer Science Department of the University of Waterloo. It can be used for a variety of tasks, such as solving
More informationDOWNLOAD PDF BIG IDEAS MATH VERTICAL SHRINK OF A PARABOLA
Chapter 1 : BioMath: Transformation of Graphs Use the results in part (a) to identify the vertex of the parabola. c. Find a vertical line on your graph paper so that when you fold the paper, the left portion
More informationmay be sent to:
B A S I C M A T H A Self-Tutorial by Luis Anthony Ast Professional Mathematics Tutor LESSON 1: NUMBERS Copyright 2005 All rights reserved. No part of this publication may be reproduced or transmitted in
More information