function SortArray(Const VaiArrayOfInteger: TArrayOfInteger; Const

Size: px
Start display at page:

Download "function SortArray(Const VaiArrayOfInteger: TArrayOfInteger; Const"

Transcription

1 unit specials; interface Uses Declarations; function SortArray(Const VaiArrayOfInteger: TArrayOfInteger; Const VadArrayO fdouble: TArrayOfDouble): TArrayOfInteger; procedure VarAdd(Var VdVarValue: Double; Const VdAddValue: Double); procedure VarMultiply(Var VdVarValue: Double; Const VdMultiplyValue: Double); function IsTrue(VsString: String): Boolean; function IsArrayNotEmpty(Const VadArray: TArrayOfDouble): Boolean; function GetArrayOfDoubleSum(Const VadArray: TArrayOfDouble): Double; procedure GetArrayOfDoubleMinMax(Const VadArray: TArrayOfDouble; Var VdMin, VdMax: Double); procedure GetArrayOfIntegerMinMax(Const VaiArray: TArrayOfInteger; Var ViMin, ViMax: Integer); procedure GetArrayOfArrayOfDoubleMinMax(Const VaiArray: TArrayOfArrayOfDouble; Var VdMin, VdMax: Double); function HoursInYear(ViYear: Integer): Integer; function IsLeapYear(ViYear: Integer): Boolean; function TrimFromSemiColon(VsString: String): String; function TrimBlanks(VsString: String): String; procedure TestMessage(VvMessage: Variant); procedure OkMessage(VsMessage: String); function YesNoCancelMessage(VsQuestion: String): Integer; function YesNoMessage(VsQuestion: String): Integer; Procedure SortShell( a: array of integer); Function Pearsn(x,y: array of double; Var Rc: Double) : Boolea n; Function StringToCaseSelect(Selector: string; CaseList: array of string): Integer; Function InvCumNorm(const p: double): double; Function ClipboardToFile(sFileName : string) : Boolean; Function RoundUp(X: Double): Integer; Function RoundDn(X: Double): Integer; function LargestInt(i1,i2: Integer): Integer; function SmallestInt(i1,i2: Integer): Integer; function LargestFloat(i1,i2: Double): Double; function SmallestFloat(i1,i2: Double): Double; implementation Uses Windows, Math, Sysutils, Dialogs, Clipbrd, StrUtils, Progress; {function obtained from P. J. Acklam, function InvCumNorm(const p: Double): Double; {Coefficients in rational approximations} const a: array[1..6] of double=( e+01, e+02, e+02, e+02, e+01,

2 e+00 ); const b: array[1..5] of double =( e+01, e+02, e+02, e+01, e+01 ); const c: array[1..6] of double=( e-03, e-01, e+00, e+00, e+00, e+00 ); const d: array[1..4] of double=( e-03, e-01, e+00, e+00 ); {Define break-points} const p_low = ; const p_high = 1 - p_low; {const infinity=1.7e308; // maximum size of double} q, r: Extended; Result := 0; if ((p<=0) or (p>=1)) then raise Einvalidargument.create('Inverse Cum Norm argument must be in range 0<p<1'); {Rational approximation for lower region.} if ((0 < p) and (p< p_low)) then q := sqrt(-2*ln(p)); result := (((((c[1]*q+c[2])*q+c[3])*q+c[4])*q+c[5])*q+c[6]) / ((((d[1]*q+d[2])*q+d[3])*q+d[4])*q+1); {Rational approximation for central region.} if (p_low <= p) and (p <= p_high ) then q := p ; r := q*q ; result := (((((a[1]*r+a[2])*r+a[3])*r+a[4])*r+a[5])*r+a[6])*q / (((((b[1]*r+b[2])*r+b[3])*r+b[4])*r+b[5])*r+1) ; {Rational approximation for upper region.} if ((p_high < p) and (p < 1)) then q := sqrt(-2*ln(1-p)); result := -(((((c[1]*q+c[2])*q+c[3])*q+c[4])*q+c[5])*q+c[6]) / ((((d[1]*q+d[2])*q+d[3])*q+d[4])*q+1) ; procedure OkMessage(VsMessage: String); MessageDlg(VsMessage, mtinformation, [mbok], 0);

3 procedure TestMessage(VvMessage: Variant); MessageDlg(VvMessage, mtinformation, [mbok], 0); function YesNoCancelMessage(VsQuestion: String): Integer; Result := MessageDlg(VsQuestion, mtconfirmation, [mbyes, mbno, mbcancel], 0); function YesNoMessage(VsQuestion: String): Integer; Result := MessageDlg(VsQuestion, mtconfirmation, [mbyes, mbno], 0); {Pearse correlation} Function pearsn(x,y: array of double; Var Rc: Double) : Boolean; //PROCEDURE pearsn(x,y: nparray; n: integer; VAR r,prob,z: real); //CONST // dtiny = 1.0e-20; VAR j,n: integer; yt,xt,t,syy,sxy,sxx,df,ay,ax: double; BEGIN SetProgressMark('Computing Correlation'); n:=length(x); if n <> 0 then Result := True Exit; ax := 0.0; ay := 0.0; FOR j := 0 TO n-1 DO BEGIN ax := ax+x[j]; ay := ay+y[j]; END; ax := ax/n; ay := ay/n; sxx := 0.0; syy := 0.0; sxy := 0.0; FOR j := 0 TO n-1 DO BEGIN xt := x[j]-ax; yt := y[j]-ay; sxx := sxx+sqr(xt); syy := syy+sqr(yt); sxy := sxy+xt*yt; END; if sqrt(sxx*syy) <> 0 then Rc := sxy/sqrt(sxx*syy) // z := 0.5*ln(((1.0+r)+tiny)/((1.0-r)+tiny));

4 // df := n-2; // t := r*sqrt(df/(((1.0-r)+tiny)*((1.0+r)+tiny))); // prob := betai(0.5*df,0.5,df/(df+sqr(t))) (* prob := erfcc(abs(z*sqrt(n-1.0))/ ) *) END; {Famous shell array sort} Procedure SortShell( a: Array of Integer); bis, i, j, k: LongInt; h: integer; bis := High(a); k := bis shr 1;// div 2 while k > 0 do for i := 0 to bis - k do j := i; while (j >= 0) and (a[j] > a[j + k]) do h := a[j]; a[j] := a[j + k]; a[j + k] := h; if j > k then Dec(j, k) j := 0; // {end while] // { end for} k := k shr 1; // div 2 // {end while} End; {So that a string may be used in a Case statement} function StringToCaseSelect(Selector : string; CaseList: array of string): Integer; cnt: integer; Result:=-1; for cnt:=0 to Length(CaseList)-1 do if CompareText(Selector, CaseList[cnt]) = 0 then Result:=cnt; Break; function ClipboardToFile(sFileName : string) : Boolean; ps1, ps2 : PChar; dwlen : DWord; tf : TextFile; hdata : THandle; with Clipboard do

5 try Open; if(hasformat(cf_text)) then hdata := GetClipboardData(CF_TEXT) ; ps1 := GlobalLock(hData) ; dwlen := GlobalSize(hData) ; ps2 := StrAlloc(1 + dwlen) ; StrLCopy(ps2,ps1,dwLen) ; GlobalUnlock(hData) ; AssignFile(tf, sfilename) ; // Erase(tf) ; ReWrite(tf) ; Write(tf,ps2) ; CloseFile(tf) ; StrDispose(ps2) ; Result := True; finally Close; {Returns -1, 0 or 1 according to the sign of the argument} function Sgn(X: Double): Integer; if X < 0 then Result := -1 if X = 0 then Result := 0 Result := 1; {Returns the first integer less than or equal to a given number in absolute value (sign is preserved). RoundDn(3.7) = 3 RoundDn(-3.7) = -3} function RoundDn(X: Double): Integer; Result := Trunc(Int(X)); {Returns the first integer greater than or equal to a given number in absolute value (sign is preserved). RoundUp(3.3) = 4 RoundUp(-3.3) = -4} function RoundUp(X: Double): Integer; Result := Trunc(Int(X)) + Sgn(Frac(X)); function LargestInt(i1,i2: Integer): Integer; if i1 > i2 then Result := i1 Result := i2; function SmallestInt(i1,i2: Integer): Integer;

6 if i1 < i2 then Result := i1 Result := i2; function LargestFloat(i1,i2: Double): Double; if i1 > i2 then Result := i1 Result := i2; function SmallestFloat(i1,i2: Double): Double; if i1 < i2 then Result := i1 Result := i2; function TrimBlanks(VsString: String): String; Result := StringReplace(VsString,' ','',[rfreplaceall, rfignorecase]); function TrimFromSemiColon(VsString: String): String; ipos: Integer; ipos := AnsiPos(';',VsString); if ipos <> 0 then Result := AnsiLeftStr(VsString,iPos-1) Result := VsString; function IsLeapYear(ViYear: Integer): Boolean; Result := (ViYear Mod 4 = 0) and ((ViYear Mod 100 <> 0) or ((ViYear Mod 100 = 0) and (ViYear Mod 400 = 0))); function HoursInYear(ViYear: Integer): Integer; // if not IsLeapYear(ViYear) then Result := 8760 // // Result := 8784; function IsTrue(VsString: String): Boolean; if UpperCase(VsString) = 'TRUE' then Result := True

7 procedure GetArrayOfDoubleMinMax(Const VadArray: TArrayOfDouble; Var VdMin, VdMax: Double); if Length(VadArray) <> 0 then VdMin := MinValue(VadArray); VdMax := MaxValue(VadArray); end VdMin := 0; VdMax := 0; function GetArrayOfDoubleSum(Const VadArray: TArrayOfDouble): Double; i: Integer; Res ult := 0; for i := 0 to Length(VadArray)-1 do Result := Result + VadArray[i]; procedure GetArrayOfIntegerMinMax(Const VaiArray: TArrayOfInteger; Var ViMin, ViMax: Integer); ViMin := MinIntValue(VaiArray); ViMax := MaxIntValue(VaiArray); procedure GetArrayOfArrayOfDoubleMinMax(Const VaiArray: TArrayOfArrayOfDouble; Var VdMin, VdMax: Double); i: Integer; VdMinTmp, VdMaxTmp: Double; VdMin := MinValue(VaiArray[0]); VdMax := MaxValue(VaiArray[0]); for i := 1 to Length(VaiArray)-1 do VdMinTmp := MinValue(VaiArray[i]); if VdMinTmp < VdMin then VdMin := VdMinTmp; VdMaxTmp := MaxValue(VaiArray[i]); if VdMaxTmp > VdMax then VdMax := VdMaxTmp; function IsArrayNotEmpty(Const VadArray: TArrayOfDouble): Boolean; if Length(VadArray) <> 0 then Result := True procedure VarMultiply(Var VdVarValue: Double; Const VdMultiplyValue: Double);

8 VdVarValue := VdVarValue * VdMultiplyValue; procedure VarAdd(Var VdVarValue: Double; Const VdAddValue: Double); VdVarValue := VdVarValue + VdAddValue; function CloneArrayOfInteger(VaiArr: TArrayOfInteger): TArrayOfInteger; i: Integer; SetLength(Res ult,length(vaiarr) ); for i := 0 to Length(VaiArr)-1 do Result[i] := VaiArr[i]; function CloneArrayOfDouble(VadArr: TArrayOfDouble): TArrayOfDouble; i: Integer; SetLength(Res ult,length(vadarr) ); for i := 0 to Length(VadArr)-1 do Result[i] := VadArr[i]; function SortArray(Const VaiArrayOfInteger: TArrayOfInteger; Const VadArrayOfDouble: TArrayOfDouble): TArrayOfInteger; a, b: Integer; dvalue: Double; ivalue: Integer; adarraytemp: TArrayOfDouble; aiarraysort, aiarraytemp: TArrayOfInteger; aiarraytemp := CloneArrayOfInteger(VaiArrayOfInteger); adarraytemp := CloneArrayOfDouble(VadArrayOfDouble); SetLength(Result,Length(VaiArrayOfInteger)); SetLength(aiArraySort,Length(VaiArrayOfInteger)); for a := 0 to Length(adArrayTemp)-2 do for b := a + 1 to Length(adArrayTemp)-1 do if adarraytemp[b] < adarraytemp[a] then // swap dvalue := adarraytemp[a]; ivalue := aiarraytemp[a]; adarraytemp[a]:= adarraytemp[b]; aiarraytemp[a]:= aiarraytemp[b]; adarraytemp[b]:= dvalue; aiarraytemp[b]:= ivalue; for a := 0 to Length(Result)-1 do for b := 0 to Length(Result)-1 do if VaiArrayOfInteger[a] = aiarraytemp[b] then aiarraysort[a] := b; for a := 0 to Length(Result)-1 do Result[aiArraySort[a]] := a;

9 end.

DelphiScript Keywords

DelphiScript Keywords DelphiScript Keywords Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 This reference covers the DelphiScript keywords used for the Scripting System in Altium Designer. The scripting

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

More information

Math library for PIC18 processors version 0.05

Math library for PIC18 processors version 0.05 Math library for PIC18 processors version 0.05 The library was prepared as a replacement of the official Math library ( Lib_Math.mcl) in mp PRO (or mb PRO). It is an improved version of the fixed-point

More information

Compare Linear Regression Lines for the HP-41C

Compare Linear Regression Lines for the HP-41C Compare Linear Regression Lines for the HP-41C by Namir Shammas This article presents an HP-41C program that calculates the linear regression statistics for two data sets and then compares their slopes

More information

Getting started with Lazarus

Getting started with Lazarus Getting started with Lazarus Michaël Van Canneyt March 4, 2006 Abstract Lazarus is a cross-platform 2-way RAD tool which can be used to develop almost any kind of program for Windows, Linux, Solaris or

More information

Compare Linear Regression Lines for the HP-67

Compare Linear Regression Lines for the HP-67 Compare Linear Regression Lines for the HP-67 by Namir Shammas This article presents an HP-67 program that calculates the linear regression statistics for two data sets and then compares their slopes and

More information

Computers in Engineering COMP 208. Subprograms. Subroutines. Subroutines Michael A. Hawker

Computers in Engineering COMP 208. Subprograms. Subroutines. Subroutines Michael A. Hawker Computers in Engineering COMP 208 Subroutines Michael A. Hawker Subprograms Functions are one type of subprogram in FORTRAN Another type of subprogram FORTRAN allows is called a subroutine There are many

More information

NATIONAL SENIOR CERTIFICATE GRADE 12

NATIONAL SENIOR CERTIFICATE GRADE 12 NATIONAL SENIOR CERTIFICATE GRADE 12 INFORMATION TECHNOLOGY P1 NOVEMBER 2014 MEMORANDUM MARKS: 150 This memorandum consists of 28 pages. Information Technology/P1 2 DBE/November 2014 GENERAL INFORMATION:

More information

Computers in Engineering. Subroutines Michael A. Hawker

Computers in Engineering. Subroutines Michael A. Hawker Computers in Engineering COMP 208 Subroutines Michael A. Hawker Subprograms Functions are one type of subprogram in FORTRAN Another type of subprogram FORTRAN allows is called a subroutine There are many

More information

GRADE 11 NOVEMBER 2012 INFORMATION TECHNOLOGY P1 INLIGTINGSTEGNOLOGIE V1 MEMORANDUM

GRADE 11 NOVEMBER 2012 INFORMATION TECHNOLOGY P1 INLIGTINGSTEGNOLOGIE V1 MEMORANDUM Province of the EASTERN CAPE EDUCATION NATIONAL SENIOR CERTIFICATE GRADE 11 NOVEMBER 2012 INFORMATION TECHNOLOGY P1 INLIGTINGSTEGNOLOGIE V1 MEMORANDUM MARKS/PUNTE: 120 This memorandum consists of 10 pages.

More information

Type checking. Jianguo Lu. November 27, slides adapted from Sean Treichler and Alex Aiken s. Jianguo Lu November 27, / 39

Type checking. Jianguo Lu. November 27, slides adapted from Sean Treichler and Alex Aiken s. Jianguo Lu November 27, / 39 Type checking Jianguo Lu November 27, 2014 slides adapted from Sean Treichler and Alex Aiken s Jianguo Lu November 27, 2014 1 / 39 Outline 1 Language translation 2 Type checking 3 optimization Jianguo

More information

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100!

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100! HighPower large integer calculator intended to investigate the properties of large numbers such as large exponentials and factorials. This application is written in Delphi 7 and can be easily ported to

More information

In Delphi script, when values are assigned to variables, the colon-equal operator is used; :=

In Delphi script, when values are assigned to variables, the colon-equal operator is used; := Statements and Operators Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 Parent page: DelphiScript DelphiScript Statements A statement in DelphiScript is considered as simple when

More information

Plugin API. Revision

Plugin API. Revision Plugin API Revision 2012-01-14 1. Creating Your First Plugin A simple example is much better to understand the plugin API than tens of boring pages of theory. Our first plugin will show a window with PI

More information

Exercise 1.1 Hello world

Exercise 1.1 Hello world Exercise 1.1 Hello world The goal of this exercise is to verify that computer and compiler setup are functioning correctly. To verify that your setup runs fine, compile and run the hello world example

More information

Programming Block C. Today s Topics. wstomv/2ip05/ Lecture 13. Implement an ADT, given its contract.

Programming Block C. Today s Topics.   wstomv/2ip05/ Lecture 13. Implement an ADT, given its contract. Programming Block C Today s Topics http://www.win.tue.nl/ wstomv/2ip05/ Lecture 13 Tom Verhoeff Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software Engineering & Technology Implement

More information

HS STELLENBERG : DELPHI : FOKUS VIR EKSAMENS GEDATEER 1 FEB 2017.

HS STELLENBERG : DELPHI : FOKUS VIR EKSAMENS GEDATEER 1 FEB 2017. D E L P H I F O K U S V I R E K S A M E N S ( F E B 2 0 1 7 ) P a g e 1 HS STELLENBERG : DELPHI : FOKUS VIR EKSAMENS GEDATEER 1 FEB 2017. Hierdie is n werksdokument en word van tyd tot tyd opgradeer. GRAAD

More information

A/L 2011_revision. PASCAL PROGRAMMING

A/L 2011_revision. PASCAL PROGRAMMING Pascal is a high level programming language developed by Niklaus Wirth in 1970 based on the ALGOL programming language. It was named in honor of the French mathematician and philosopher Blaise Pascal.

More information

Function Exit Function End Function bold End Function Exit Function

Function Exit Function End Function bold End Function Exit Function The UDF syntax: Function name [(arguments) [As type] ] [As type] [statements] [name = expression] [Exit Function] [statements] [name = expression] - name the name of the function - arguments a list of

More information

Introduction to Computer Science Unit 2. Notes

Introduction to Computer Science Unit 2. Notes Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and

More information

OOPLs Semantic Foundations. Data Abstraction Foundation of OOPLs

OOPLs Semantic Foundations. Data Abstraction Foundation of OOPLs OOPLs Semantic Foundations Barbara Liskov s CLU language first specification of data abstraction Defining semantics of methods Defining a data abstraction and its methods Mutability Rep type (concrete

More information

Companion C++ Examples

Companion C++ Examples 68 Appendix D Companion C++ Examples D.1 Introduction It is necessary to be multilingual in computer languages today. Since C++ is often used in the OOP literature it should be useful to have C++ versions

More information

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS }

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS } { -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS } {1.1} program One1T84; { -- This program produces a table of Fahrenheit for Celcius. } C: Integer; Writeln ('CELCIUS

More information

520 Principles of Programming Languages. Arithmetic. Variable Declarations. 19: Pascal

520 Principles of Programming Languages. Arithmetic. Variable Declarations. 19: Pascal Structure of a Pascal Program 520 Principles of Programming Languages 19: Pascal Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona PROGRAM Name (list of files);

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Python Lab 3: Arithmetic PythonLab3 lecture slides.ppt 26 January 2018 Ping Brennan (p.brennan@bbk.ac.uk) 1 Getting Started Create a new folder in your disk space with the name

More information

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type Pascal ISO 7185:1990 This online copy of the unextended Pascal standard is provided only as an aid to standardization. In the case of dierences between this online version and the printed version, the

More information

Sébastien Mathier wwwexcel-pratiquecom/en Variables : Variables make it possible to store all sorts of information Here's the first example : 'Display the value of the variable in a dialog box 'Declaring

More information

Introduction to Functional Programming: Lecture 7 2 Functions as innite data structures Ordinary ML data structures are always nite. We can, however,

Introduction to Functional Programming: Lecture 7 2 Functions as innite data structures Ordinary ML data structures are always nite. We can, however, Introduction to Functional Programming: Lecture 7 1 Introduction to Functional Programming John Harrison University of Cambridge Lecture 7 Innite data structures Topics covered: Functions as innite data

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Basic language This reference guide

More information

Preview from Notesale.co.uk Page 2 of 79

Preview from Notesale.co.uk Page 2 of 79 COMPUTER PROGRAMMING TUTORIAL by tutorialspoint.com Page 2 of 79 tutorialspoint.com i CHAPTER 3 Programming - Environment Though Environment Setup is not an element of any Programming Language, it is the

More information

Introduction to Computer Science Unit 2. Notes

Introduction to Computer Science Unit 2. Notes Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and

More information

9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75

9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the May/June 2015 series 9691 COMPUTING 9691/23 Paper 2 (Written Paper), maximum raw

More information

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake Assigning Values // Example 2.3(Mathematical operations in C++) float a; cout > a; cout

More information

AP Computer Science Java Mr. Clausen Program 6A, 6B

AP Computer Science Java Mr. Clausen Program 6A, 6B AP Computer Science Java Mr. Clausen Program 6A, 6B Program 6A LastNameFirstNameP6A (Quadratic Formula: 50 points) (Including complex or irrational roots) Write a program that begins by explaining the

More information

Example 1 Using 1-d Arrays

Example 1 Using 1-d Arrays Example 1 Using 1-d Arrays December 13, 2017 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license. 1 A spreadsheet example using 1-d arrays [1] int I[SIZE];

More information

PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1

PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1 PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1 1. Problems from Gilat, Ch. 1.10 Open a terminal window, change to directory /octave, and using your text editor, create the file

More information

Chapter 7 Arrays. One-Dimensional Arrays. Fred Jack. Anna. Sue. Roy

Chapter 7 Arrays. One-Dimensional Arrays. Fred Jack. Anna. Sue. Roy Chapter 7 Arrays High-level languages provide programmers with a variety of ways of organising data. There are not only simple data types, but also data structures. A data structure is a data type composed

More information

CA4003 Compiler Construction Assignment Language Definition

CA4003 Compiler Construction Assignment Language Definition CA4003 Compiler Construction Assignment Language Definition David Sinclair 2017-2018 1 Overview The language is not case sensitive. A nonterminal, X, is represented by enclosing it in angle brackets, e.g.

More information

ISaGRAF complies with the requirements set forth in IEC , for the following language features:

ISaGRAF complies with the requirements set forth in IEC , for the following language features: ICS Triplex ISaGRAF Inc. www.isagraf.com ISaGRAF complies with the requirements set forth in IEC 61131-3, for the following language features: Table # Feature # Common Elements 1 1 X X X Required character

More information

Higher-Order Procedures

Higher-Order Procedures Higher-Order Procedures Today s topics Procedural abstractions Capturing patterns across procedures Higher Order Procedures Procedural abstraction Process of procedural abstraction Define formal parameters,

More information

<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. <www.excelunusual.com> 1. Introduction: Chart naming: by George Lungu

<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. <www.excelunusual.com> 1. Introduction: Chart naming: by George Lungu Easy Zoom -Chart axis Scaling Using VBA - by George Lungu Introduction: - In certain models we need to be able to change the scale of the chart axes function of the result of a simulation - An Excel chart

More information

Sorting. Bubble Sort. Selection Sort

Sorting. Bubble Sort. Selection Sort Sorting In this class we will consider three sorting algorithms, that is, algorithms that will take as input an array of items, and then rearrange (sort) those items in increasing order within the array.

More information

Constraint Modeling. with MiniZinc. Jakub Bulín. Department of CU Prague

Constraint Modeling. with MiniZinc. Jakub Bulín. Department of CU Prague Constraint Modeling with MiniZinc Jakub Bulín Department of Algebra @ CU Prague Table of contents 1. Intro & the theory part 2. An overview of MinZinc 3. Examples of constraint models 4. Learn more 1 In

More information

Definition. A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity.

Definition. A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity. Definition A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity. 120202: ESM4A - Numerical Methods 32 f(x) = e x at point c = 0. Taylor

More information

Compiladores Prof. Bruno Lopes Lista 1

Compiladores Prof. Bruno Lopes Lista 1 1. Coteje as etapas do processo de compilação. 2. Seja a seguinte BNF da linguagem Pascal. Compiladores 2016.2 Prof. Bruno Lopes Lista 1 program ::= program identifier ; uses declaration ; block. uses

More information

JUN / 04 VERSION 7.0

JUN / 04 VERSION 7.0 JUN / 04 VERSION 7.0 PVI EWEXEME www.smar.com Specifications and information are subject to change without notice. Up-to-date address information is available on our website. web: www.smar.com/contactus.asp

More information

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design What is a Function? C Programming Lecture 8-1 : Function (Basic) A small program(subroutine) that performs a particular task Input : parameter / argument Perform what? : function body Output t : return

More information

Professor Peter Cheung EEE, Imperial College

Professor Peter Cheung EEE, Imperial College 1/1 1/2 Professor Peter Cheung EEE, Imperial College In this lecture, we take an overview of the course, and briefly review the programming language. The rough guide is not very complete. You should use

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Python Lab 3: Arithmetic PythonLab3 lecture slides.ppt 16 October 2018 Ping Brennan (p.brennan@bbk.ac.uk) 1 Getting Started Create a new folder in your disk space with the name

More information

Introduction to C++ 2. A Simple C++ Program. A C++ program consists of: a set of data & function definitions, and the main function (or driver)

Introduction to C++ 2. A Simple C++ Program. A C++ program consists of: a set of data & function definitions, and the main function (or driver) Introduction to C++ 1. General C++ is an Object oriented extension of C which was derived from B (BCPL) Developed by Bjarne Stroustrup (AT&T Bell Labs) in early 1980 s 2. A Simple C++ Program A C++ program

More information

HOW TO IMPLEMENT CUSTOM LICENSING FOR ACTIVEX LIBRARIES

HOW TO IMPLEMENT CUSTOM LICENSING FOR ACTIVEX LIBRARIES HOW TO IMPLEMENT CUSTOM LICENSING FOR ACTIVEX LIBRARIES Editor: Tomáš Mandys, tomas.mandys@2p.cz (2p plus) Home site: http://www.2p.cz Document status: Version 1.0 First release Table of Contents 1. Introduction

More information

Basic Calculator Functions

Basic Calculator Functions Algebra I Common Graphing Calculator Directions Name Date Throughout our course, we have used the graphing calculator to help us graph functions and perform a variety of calculations. The graphing calculator

More information

Consider the actions taken on positive integers when considering decimal values shown in Table 1 where the division discards the remainder.

Consider the actions taken on positive integers when considering decimal values shown in Table 1 where the division discards the remainder. 9.3 Mapping Down to 0,..., M 1 In our previous step, we discussed methods for taking various objects and deterministically creating a 32- bit hash value based on the properties of the object. Hash tables,

More information

Chapter Two MIPS Arithmetic

Chapter Two MIPS Arithmetic Chapter Two MIPS Arithmetic Computer Organization Review Binary Representation Used for all data and instructions Fixed size values: 8, 16, 32, 64 Hexadecimal Sign extension Base and virtual machines.

More information

Lecture 6 Sorting and Searching

Lecture 6 Sorting and Searching Lecture 6 Sorting and Searching Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 6 77 42 35 12 101 5 1 2 3 4 5 6 5 12 35 42 77 101 There are many algorithms for sorting a list

More information

Chapter 15. Functional Programming Languages ISBN

Chapter 15. Functional Programming Languages ISBN Chapter 15 Functional Programming Languages ISBN 0-321-49362-1 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming Language:

More information

IV/IV B.Tech (Regular) DEGREE EXAMINATION. Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation

IV/IV B.Tech (Regular) DEGREE EXAMINATION. Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation IV/IV B.Tech (Regular) DEGREE EXAMINATION Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation Maximum: 60 Marks 1. Write briefly about the following 1*12= 12 Marks a) Give the characteristics

More information

GRADE 12 SEPTEMBER 2012 INFORMATION TECHNOLOGY P1 MEMORANDUM

GRADE 12 SEPTEMBER 2012 INFORMATION TECHNOLOGY P1 MEMORANDUM Province of the EASTERN CAPE EDUCATION NATIONAL SENIOR CERTIFICATE GRADE 12 SEPTEMBER 2012 INFORMATION TECHNOLOGY P1 MEMORANDUM MARKS: 120 This memorandum consists of 11 pages. 2 INFORMATION TECHNOLOGY

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named

More information

The paramaterless ctor (aka default ctor)

The paramaterless ctor (aka default ctor) Initialization List The paramaterless ctor (aka default ctor) 2 int main() B b; class A public: A() std::cout

More information

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF

More information

APPLICATION NOTE: KONSTANTER LSP32K Interface Protocol

APPLICATION NOTE: KONSTANTER LSP32K Interface Protocol APPLICATION NOTE: KONSTANTER LSP32K Interface Protocol 1 Interface Type At the DB9 connector the LSP32K Power Supply device offers a serial data interface with TTL logic level for remote control and readout

More information

Some notes about Event-B and Rodin

Some notes about Event-B and Rodin Some notes about Event-B and Rodin Résumé This document briefly presents the language event-b and the tool Rodin. For a comprehensive presentation, refer to the event-b page http://www.event-b.org/, the

More information

Quicksort. Repeat the process recursively for the left- and rightsub-blocks.

Quicksort. Repeat the process recursively for the left- and rightsub-blocks. Quicksort As the name implies, this is the fastest known sorting algorithm in practice. It is excellent for average input but bad for the worst-case input. (you will see later). Basic idea: (another divide-and-conquer

More information

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming.

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming. OPERATORS This tutorial will teach you about operators. s are symbols that are used to represent an actions used in programming. Here is the link to the tutorial on TouchDevelop: http://tdev.ly/qwausldq

More information

2-9 Operations with Complex Numbers

2-9 Operations with Complex Numbers 2-9 Operations with Complex Numbers Warm Up Lesson Presentation Lesson Quiz Algebra 2 Warm Up Express each number in terms of i. 1. 9i 2. Find each complex conjugate. 3. 4. Find each product. 5. 6. Objective

More information

Example 3 Using a Structure Array

Example 3 Using a Structure Array Example 3 Using a Structure Array December 13, 2017 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license. 1 A spreadsheet example using a structure array

More information

Assertions & Verification & Example Loop Invariants Example Exam Questions

Assertions & Verification & Example Loop Invariants Example Exam Questions 2014 November 27 1. Assertions & Verification & Example Loop Invariants Example Exam Questions 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer

More information

Lectures 4 and 5 (Julian) Computer Programming: Skills & Concepts (INF-1-CP1) double; float; quadratic equations. Practical 1.

Lectures 4 and 5 (Julian) Computer Programming: Skills & Concepts (INF-1-CP1) double; float; quadratic equations. Practical 1. Lectures 4 and 5 (Julian) Computer Programming: Skills & Concepts (INF-1-CP1) double; float; quadratic equations 4th October, 2010 Integer arithmetic in C. Converting pre-decimal money to decimal. The

More information

Functions. Calculating Expressions with the Evaluate function. Passing Parameters to Functions and Procedures. Exiting from a Procedure

Functions. Calculating Expressions with the Evaluate function. Passing Parameters to Functions and Procedures. Exiting from a Procedure Functions Old Content - visit altium.com/documentation Modified by Rob Evans on 15-Feb-2017 Parent page: DelphiScript The common function statements used by the DelphiScript language are covered below.

More information

JQUERYUI - PROGRESSBAR

JQUERYUI - PROGRESSBAR JQUERYUI - PROGRESSBAR http://www.tutorialspoint.com/jqueryui/jqueryui_progressbar.htm Copyright tutorialspoint.com Progress bars indicate the completion percentage of an operation or process. We can categorize

More information

Lab Instructor : Jean Lai

Lab Instructor : Jean Lai Lab Instructor : Jean Lai Group related statements to perform a specific task. Structure the program (No duplicate codes!) Must be declared before used. Can be invoked (called) as any number of times.

More information

Spreadsheet View and Basic Statistics Concepts

Spreadsheet View and Basic Statistics Concepts Spreadsheet View and Basic Statistics Concepts GeoGebra 3.2 Workshop Handout 9 Judith and Markus Hohenwarter www.geogebra.org Table of Contents 1. Introduction to GeoGebra s Spreadsheet View 2 2. Record

More information

Magma Tutorial for pairing cryptographers. Part I - Introduction

Magma Tutorial for pairing cryptographers. Part I - Introduction 1/ 30 Magma Tutorial for pairing cryptographers. Part I - Cinvestav, Mexico September, 2011 Table of contents 2/ 30 1 2 3 4 Magma 3/ 30 The Magma shell 4/ 30 The typical way of running magma is using its

More information

Computer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres

Computer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres Computer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres dgriol@inf.uc3m.es Introduction He am a driver might be syntactically correct but semantically wrong. Semantic

More information

COP 3014 Honors: Spring 2017 Homework 5

COP 3014 Honors: Spring 2017 Homework 5 COP 3014 Honors: Spring 2017 Homework 5 Total Points: 150 Due: Thursday 03/09/2017 11:59:59 PM 1 Objective The purpose of this assignment is to test your familiarity with C++ functions and arrays. You

More information

Assertions & Verification Example Exam Questions

Assertions & Verification Example Exam Questions 2009 November 23 Assertions & Verification Example Exam Questions 1. 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer must answer to verify

More information

Goals for This Lecture:

Goals for This Lecture: Goals for This Lecture: Understand what modules are Understand what module procedures are and how to use them Understand explicit and implicit interfaces Understand what automatic arrays are and how to

More information

Source code for simulations: 1 of 11

Source code for simulations: 1 of 11 The following is the source code for the simulations reported in Clinchy, Haydon and Smith (Pattern process: what does patch occupancy really tell us about metapopulation dynamics). unit Main; interface

More information

GNU ccscript Scripting Guide IV

GNU ccscript Scripting Guide IV GNU ccscript Scripting Guide IV David Sugar GNU Telephony 2008-08-20 (The text was slightly edited in 2017.) Contents 1 Introduction 1 2 Script file layout 2 3 Statements and syntax 4 4 Loops and conditionals

More information

Chapter 7 - Notes User-Defined Functions II

Chapter 7 - Notes User-Defined Functions II Chapter 7 - Notes User-Defined Functions II I. VOID Functions ( The use of a void function is done as a stand alone statement.) A. Void Functions without Parameters 1. Syntax: void functionname ( void

More information

Functions. Arash Rafiey. September 26, 2017

Functions. Arash Rafiey. September 26, 2017 September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic

More information

Goals for This Lecture:

Goals for This Lecture: Goals for This Lecture: Learn a simple sorting algorithm Understand how compilation & linking of separate main program and subprogram files are accomplished. Understand how to use subprograms to create

More information

CSC Advanced Scientific Computing, Fall Numpy

CSC Advanced Scientific Computing, Fall Numpy CSC 223 - Advanced Scientific Computing, Fall 2017 Numpy Numpy Numpy (Numerical Python) provides an interface, called an array, to operate on dense data buffers. Numpy arrays are at the core of most Python

More information

NATIONAL SENIOR CERTIFICATE GRADE12

NATIONAL SENIOR CERTIFICATE GRADE12 NATIONAL SENIOR CERTIFICATE GRADE12 INFORMATION TECHNOLOGY P1 FEBRUARY/MARCH 2018 MARKING GUIDELINES MARKS: 150 These marking guidelines consist of 21 pages. Information Technology/P1 2 DBE/Feb. Mar. 2018

More information

Linking and Loading. ICS312 - Spring 2010 Machine-Level and Systems Programming. Henri Casanova

Linking and Loading. ICS312 - Spring 2010 Machine-Level and Systems Programming. Henri Casanova Linking and Loading ICS312 - Spring 2010 Machine-Level and Systems Programming Henri Casanova (henric@hawaii.edu) The Big Picture High-level code char *tmpfilename; int num_schedulers=0; int num_request_submitters=0;

More information

Modbus Server. ARSoft International

Modbus Server. ARSoft International Modbus Server ARSoft International Description The ModBus server allows: The cyclic or acyclique interrogation of equipments connected to the serial comport COM1 to COM10. Up to 115200 Bauds. The communication

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm s 4. Odd or even Step 3 : If number divisible by 2 then Print "Number is Even" Step 3.1 : else Print "Number is Odd" Step 4 : Stop 5. Greatest among three numbers Step 2 : Read values of a, b and c Step

More information

Multiple-choice (35 pt.)

Multiple-choice (35 pt.) CS 161 Practice Midterm I Summer 2018 Released: 7/21/18 Multiple-choice (35 pt.) 1. (2 pt.) Which of the following asymptotic bounds describe the function f(n) = n 3? The bounds do not necessarily need

More information

Variable initialization and assignment

Variable initialization and assignment Variable initialization and assignment int variable_name; float variable_name; double variable_name; String variable_name; boolean variable_name; Initialize integer variable Initialize floating point variable

More information

VHDL Structural Modeling II

VHDL Structural Modeling II VHDL Structural Modeling II ECE-331, Digital Design Prof. Hintz Electrical and Computer Engineering 5/7/2001 331_13 1 Ports and Their Usage Port Modes in reads a signal out writes a signal inout reads

More information

Midterm CSE 131B Spring 2005

Midterm CSE 131B Spring 2005 Signature Login Name _ Name Student ID Midterm CSE 131B Spring 2005 Page 1 Page 2 Page 3 Page 4 Page 5 (20 points) (18 points) (22 points) (20 points) (20 points) Subtotal Page 6 Extra Credit (100 points)

More information

1) A rational function is a quotient of polynomial functions:

1) A rational function is a quotient of polynomial functions: Math 165 - Sections 4.4 and 4.5 Rational Functions 1) A rational function is a quotient of polynomial functions: 2) Explain how you find the domain of a rational function: a) Write a rational function

