4TC00 Model-based systems engineering 2.2 Types and values

Slides:



Advertisements
Similar presentations
Methods Java 5.1 A quick overview of methods
Advertisements

Section 7.1 The Inverse Sine, Cosine, and Tangent Functions.
Building Java Programs
Return values.
Maths & Trig, Statistical functions. ABS Returns the absolute value of a number The absolute value of a number is the number without its sign Syntax ◦
The Inverse Trigonometric Functions Section 4.2. Objectives Find the exact value of expressions involving the inverse sine, cosine, and tangent functions.
Inverse Trigonometric Functions Recall some facts about inverse functions: 1.For a function to have an inverse it must be a one-to-one function. 2.The.
Neal Stublen C# Data Types Built-in Types  Integer Types byte, sbyte, short, ushort, int, uint, long, ulong  Floating Point Types.
BBS514 Structured Programming (Yapısal Programlama)1 Functions and Structured Programming.
A Library of Functions This presentation will review the behavior of the most common functions including their graphs and their domains and ranges. See.
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
1 Fundamental Data types Overview l Primitive Data Types l Variable declaration l Arithmetical Operations l Expressions l Assignment statement l Increment.
Strings, if/else, return, user input
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 3: Parameters, Return, and Interactive Programs with Scanner.
CS180 Recitation 3. Lecture: Overflow byte b; b = 127; b += 1; System.out.println("b is" + b); b is -128 byte b; b = 128; //will not compile! b went out.
Primitive Types CSE 115 Spring 2006 April 3 &
Introduction to Matlab. Entering Commands Constants and Functions >> pi ans = >> eps ans = e-016 >> sin(pi/2) ans = 1 >> log(1000) ans =
1 Data types, operations, and expressions Continued l Overview l Assignment statement l Increment and Decrement operators l Short hand operators l The.
12-2 Know how if and switch C statements control the sequence of execution of statements. Be able to use relational and logical operators in the conditional.
A bit more practice in Section 4.7b. Analysis of the Inverse Sine Function 1–1 D:R: Continuous Increasing Symmetry: Origin (odd func.) Bounded Abs. Max.
INTRODUCTION TO PYTHON PART 1 CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Library of Functions You should be familiar with the shapes of these basic functions. We'll learn them in this section.
Logarithmic Functions
Operators, Functions and Modules1 Pattern Matching & Recursion.
Slide: 1 Copyright © AdaCore Basic Types Presented by Quentin Ochem university.adacore.com.
Chapter 3 Expressions and Interactivity Department of Computer Science Missouri State Univeristy.
basic functions.
Selection Boolean What is Boolean ? Boolean is a set with only two values : –true –false true and false are standard identifiers in Pascal, called Boolean.
1 Math Expressions and Operators. 2 Some C++ Operators Precedence OperatorDescription Higher ( )Function call +Positive - Negative *Multiplication / Division.
CSC Programming for Science Lecture 7: Math Functions.
Warm-Up: Monday, March 24 List as many commands in Java as you can remember (at least 10)
4.7 Inverse Trig Functions. By the end of today, we will learn about….. Inverse Sine Function Inverse Cosine and Tangent Functions Composing Trigonometric.
Introduction As programmers, we don’t want to have to implement functions for every possible task we encounter. The Standard C library contains functions.
Powers and roots. Square each number a) 7 b) 12 c) 20 d) 9 e) 40 a) 49 b) 144 c) 400 d) 81 e) 1600.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
NR 322: Raster Analysis I Jim Graham Fall 2008 Chapter 7.
If/else, return, user input, strings
160 as a product of its prime factors is 2 5 x 5 Use this information to show that 160 has 12 factors.
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:
CSE 110: Programming Language I Afroza Sultana UB 1230.
CFA # 4 Review.
How can you apply right triangle facts to solve real life problems?
Copyright © Cengage Learning. All rights reserved.
Functions in C ++ Subject: Programming Languages ​​for III year Topic: functions, member class.
Exercise Simplify – 22. – 4.
FUNCTIONS EXAMPLES.
Fundamental of Java Programming Basics of Java Programming
Introduction to Programming
A Very Brief Overview of Pascal
Week 3: Basic Operations
Operators and Expressions
Sum and Difference Identities
Examples of Primitive Values
8/8/17 Warm Up Solve the inequality.  .
Domain, Range, Maximum and Minimum
Inverse Trigonometric Functions
Warm-up (8 min.) Find the domain and range of of f(x) = .
Copyright © Cengage Learning. All rights reserved.
Evaluating Inverse Trig Expressions
Introduction to Programming with Python
7.2 Cube Roots Essential Question:
Trigonometric Functions
4.1 – Graphs of the Sine and Cosine Functions
COMPUTER PROGRAMMING SKILLS
Geometry Section 7.7.
Sum and Difference Identities
Primitive Data Types and Operators
COMPUTING.
What is the radian equivalent?
Presentation transcript:

