1 Using Octave to Introduce Programming to Technical Science Students Nuno C. Marques Francisco Azevedo CENTRIA, DI-

Slides:



Advertisements
Similar presentations
Course Outline Presentation Term: F09 Faculty Name : Asma Sanam Larik Course Name :INTRO TO COMPUTING Course Code : CSE145 Section :1 Semester : 1.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Copyright © 2014 ICT Inspires Ltd. All Rights Reserved. ICT (Computing) Subject Leader Course Session 2: Broader.
© HRS Ltd, In NZ phone , A 6-minute slide show to illustrate the main features of Mathcad documents are used for engineering.
1 Copyright © 2010 AQA and its licensors. All rights reserved. Introduction to the new specification GCSE Computer Science Paul Varey.
Flow Charts, Loop Structures
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
MATLAB Presented By: Nathalie Tacconi Presented By: Nathalie Tacconi Originally Prepared By: Sheridan Saint-Michel Originally Prepared By: Sheridan Saint-Michel.
1 CENG 707 Data Structures and Algorithms Nihan Kesim Çiçekli Department of Computer Engineering Middle East Technical University Fall 2010.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 3 Programming and Software.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Data Structures and Programming.  John Edgar2.
Application of CAS to geodesy: a ‘live’ approach P. Zaletnyik 1, B. Paláncz 2, J.L. Awange 3, E.W. Grafarend 4 1,2 Budapest University of Technology and.
New experiences with teaching Java as a second programming language Ioan Jurca “Politehnica” University of Timisoara/Romania
OOP- OBJECT OBJECT PROGRAMMING By KRATI SHARMA 02 XI-B ✏✏✏✏ ☺☻☺☻☺☻☺ ✏✏✏✏
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
© 2004 The MathWorks, Inc. 1 MATLAB for C/C++ Programmers Support your C/C++ development using MATLAB’s prebuilt graphics functions and trusted numerics.
An innovative learning model for computation in first year mathematics Birgit Loch Department of Mathematics and Computing, USQ Elliot Tonkes CS Energy,
Simplicity First: Use of Tools in Undergraduate CS and IS Teaching By David Naugler and Ken Surendran Southeast Missouri State University Computer Science.
Development of numerical library software in Java Feb 8, 2000 H.Okazawa, Shizuoka Seika College, Japan and T.Sasaki, KEK,Japan.
EENG 1920 Chapter 1 The Engineering Design Process 1.
Introduction to Software Design Chapter 1. Chapter Objectives  To become familiar with the software challenge and the software life cycle  To understand.
Algorithmic Recursion. Recursion Alongside the algorithm, recursion is one of the most important and fundamental concepts in computer science as well.
Software Life Cycle What Requirements Gathering, Problem definition
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
What did I take from the research in AMT to the research in Computer Science and Software Engineering Education? Orit Hazzan Department of Education on.
Intermediate 2 Software Development Process. Software You should already know that any computer system is made up of hardware and software. The term hardware.
Scientific Computing Introduction to Matlab Programming.
Ministry of Higher Education Sohar College of Applied Sciences IT department Comp Introduction to Programming Using C++ Fall, 2011.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
CMSC104 Problem Solving and Computer Programming Spring 2009 Sections 0201 & 0301 Ms. Dawn Block.
1 CS 501 Spring 2004 CS 501: Software Engineering Lecture 2 Software Processes.
Lecture 1: Matlab Universe
Introduction to MATLAB 7 MATLAB Programming for Engineer Hassan Migdadi Spring 2013.
An approach for Framework Construction and Instantiation Using Pattern Languages Rosana Teresinha Vaccare Braga Paulo Cesar Masiero ICMC-USP: Institute.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Topic: U4L5 Remainder and Factor Theorems EQ: Can I correctly apply the Remainder and Factor Theorems to help me factor higher order polynomials?
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
The KOSMOSHOWS What is it ? The statistic inside What it can do ? Future development Demonstration A. Tilquin (CPPM)
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Engineering Computation with MATLAB First Edition by David M. Smith Chapter.
Chapter 2 Excel Fundamentals Logical IF (Decision) Statements Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Numerical Analysis Intro to Scientific Computing.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
L3-S1Analysis Heuristics 2003 SJSU -- CmpE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
1 Programming and problem solving in C, Maxima, and Excel.
Program design Program Design Process has 2 phases:
CSC 222: Object-Oriented Programming
CMSC104 Problem Solving and Computer Programming Spring 2008
CSC 222: Computer Programming II
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
PRE-AP computer science 1
Software for scientific calculations
ALGORITHMS AND FLOWCHARTS
CSC 222: Object-Oriented Programming
CSC 421: Algorithm Design & Analysis
INTRODUCTION TO BASIC MATLAB
(Mohammed Sami) Ashhab
Foundations of Computer Science
GENERAL VIEW OF KRATOS MULTIPHYSICS
CMSC104 Problem Solving and Computer Programming Spring 2010
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
Component Based & Software Reuse
NOTICE! These materials are prepared only for the students enrolled in the course Distributed Software Development (DSD) at the Department of Computer.
Presentation transcript:

