# Mathedu

Learn math by practice

# Scilab tutorial, Section 3: Programing in Scilab

## Lecture 10: Another Example, Newton Algorithm in 2D

We start the programing learning with another example, a Newton Algorithm in two dimensions. This example shows how to define and draw a function of two variables, a topic that shall be seen in details in Lecture 15. And the Newton algorithm, with a "simple" left-hand matrix division, is programed as a loop. The commands of the session are written in a .sci file. The corresponding .txt file is given as additional material, so that you may copy-and-paste it in Scinotes and save it as a .sci file to execute it. All these manipulations are detailed in Lecture 12.

## Lecture 11: Control Flow, if, for, while, select

In Scilab programing, there are usual control flow commands. The conditional statement if… then… else… is detailed first. Then we see the ordinary and conditional loops for and while. We finish with the select statement for multiple branching. All these imprtant programing features are deostrated in the video, that captures a Scilab session in a pedagogic way.

## Lecture 12: Write and execute a Script, an example of exponential computation

We provide a Scilab session in which we write and execute a script. That script calculates the element by element and global exponential of a matrix, using its Taylor series development. They are then compared with the corresponding Scilab in built functions exp and expm. The script created during the session is given as a text file that may be uploaded and copy-pasted in Scinotes and then saved as a .sce file to be executed. Creating the .sce file and executing it are shown in the video.

## Lecture 13: Functions Library Creating and Use

We finish the Scilab programing learning with the functions, isolated and grouped into library. The Newton algortihm is re-programed for the sinus and the cosine function, with a logic of function library. The sources of the functions shown in the video are given in a zip file that you may upload and unzip in order to generate the library as explained in the video.