4TC00 Model-based systems engineering 2.2 Types and values Bert van Beek (dr.ir. D.A. van Beek) Gem-Z 0.120 d.a.v.beek@tue.nl

Answers of first guided self study are online http://sedevel.se.wtb.tue.nl/4tc00/exercises This is the normal exercises website. Refresh your browser if you do not see a new 4TC00 ANSWERS section at the end of the table of contents. http://sedevel.se.wtb.tue.nl/4tc00/exercises/1_basics/bz_basics_answer s.html Specific link to go directly to the answers on the exercises website.

Examples of type, values and expressions disc int x = 1; disc int y = 2 * x; int is a type 1 is a value (of type int) 2 * x is an expression, but x and 1 are also expressions

CIF definition of Type

Types and values Type of a variable is the set of all allowed values of the variable. Type also defines the allowed operations on variables and expressions of the type. Type Allowed values Default initial value bool true, false false int[1..3] 1, 2, 3 1 int integer values real 1.35, -25e5, etc string “true”, “@!*%”, “hello world”, etc “”

Expressions A simple expression is a: literal value variable function call Expressions can be composed of other expressions by means of operators Expressions can be evaluated, resulting in a value

Integers and operators +9 // 9 --9 // 9 9 + 4 // 13 9 - 4 // 5 9 * 4 // 36 9 / 4 // 2.25 (result is a real number, not an integer number) 9 div 4 // 2 (9 / 4 = 2.25, so 4 fits at two whole times in 9) 9 mod 4 // 1 (the remainder of 9 div 4) pow(2, 4) // 16 (2 to the power of 4, or 2 * 2 * 2 * 2) abs(-9) // 9 (absolute value) min(9, 4) // 4 (minimum value) max(9, 4) // 9 (maximum value)

Reals and operators +1.23 // 1.23 --1.2 // 1.2 1.5 + 0.5 // 2.0 +1.23 // 1.23 --1.2 // 1.2 1.5 + 0.5 // 2.0 1.5 - 0.5 // 1.0 1.5 * 0.5 // 0.75 1.5 / 0.5 // 3.0 pow(3.5, 2.0) // 12.25 (3.5 to the power of 2, or 3.5 * 3.5) abs(-1.5) // 1.5 (absolute value) min(1.5, 0.5) // 0.5 (minimum value) max(1.5, 0.5) // 1.5 (maximum value) sqrt(16.0) // 4.0 (square root) cbrt(16.0) // 2.0 (cube root) sin(1.0) // 0.841... (sine) cos(1.0) // 0.540... (cosine) tan(1.0) // 1.557... (tangent) log(100.0) // 2.0 (logarithm to base 10) ln(100.0) // 4.605... (natural logarithm)

Operators on reals and integers x < y // less than x <= y // less than or equal to x = y // equal to x != y // not equal to x >= y // larger than or equal to x > y // larger than round(1.6) // 2 (round real to closest integer, half up) ceil(0.7) // 1 (round real up to integer) floor(0.7) // 0 (round real down to integer)

Boolean operators not x // inverse x and y // conjunction (both x and y must hold) x or y // disjunction (either x, y, or both must hold) x => y // implication (if x holds, y must hold)

"hello" + " " + "world" = "hello world" String concatenation "hello" + " " + "world" = "hello world"

Enumerations enum TrafficColor = RED, ORANGE, GREEN; // enum declaration automaton A: event change_color; disc TrafficColor light = RED; location: initial; edge change_color when light = RED do light := GREEN; end