1 Using Octave to Introduce Programming to Technical Science Students Nuno C. Marques Francisco Azevedo CENTRIA, DI- FCT/UNL Monte de Caparica, 29 June 2005 Carmen Morgado Jorge Custódio CITI, DI- FCT/UNL

2 Course Background A computer science introductory course offered to non computer science Engineering students. Academic goals –basic digital computer architecture Computer basic instructions can be executed in an algorithmic way. –basic algorithmic notions for building a program Simple assignment instructions to program control flow instructions and functions. –All instructions are presented with practical examples. Simple calculation illustrates the assignment of values to variables. The calculation of the solutions of a second degree polynomial are used to introduce basic control instructions. Iteration on tables presents the need for using cycles. More complex problems as calculation of approximate solutions by iterative algorithms Recursive function calls.

3 Octave as a valuable tool students have fairly heterogeneous set of interests. Non computer science students tend to think that programming a computer is a very specific, difficult and unnecessary task. Learning to construct an algorithm is fundamental for structured thinking. Learning to program a computer is an essential tool for any Engineer. Why Octave? traditional computer languages have become too distant for the current GUI PC user. Octave provides a language with a higher abstraction level directly related to linear algebra. A powerful algebra calculator Enables more challenging problems, while still keeping the clear illustration of the basic concepts in programming. Octave reduces the effort needed to solve real problems. Related language MatLab has an huge number of toolboxes available. To develop small algorithmic solutions that would adapt different toolboxes for specific needs.

4 Some examples for Octave octave:60> A=[1,2,3;4,5,6;7,8,9] A = octave:61> L=log10(A) L = octave:62> (10*ones(size(A))).^L-A ans = e e e e e e e e e+00 octave:60> A=[1,2,3;4,5,6;7,8,9] A = octave:61> L=log10(A) L = octave:62> (10*ones(size(A))).^L-A ans = e e e e e e e e e+00 octave:71> A=[1, 2, 3; 2, 3, 4; 4, 2, 5] A = octave:72> B=[4;5;1] B = octave:89> X =A \ B X = octave:71> A=[1, 2, 3; 2, 3, 4; 4, 2, 5] A = octave:72> B=[4;5;1] B = octave:89> X =A \ B X = Linear Algebra Basic Operation Solving linear equations

5 The Iterative Fibonacci Example fib = ones(1,10); for i = 3:10 fib(i)=fib(i-1)+fib(i-2); endfor octave:3> fib fib = fib = ones(1,10); for i = 3:10 fib(i)=fib(i-1)+fib(i-2); endfor octave:3> fib fib = Introduces: Initialization of vectors. Sequences FOR loops, with interaction among vector components. The traditional notion of vector array is related with linear algebra notion of vector.

6 Another example with OCTAVE A function for calculating an approximation to the square root. The squared root verifies:: N=R*R R =N/R Being E an estimator for R and T the tried approximation: T=N/E IF E>R then T<R (and vice-versa): So, if E=(E+T)/2: We should repeat until |E-T|< P ! First try can be: 1! T=N/E=N TR E TR E

