The book “Octave” and a really nice plot

Hey scientist! How is it going?
IT’S ALIVE! My first book is published, by Casa do Código! We never forget the first one 🙂 In this book we talk about GNU Octave, a free software aimed to solve scientific problems. We’ll celebrate talking about this book and showing how to make the plot used as the basis for the book cover with only two lines of code. Let’s do this!

We are very happy with the book “Octave: Seus primeiros passos na programação científica”, by Casa do Código! It’s a book to teach the reader to program with some scientific thinking, proposed challenges and lots of code!

The book “Octave”, written by this humble writer, released by Casa do Código.

Check the contents!

  • Chapter 1, “Instalando e iniciando o Octave”, has the intention to let your system ready to work. Here we’ll show how to obtain Octave’s installation packages for several systems, besides how to install Octave on a Linux environment, start and finish it.
  • Chapter 2, “Primeiros passos”, will show you how to work on Octave already. Here we’ll get help for commands and functions, we’ll learn how to work using Octave as a powerful scientific calculator and also introduce basic data types and variables.
  • Chapter 3, “Operações com variáveis”, will show you how to work with strings and vectors, and how to operate using them. After that, you’ll see special matrices and functions for Linear Algebra.
  • Chapter 4, “Produzindo gráficos no Octave”, is a must-see! You’ll learn how to plot functions with two and three dimensions using several lines, shapes, colors and symbols.
  • Chapter 5, “Gravando e reaproveitando código”, will introduce you to scripts and functions on Octave, besides how to divide your programs in two files or more, and how to comment them to ease mantaining.
  • Chapter 6, “Operadores e estruturas para controle de fluxo”, will show how to let your code more interactive. You’ll learn how to use ‘if’, ‘for’, ‘while’ and another structures, to be able to solve a series of problems.
  • Chapter 7, “Octave-Forge: mais poder para seu Octave”, will show you an expansion universe, with packages for solving several specific problems. You’ll see how to install, use and remove Forge packages, and also a full list with info about available packages.
  • Chapter 8, “Para onde ir agora?”, presents tools for you to continue your learning journey. You’ll see the available documentation, where to get help, and also how to contribute for Octave development. We have space for your help too 🙂

All the source code on this book is free, and it is available here. Besides, there is a discussion list for the book.

Digital copies (in Brazilian Portuguese) are already available! Printed copies will be available on the next days 🙂 If you have any suggestions about this book, we are always open to hear you, OK? 🙂

Now, let’s do this plot! There is a simple way to make it, using peaks(). This is a test function, with several maxima and minima, as seen on Octave’s documentation. This is the code:

[xx, yy, zz] = peaks(49);
surfc(xx, yy, zz)

Only remembering: have you installed Octave? If not, check how to do it in this post. The argument received by peaks(), 49, indicates the value of the mesh created for the plot on the interval [-3, 3]. Try to use smaller values, such as 15, and larger ones, like 70!

After that we use surfc() to plot the surface and contours. This is the resulting plot:


This plot was customized by Casa do Código’s folks and became that one in the cover. Beautiful, isn’t it?

That’s it for today! Hope you learn several new things with this book! Explore the code, check the discussion list! This material was made just for you!
Thanks scientist! Gigaregards, see you next time!

Like this? Please comment and share with your friends!
Want to download Programando Ciência codes? Go to our GitHub!
Make a donation for Programando Ciência!
Like us also on Facebook:
I’m on Twitter! Follow me if you can! @alexdesiqueira

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s