Book Image

Scientific Computing with Scala

By : Vytautas Jancauskas
Book Image

Scientific Computing with Scala

By: Vytautas Jancauskas

Overview of this book

Scala is a statically typed, Java Virtual Machine (JVM)-based language with strong support for functional programming. There exist libraries for Scala that cover a range of common scientific computing tasks – from linear algebra and numerical algorithms to convenient and safe parallelization to powerful plotting facilities. Learning to use these to perform common scientific tasks will allow you to write programs that are both fast and easy to write and maintain. We will start by discussing the advantages of using Scala over other scientific computing platforms. You will discover Scala packages that provide the functionality you have come to expect when writing scientific software. We will explore using Scala's Breeze library for linear algebra, optimization, and signal processing. We will then proceed to the Saddle library for data analysis. If you have experience in R or with Python's popular pandas library you will learn how to translate those skills to Saddle. If you are new to data analysis, you will learn basic concepts of Saddle as well. Well will explore the numerical computing environment called ScalaLab. It comes bundled with a lot of scientific software readily available. We will use it for interactive computing, data analysis, and visualization. In the following chapters, we will explore using Scala's powerful parallel collections for safe and convenient parallel programming. Topics such as the Akka concurrency framework will be covered. Finally, you will learn about multivariate data visualization and how to produce professional-looking plots in Scala easily. After reading the book, you should have more than enough information on how to start using Scala as your scientific computing platform
Table of Contents (16 chapters)
Scientific Computing with Scala
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Plotting with JFreeChart


JFreeChart is a very popular open source library for plotting written in Java. It is not specifically designed with scientific plotting in mind. However, you can easily do most types of common scientific plots with it. The advantage of using this library is that it is very well supported and has been around for a longtime. This means that it is probably not going anywhere soon, which is a risk with many of the newer libraries that may not have the required developer power to keep going.

Using JFreeChart in your project

To use JFreeChart in your project, you need to download it and then put it in the lib directory of your project. Download JFreeChart by going to the following website:

http://www.jfree.org/jfreechart/

After downloading the .zip file containing the library, copy the lib folder from the archive to the lib folder under your project tree. This will make the library available to your Scala program when you run it using SBT. Without further ado, let's examine...