7 Octave solution to approximate square root example N=input('Please insert the number: '); P=input(‘What is the precision: '); E=1; T=N; while (abs(T-E)>=P) E = (E + T) / 2; T=N/E; end printf('%f is the squared roof of %f with a precision of %f.\n', E, N, P); N=input('Please insert the number: '); P=input(‘What is the precision: '); E=1; T=N; while (abs(T-E)>=P) E = (E + T) / 2; T=N/E; end printf('%f is the squared roof of %f with a precision of %f.\n', E, N, P);

8 E.x. 2D Graphic Transform A real example done by students. Basic transforms were given: Students implemented solution. –One group created a snowman… d11=[12;9;1]; d12=[7;9;1]; d13=[8;10;1]; d14=[7;10;1]; d15=[9;10;1]; d16=[8;11;1]; d17=[6;13;1]; d18=[4;11;1]; d19=[4;10;1]; d20=[5;9;1]; d1=[5;0;1]; d2=[7;0;1]; d3=[9;2;1]; d4=[9;3;1]; d5=[7;5;1]; d6=[8;6;1]; d7=[8;8;1]; d8=[11;8;1]; d9=[12;7;1]; d10=[12;8;1]; d21=[4;8;1]; d22=[1;8;1]; d23=[0;9;1]; d24=[0;8;1]; d25=[0;7;1]; d26=[4;6;1]; d27=[5;5;1]; d28=[3;3;1]; d29=[3;2;1]; snowman=[d1,d2,d3,d4,d5,d6,d7,d8,d9,d8,d10,d8,d11,d8,d7,d12,d13,d14,d15,d13,d16,d 17,d18,d16,d18,d19,d20,d21, d22,d23,d22,d24,d22,d25,d22,d21,d26,d27,d28,d29,d1];

9 E.x. 2D Graphic Transform GNU Octave, version (i386-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 John W. Eaton. This is free software with ABSOLUTELY NO WARRANTY. For details, type `warranty'. *** This is a development version of Octave. Development releases *** are provided for people who want to help test, debug, and improve *** Octave. *** *** If you want a stable, well-tested version of Octave, you should be *** using one of the stable releases (when this development release *** was made, the latest stable version was ). octave:1> _ GNU Octave, version (i386-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 John W. Eaton. This is free software with ABSOLUTELY NO WARRANTY. For details, type `warranty'. *** This is a development version of Octave. Development releases *** are provided for people who want to help test, debug, and improve *** Octave. *** *** If you want a stable, well-tested version of Octave, you should be *** using one of the stable releases (when this development release *** was made, the latest stable version was ). octave:1> _ objectos_

10 E.x. 2D Graphic Transform GNU Octave, version (i386-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 John W. Eaton. This is free software with ABSOLUTELY NO WARRANTY. For details, type `warranty'. *** This is a development version of Octave. Development releases *** are provided for people who want to help test, debug, and improve *** Octave. *** *** If you want a stable, well-tested version of Octave, you should be *** using one of the stable releases (when this development release *** was made, the latest stable version was ). octave:1> _objectos ===> SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! <=== Qual o objecto que vai escolher? Quadrado (obj1), Rectângulo (obj2), Triângulo(obj3) ou Laço (obj4)? GNU Octave, version (i386-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 John W. Eaton. This is free software with ABSOLUTELY NO WARRANTY. For details, type `warranty'. *** This is a development version of Octave. Development releases *** are provided for people who want to help test, debug, and improve *** Octave. *** *** If you want a stable, well-tested version of Octave, you should be *** using one of the stable releases (when this development release *** was made, the latest stable version was ). octave:1> _objectos ===> SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! <=== Qual o objecto que vai escolher? Quadrado (obj1), Rectângulo (obj2), Triângulo(obj3) ou Laço (obj4)? snowman_

11 E.x. 2D Graphic Transform octave:1> _objectos ===> SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! <=== Qual o objecto que vai escolher? Quadrado (obj1), Rectângulo (obj2), Triângulo(obj3) ou Laço (obj4)? snowman Deseja fazer uma operação de translacção? sim (prima 1)/não (prima 2)? 1 Tx? -10 Ty? -10 Deseja fazer uma operação de rotação? sim (prima 1)/não (prima 2)? 1 Qual e o ângulo (em graus)? 45 Deseja fazer uma operação de escala? sim (prima 1)/não (prima 2)? 1 Sx? (Sx>0) Sx? (Sx>0) 1.5 Sy? (Sy>0) Sy? (Sy>0) 1.5 octave:1> _objectos ===> SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! SEJA BEM VINDO AO PROGRAMA OBJECTOS!!! <=== Qual o objecto que vai escolher? Quadrado (obj1), Rectângulo (obj2), Triângulo(obj3) ou Laço (obj4)? snowman Deseja fazer uma operação de translacção? sim (prima 1)/não (prima 2)? 1 Tx? -10 Ty? -10 Deseja fazer uma operação de rotação? sim (prima 1)/não (prima 2)? 1 Qual e o ângulo (em graus)? 45 Deseja fazer uma operação de escala? sim (prima 1)/não (prima 2)? 1 Sx? (Sx>0) Sx? (Sx>0) 1.5 Sy? (Sy>0) Sy? (Sy>0) 1.5 ===> Veja o resultado! :) Veja o resultado! :) <===