More information

1) Generate a vector of the even numbers between 5 and 50.

1) Generate a vector of the even numbers between 5 and 50. MATLAB Sheet 1) Generate a vector of the even numbers between 5 and 50. 2) Let x = [3 5 4 2 8 9]. a) Add 20 to each element. b) Subtract 2 from each element. c) Add 3 to just the odd index elements. d)

More information

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type >

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type > VBA Handout References, tutorials, books Excel and VBA tutorials Excel VBA Made Easy (Book) Excel 2013 Power Programming with VBA (online library reference) VBA for Modelers (Book on Amazon) Code basics

More information

CS 320: Concepts of Programming Languages

CS 320: Concepts of Programming Languages CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 04: Basic Haskell Continued o Polymorphic Types o Type Inference with Polymorphism o Standard

More information

Chapter 4. Transform-and-conquer

Chapter 4. Transform-and-conquer Chapter 4 Transform-and-conquer 1 Outline Transform-and-conquer strategy Gaussian Elimination for solving system of linear equations Heaps and heapsort Horner s rule for polynomial evaluation String matching

More information

CT 229 Java Syntax Continued

CT 229 Java Syntax Continued CT 229 Java Syntax Continued 06/10/2006 CT229 Lab Assignments Due Date for current lab assignment : Oct 8 th Before submission make sure that the name of each.java file matches the name given in the assignment

More information

Introduction to Programming in Turing. Input, Output, and Variables

Introduction to Programming in Turing. Input, Output, and Variables Introduction to Programming in Turing Input, Output, and Variables The IPO Model The most basic model for a computer system is the Input-Processing-Output (IPO) Model. In order to interact with the computer

More information