12 Student Evaluation: Questions in Final Exams (1/2) General algorithm questions: In GNU-Octave a FOR instruction: is necessary to repeat the execution of several instructions; is used to take decisions in an algorithm; is necessary to implement recursive problems, such as a recursive function to calculate the factorial of an integer. is used to repeat the execution of several instructions for a precomputed range (or set) of values. None of the above options is correct Excel lookup questions: The first 50 lines in an Excel Worksheet have student grades in a given course. Column A contains the student number. Column B contains student's name and column C student's grade. The students are sorted by number. If there is a student with number 1335 what is the formula to get this student's grade? =hlookup(1335,A1:C50,1,TRUE); =hlookup(1335,A1:C50,3,FALSE); =vlookup(1335,C1:C50,3,FALSE); Simple algebra in Octave: If a = [1, 2, 3] then: a.*a' returns ans=14. a * a' returns ans=14. a * a returns ans=14. =vlookup(1335,A1:C50,3,FALSE); =vlookup(1335,C1:C50,1,TRUE); a + a returns ans=0. None of the above options is correct.

13 Student Evaluation: Questions in Final Exams (2/2) Programming: Programming: Given the following Octave function (defined in file gera.m): Given the following Octave function (defined in file gera.m): What are the values of variables m and n after executing the commands: What are the values of variables m and n after executing the commands: m=gera(5,3); n=gera(2,3); m=gera(5,3); n=gera(2,3); function v=gera(a,b) if (a>0 && a<=5) for i=1:a for j=1:b if (a>b) v(i,j)=0; else v(i,j)=1; endif endfor else v=0; endif endfunction

14 Assignments presented to students over the semesters

15 Analysis of student evaluation The evolution in learning how to program. Better results when knowledge evaluation was divided into two assignments. even greater improvement by replacing first assignment by Octave written exam (begins spring semester of ). S01/02W01/02S02/03W02/03 -correct/Accepted -No Reply -wRong

16 Analysis of student evaluation Relation between general Octave matrix manipulation and Octave programming. There is a strong relation between the success rate in replies to Octave matrix calculus and the success rate in the programming questions. Excel LOOKUP questions are correlated to simple programming questions. 37% accuracy in programming pass to 51% accuracy for students that reply to Excel LOOKUP question.

17 Conclusions GNU Octave is an excellent way to present computer programming to students. can replace and extend MS-Excel in numerical analysis studies. students easily start to use Octave command line for issuing basic algebra and numeric manipulation commands. Octave programming environment: It is just a simple prompt in the command line. Students tend to adapt relatively fast to the command line interface. More complex graphical interfaces: Are more suitable to user dispersion. Try to hide the algorithmic and command oriented computer. But it would be useful to show the state of a running program (as in a debugger). Graphically oriented problems are more attractive. Most students finished course with the main concepts regarding algorithmic knowledge and with a tool to apply in real life situations.

18 Thank you for your attention For additional information please contact the authors at  Departamento de Informática FCT/ UNL  Tel: (+351) Fax:  (Please add subject: ICP )  Web-Page: For additional information please contact the authors at  Departamento de Informática FCT/ UNL  Tel: (+351) Fax:  (Please add subject: ICP )  Web-Page: An algorithm? [ Pavão Martins 94]