0% found this document useful (0 votes)
36 views

Numeric Computation and Statistical Data Analysis On The Java Platform Advanced Information and Knowledge Processing Chekanov Sergei V

Platform

Uploaded by

akwlngalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Numeric Computation and Statistical Data Analysis On The Java Platform Advanced Information and Knowledge Processing Chekanov Sergei V

Platform

Uploaded by

akwlngalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Numeric Computation and Statistical Data


Analysis on the Java Platform Advanced
Information and Knowledge Processing Chekanov
Sergei V
https://textbookfull.com/product/numeric-
computation-and-statistical-data-analysis-on-the-
java-platform-advanced-information-and-knowledge-
processing-chekanov-sergei-v/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Scientific Data Analysis using Jython Scripting and Java


Advanced Information and Knowledge Processing 2010th
Edition Chekanov Sergei V
https://textbookfull.com/product/scientific-data-analysis-using-
jython-scripting-and-java-advanced-information-and-knowledge-
processing-2010th-edition-chekanov-sergei-v/
textbookfull.com

Advanced R Statistical Programming and Data Models:


Analysis, Machine Learning, and Visualization 1st Edition
Matt Wiley
https://textbookfull.com/product/advanced-r-statistical-programming-
and-data-models-analysis-machine-learning-and-visualization-1st-
edition-matt-wiley/
textbookfull.com

Metaprogramming in R: Advanced Statistical Programming for


Data Science, Analysis and Finance 1st Edition Thomas
Mailund
https://textbookfull.com/product/metaprogramming-in-r-advanced-
statistical-programming-for-data-science-analysis-and-finance-1st-
edition-thomas-mailund/
textbookfull.com

Poststructural Policy Analysis: A Guide to Practice 1st


Edition Carol Bacchi

https://textbookfull.com/product/poststructural-policy-analysis-a-
guide-to-practice-1st-edition-carol-bacchi/

textbookfull.com
Textbook of Clinical Otolaryngology Abdulsalam Al-Qahtani
(Editor)

https://textbookfull.com/product/textbook-of-clinical-otolaryngology-
abdulsalam-al-qahtani-editor/

textbookfull.com

The Language of Medicine 11th Edition Davi-Ellen Chabner

https://textbookfull.com/product/the-language-of-medicine-11th-
edition-davi-ellen-chabner/

textbookfull.com

Pakistan s Inter Services Intelligence Directorate Covert


Action and Internal Operations 1st Edition Owen L. Sirrs

https://textbookfull.com/product/pakistan-s-inter-services-
intelligence-directorate-covert-action-and-internal-operations-1st-
edition-owen-l-sirrs/
textbookfull.com

Innovative Business Development—A Global Perspective: 25th


International Economic Conference of Sibiu (IECS 2018)
Ramona Or■■tean
https://textbookfull.com/product/innovative-business-development-a-
global-perspective-25th-international-economic-conference-of-sibiu-
iecs-2018-ramona-orastean/
textbookfull.com

Mammal Tracks Sign A Guide to North American Species 2nd


Edition Elbroch

https://textbookfull.com/product/mammal-tracks-sign-a-guide-to-north-
american-species-2nd-edition-elbroch/

textbookfull.com
Continuous EEG Monitoring Principles and Practice 1st
Edition Aatif M. Husain

https://textbookfull.com/product/continuous-eeg-monitoring-principles-
and-practice-1st-edition-aatif-m-husain/

textbookfull.com
Advanced Information and Knowledge Processing

Sergei V. Chekanov

Numeric
Computation and
Statistical Data
Analysis on the
Java Platform
Advanced Information and Knowledge
Processing

Series editors
Lakhmi C. Jain
Bournemouth University, Poole, UK and
University of South Australia, Adelaide, Australia

Xindong Wu
University of Vermont
Information systems and intelligent knowledge processing are playing an increasing
role in business, science and technology. Recently, advanced information systems
have evolved to facilitate the co-evolution of human and information networks
within communities. These advanced information systems use various paradigms
including artificial intelligence, knowledge management, and neural science as well
as conventional information processing paradigms. The aim of this series is to
publish books on new designs and applications of advanced information and
knowledge processing paradigms in areas including but not limited to aviation,
business, security, education, engineering, health, management, and science. Books
in the series should have a strong focus on information processing—preferably
combined with, or extended by, new results from adjacent sciences. Proposals for
research monographs, reference books, coherently integrated multi-author edited
books, and handbooks will be considered for the series and each proposal will be
reviewed by the Series Editors, with additional reviews from the editorial board and
independent reviewers where appropriate. Titles published within the Advanced
Information and Knowledge Processing series are included in Thomson Reuters’
Book Citation Index.

More information about this series at http://www.springer.com/series/4738


Sergei V. Chekanov

Numeric Computation
and Statistical Data Analysis
on the Java Platform

123
Sergei V. Chekanov
HEP Division
Argonne National Laboratory
Lemont, IL
USA

Additional material to this book can be downloaded from http://extras.springer.com/.

ISSN 1610-3947 ISSN 2197-8441 (electronic)


Advanced Information and Knowledge Processing
ISBN 978-3-319-28529-0 ISBN 978-3-319-28531-3 (eBook)
DOI 10.1007/978-3-319-28531-3

Library of Congress Control Number: 2016932001

© Springer International Publishing Switzerland 2016


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this
publication does not imply, even in the absence of a specific statement, that such names are exempt from
the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this
book are believed to be true and accurate at the date of publication. Neither the publisher nor the
authors or the editors give a warranty, express or implied, with respect to the material contained herein or
for any errors or omissions that may have been made.

Printed on acid-free paper

This Springer imprint is published by SpringerNature


The registered company is Springer International Publishing AG Switzerland
This book is dedicated to my family
Preface

Numerical and statistical algorithms are typically confined within a specific pro-
gramming language. For example, the R open-source data-analysis software uses a
specialized scripting language, which is an implementation of the “S” programming
language. Many commercial mathematical programs follow this trend. This book is
about a platform for statistical calculations using algorithms that are not confined by
a chosen language. For example, this platform allows mixing Python and Java
numerical libraries, or using them on their own. Or, one can use this book to
program statistical code using other languages, such as Groovy, Ruby, and
BeanShell. This book is about an approach to scientific programming and visual-
ization that does not set strict requirements on specific programming languages, nor
on operating systems where such calculations are performed.
There are many books written about Java—one of the most popular program-
ming languages. There are many books written about Python, which is another very
popular programming language. This book explains how to mix them, bringing
incredible algorithmic power and cutting-edge numeric libraries to scientific com-
putations and data visualization.
In this book I did not go deep inside particular scientific research area, since the
aim was to give concrete examples which illustrate which Java libraries should be
used to perform computations. In the cases when I could not cover the subject in
detail, a sufficient number of relevant references was given, so the reader can easily
find necessary information for each chapter using external sources.
Thus this book presents practical approaches to numerical computations, data
analysis, and knowledge discovery, focusing on programming techniques. Each
chapter describes the conceptual underpinning for numerical and statistical calcu-
lations using Java libraries, covering many aspects from simple multidimensional
arrays and histograms to clustering analysis, curve fitting, neural networks, and
symbolic calculations. To make the examples as simple as possible from the
computational point of view, I fully embrace the scripting approach in the course of
this book. This leads to short and clear analysis codes, so you could concentrate on
the logic of analysis flow rather than on language-specific details.

vii
viii Preface

This book uses Python as the main programming language, since it is elegant and
easy to learn. It is a great language for teaching scientific computation. For devel-
opers, this is an ideal language for fast prototyping and debugging. The book dis-
cusses how to design code snippets for numeric computation and statistics on the
Java platform. To be more exact, we will use Jython (Python implemented in Java), a
language that uses not only native Python modules, but can also access very com-
prehensive Java classes. The reader will learn how to write analysis codes, while
numerous code snippets will give you some ideas on numeric algorithms which can
easily be incorporated into realistic research application. The book includes more
than 300 code snippets to produce data-visualization plots in 2D and 3D.
I am almost convinced myself that this book is self-contained and does not
depend on detailed knowledge of computing language, although knowledge of
Python and Java is desirable. However, the reader may still need some programming
background in order to use this book with other languages, such as Groovy,
BeanShell, and Ruby, since I did not give very detailed coverage of these languages.

Who Is This Book for

This book is intended for general audiences, for those who use computing to make
sense of data surrounding us. It can be used as a source of knowledge on data
analysis and statistical calculations for students and professionals of all disciplines.
This book was written for undergraduate and graduate students, academics, pro-
fessors, and professionals of any field and any age. The book could be used as a
textbook for students.
We also hope that this book will be useful for those who study financial markets,
since the numeric algorithms discussed in this book are undoubtedly common to any
knowledge discovery research. This book equips readers with the description of a
computational platform for statistical calculations which can be viewed as an inex-
pensive alternative to costly commercial products used by financial-market analysts.
I assume the readers are not familiar with Python/Jython, the main programming
language used for code snippets in this book. But some basic understanding of
statistics and mathematics would be very helpful to understand the material of this
book.
All example codes of this book can easily be transformed to Java, Groovy,
Ruby/JRuby, or BeanShell codes. You are presumed to have knowledge of pro-
gramming in Java, if you will choose the path of moving the examples to Java, or if
you will decide to create Java libraries to be deployed as jar files for a new project.
The book will discuss how to do this, and a few Java examples will be provided.
Transformations of the example snippets to scripting languages, such as Groovy,
Ruby/JRuby, or BeanShell, may require some knowledge of these scripting
languages. The good thing is that the analysis algorithms and numerical libraries
will be exactly the same, so a little effort is required to move to other languages.
Again, we will show you how to convert Jython codes to these languages. In most
Preface ix

cases, our examples should be sufficient to get started with a new language. The
more knowledge about Groovy and Ruby/JRuby you can bring, the more you will
get out of this book.

Books You May Read Before

The material of this book is self-contained. However, to understand the material


deeper, you may need to look at other sources. First of all, there are plenty of good
books [1–5] on Python and Jython, which are more complete for language-specific
topics than the information given in this book. If you program in Java that forms the
backbone of numerical and graphical libraries discussed in this book, a great deal of
supplementary information can be found in Java books [6–10].
Secondly, there are several books on Groovy, a popular scripting language that
can be used to work with the Java numerical libraries discussed in this book [11,
12]. If your choice is JRuby, the Ruby programming language on the Java platform,
look at these books [13, 14] to get started.
Thirdly, as you read, you may need to look at external sources to understand the
material better, especially when we come to statistical interpretations of data. We will
supply the reader with the necessary references, so he or she can choose the most
appropriate (and affordable) books to discover the world of data analysis and data
mining.

References

1. Pilgrim M (2004), Dive into Python, Apress


2. Guzdial M (2005) Introduction to computing and programming in Python, a multimedia
approach, Prentice Hall
3. Martelli A (2006) Python in a nutshell (in a nutshell (O’Reilly)), O’Reilly Media, Inc.
4. Lutz M (2007) Learning Python, 3rd edn. O’Reilly Media, Inc.
5. Langtangen H (2008) Python scripting for computational science. Springer-Verlag, Berlin,
Heidelberg
6. Richardson C, Avondolio D, Vitale J et al (2005) Professional Java, JDK 5 Edition, Wrox
7. Arnold K, Gosling J, Holmes D (2005) Java(TM) programming language. In: The Java Series,
4th edn. Addison-Wesley Professional
8. Flanagan D (2005) Java in a nutshell, 5th edn. O’Reilly Media, Inc.
9. Eckel B (2006) Thinking in Java, 4th edn. Prentice Hall PTR
10. Bloch J (2008) Effective Java. In: The Java Series, 2nd edn. Prentice Hall PTR
11. Subramaniam V (2013) Programming Groovy 2: dynamic productivity for the Java
Developer, Pragmatic Programmers, LLC
12. King D, Glover A (2013) Groovy in action, Manning Publications, 2007, https://www.
manning.com/books/groovy-in-action
13. Edelson J, Liu H (2008) JRuby cookbook, O’Reilly Media
14. Bini O (2007) Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java,
Apress
Acknowledgements

This book describes a software which is a collective work of many developers who
have dedicated themselves to scientific computing. The author is grateful to all
people who contributed to scientific software, and for their inspiration and dedi-
cation to science and knowledge-discovery software.
Many numeric and graphic libraries discussed in this book were released as
open-source projects. I am grateful to the authors of such open-source programs for
their enthusiasm to share their work, and for making their software publicly
available.
You can find a list of contributions to the software packages described in this
book on the jWork.ORG web page (http://jwork.org/dmelt/). A special note of
thanks to those of you who reported bugs in a constructive way, helped with
solutions, and shared your knowledge and experience with others.
Much of this project grew out of fruitful collaboration with many of my col-
leagues who devoted themselves to high energy physics. Over the course of the past
twenty-five years I have learned a lot about programming aspects of scientific
research. I would like to thank my colleagues for checking and debugging the
examples shown in this book, and here the list will be endless.
I would like to thank everyone at Springer for their help with the production
process. In particular, managing editors H. Desmond and J. Robinson, who helped
start this book in its present form.
Not least, personal thanks go to my dear wife, Tania, and my sons, Alexey
(Alosha) and Roman, for their love and patience to a husband and father who was
only half (mentally) present after coming from his work. Without their patience and
understanding, this book would not have been possible. Finally, I also thank my
parents and sister for their support of my interests in all aspects of science.

Chicago Sergei V. Chekanov


January 2016

xi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Contents

1 Java Computational Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Programming in Java. . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 The DMelt Software Platform. . . . . . . . . . . . . . . . 3
1.1.3 Some Warnings . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.4 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Scripting with DMelt . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.1 Learning by Example . . . . . . . . . . . . . . . . . . . . . 7
1.2.2 Using Jython for Code Examples . . . . . . . . . . . . . 8
1.2.3 Differences with Other Math Software . . . . . . . . . . 9
1.3 Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 DMelt Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4.1 Source Code Editor . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.2 DMelt Libraries . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.3 Jython and BeanShell Consoles . . . . . . . . . . . . . . 15
1.4.4 Accessing Methods of Instances . . . . . . . . . . . . . . 17
1.4.5 Editing Jython Scripts . . . . . . . . . . . . . . . . . . . . . 17
1.4.6 Running Jython Scripts . . . . . . . . . . . . . . . . . . . . 17
1.4.7 Macro Files of the DMelt IDE . . . . . . . . . . . . . . . 18
1.4.8 Running BeanShell Scripts . . . . . . . . . . . . . . . . . . 19
1.4.9 Compiling and Running Java Code . . . . . . . . . . . . 19
1.4.10 DMelt Code Assist . . . . . . . . . . . . . . . . . . . . . . . 20
1.4.11 Other Features . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.4.12 Working with Images . . . . . . . . . . . . . . . . . . . . . 23
1.4.13 DMelt License . . . . . . . . . . . . . . . . . . . . . . . . . . 24
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

xiii
xiv Contents

2 Introduction to Jython . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.1 Code Structure and Jython Objects . . . . . . . . . . . . . . . . . . . 27
2.1.1 Numbers as Objects . . . . . . . . . . . . . . . . . . . . . . 30
2.1.2 Formatted Output . . . . . . . . . . . . . . . . . . . . . . . . 32
2.1.3 Mathematical Functions . . . . . . . . . . . . . . . . . . . . 32
2.2 Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.3 Strings as Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.4 Import Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4.1 Executing Native Applications . . . . . . . . . . . . . . . 37
2.5 Comparison Tests and Loops . . . . . . . . . . . . . . . . . . . . . . . 38
2.5.1 The “if-else” Statement . . . . . . . . . . . . . . . . . . . . 38
2.5.2 Loops. The “for” Statement . . . . . . . . . . . . . . . . . 39
2.5.3 The “continue” and “break” Statements . . . . . . . . . 39
2.5.4 Loops. The “while” Statement . . . . . . . . . . . . . . . 40
2.6 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.6.1 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.6.2 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.6.3 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.6.4 Functional Programming . . . . . . . . . . . . . . . . . . . 48
2.7 Java Collections in Jython . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.7.1 List. An Ordered Collection . . . . . . . . . . . . . . . . . 50
2.7.2 Set. A Collection Without Duplicate Elements . . . . 53
2.7.3 SortedSet. Sorted Unique Elements . . . . . . . . . . . . 54
2.7.4 Map. Mapping Keys to Values . . . . . . . . . . . . . . . 55
2.7.5 Java Map with Sorted Elements . . . . . . . . . . . . . . 55
2.7.6 Real-Life Example: Sorting and Removing
Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.8 Random Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.9 Time Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.9.1 Benchmarking . . . . . . . . . . . . . . . . . . . . . . . . . . 59
2.10 Python Functions and Modules. . . . . . . . . . . . . . . . . . . . . . 60
2.11 Python Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.11.1 Initializing a Class . . . . . . . . . . . . . . . . . . . . . . . 65
2.11.2 Classes Inherited from Other Classes. . . . . . . . . . . 65
2.11.3 Java Classes in Jython . . . . . . . . . . . . . . . . . . . . . 66
2.11.4 Not Covered Topics . . . . . . . . . . . . . . . . . . . . . . 66
2.12 Parallel Computing and Threads . . . . . . . . . . . . . . . . . . . . . 67
2.13 Arrays in Jython. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.13.1 Array Conversion and Transformations . . . . . . . . . 69
2.13.2 Performance Issues . . . . . . . . . . . . . . . . . . . . . . . 69
2.13.3 Used Memory . . . . . . . . . . . . . . . . . . . . . . . . . . 70
2.14 Exceptions in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Contents xv

2.15 Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72


2.15.1 User Interaction . . . . . . . . . . . . . . . . . . . . . . . . . 72
2.15.2 Reading and Writing Files . . . . . . . . . . . . . . . . . . 72
2.15.3 Input and Output for Arrays . . . . . . . . . . . . . . . . . 74
2.15.4 Working with CSV Python Module. . . . . . . . . . . . 74
2.15.5 Saving Objects in a Serialized File . . . . . . . . . . . . 76
2.15.6 Storing Multiple Objects . . . . . . . . . . . . . . . . . . . 77
2.15.7 Using Java for I/O . . . . . . . . . . . . . . . . . . . . . . . 78
2.15.8 Reading Data from the Network . . . . . . . . . . . . . . 79
2.16 Real-Life Example. Collecting Data Files . . . . . . . . . . . . . . 80
2.17 Using Java for GUI Programming. . . . . . . . . . . . . . . . . . . . 82
2.18 Concluding Remarks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
3 Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.1 Python Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.2 Functions in DMelt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
3.2.1 Java Implementation of F1D . . . . . . . . . . . . . . . . 89
3.2.2 Manipulations with 1D Functions . . . . . . . . . . . . . 90
3.3 Plotting 1D Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.3.1 Building a Graphical Canvas . . . . . . . . . . . . . . . . 93
3.3.2 Drawing 1D Functions . . . . . . . . . . . . . . . . . . . . 97
3.3.3 Plotting Functions on Different Pads . . . . . . . . . . . 99
3.3.4 Short Summary of HPlot Methods . . . . . . . . . . . . 99
3.3.5 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
3.4 2D Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3.4.1 Functions in Two Dimensions . . . . . . . . . . . . . . . 102
3.4.2 Displaying 2D Functions . . . . . . . . . . . . . . . . . . . 103
3.4.3 Using a Contour Plot. . . . . . . . . . . . . . . . . . . . . . 105
3.5 3D Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
3.5.1 Functions in Three Dimensions. . . . . . . . . . . . . . . 106
3.6 Functions in Many Dimensions . . . . . . . . . . . . . . . . . . . . . 107
3.6.1 FND Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 107
3.6.2 Drawing FND Functions . . . . . . . . . . . . . . . . . . . 108
3.7 Custom Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
3.7.1 Custom Functions and Their Methods . . . . . . . . . . 109
3.7.2 Custom Functions Using Expression Builder . . . . . 112
3.7.3 Custom Functions in Jython . . . . . . . . . . . . . . . . . 114
3.8 Parametric Surfaces in 3D . . . . . . . . . . . . . . . . . . . . . . . . . 119
3.8.1 FPR Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 119
3.8.2 3D Mathematical Objects . . . . . . . . . . . . . . . . . . . 122
xvi Contents

3.9 Function Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . 122


3.9.1 Minimization of Multidimensional Functions . . . . . 125
3.9.2 Calling Migrad Directly . . . . . . . . . . . . . . . . . . . . 126
3.10 File Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
4 Data Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
4.1 1D Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
4.1.1 P0D Data Container . . . . . . . . . . . . . . . . . . . . . . 132
4.1.2 P0D Transformations. . . . . . . . . . . . . . . . . . . . . . 135
4.1.3 Statistical Summary. . . . . . . . . . . . . . . . . . . . . . . 136
4.1.4 Displaying P0D Data. . . . . . . . . . . . . . . . . . . . . . 138
4.1.5 File Input and Output . . . . . . . . . . . . . . . . . . . . . 139
4.2 Arrays for Two Dimensions . . . . . . . . . . . . . . . . . . . . . . . . 143
4.2.1 Data with Errors . . . . . . . . . . . . . . . . . . . . . . . . . 144
4.2.2 Viewing P1D Data . . . . . . . . . . . . . . . . . . . . . . . 150
4.2.3 Plotting P1D Data. . . . . . . . . . . . . . . . . . . . . . . . 151
4.2.4 Contour Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
4.2.5 Manipulations with P1D Data. . . . . . . . . . . . . . . . 153
4.2.6 Advanced P1D Operations . . . . . . . . . . . . . . . . . . 155
4.2.7 Weighted Average and Systematical
Uncertainties . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
4.2.8 File Input and Output . . . . . . . . . . . . . . . . . . . . . 159
4.2.9 Example I: Henon Attractor . . . . . . . . . . . . . . . . . 162
4.2.10 Example II. Weighted Average . . . . . . . . . . . . . . . 163
4.3 Other Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
4.3.1 P2D Data Container . . . . . . . . . . . . . . . . . . . . . . 166
4.3.2 P3D Data Container . . . . . . . . . . . . . . . . . . . . . . 169
4.3.3 PND Data Container . . . . . . . . . . . . . . . . . . . . . . 171
4.3.4 File Input and Output . . . . . . . . . . . . . . . . . . . . . 174
4.4 Third-Party Data Containers. . . . . . . . . . . . . . . . . . . . . . . . 174
4.4.1 Math Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
4.4.2 Jaida Data Containers . . . . . . . . . . . . . . . . . . . . . 175
4.4.3 jMathTools Arrays . . . . . . . . . . . . . . . . . . . . . . . 178
4.4.4 Colt Data Containers . . . . . . . . . . . . . . . . . . . . . . 181
4.4.5 Lorentz Vector . . . . . . . . . . . . . . . . . . . . . . . . . . 182
4.5 Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 185
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
5 Linear Algebra and Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5.1 Vector and Matrix Packages . . . . . . . . . . . . . . . . . . . . . . . 187
5.1.1 Basic Matrix Arithmetic. . . . . . . . . . . . . . . . . . . . 189
5.1.2 Elements of Linear Algebra . . . . . . . . . . . . . . . . . 190
5.1.3 Jampack Matrix Computations . . . . . . . . . . . . . . . 191
5.1.4 La4J Library . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Contents xvii

5.1.5 EJML Matrix Library . . . . . . . . . . . . . . . . . . . . . 195


5.1.6 Multithreaded Matrix Computations . . . . . . . . . . . 196
5.1.7 JBlas and Other Matrix Packages . . . . . . . . . . . . . 199
5.1.8 Python Vector and Matrix Operations . . . . . . . . . . 199
5.1.9 Matrix Operations in SymPy . . . . . . . . . . . . . . . . 201
5.2 Algebraic Manipulations with Tensors. . . . . . . . . . . . . . . . . 202
5.3 Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
5.3.1 Polynomial Equations . . . . . . . . . . . . . . . . . . . . . 203
5.3.2 Linear Systems of Equations . . . . . . . . . . . . . . . . 204
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6 Symbolic Computations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.1 Using the Octave Language . . . . . . . . . . . . . . . . . . . . . . . . 207
6.2 Java Symbolic Computing Library . . . . . . . . . . . . . . . . . . . 208
6.2.1 Conversion to Elementary Functions . . . . . . . . . . . 210
6.2.2 Numeric Calculations . . . . . . . . . . . . . . . . . . . . . 210
6.2.3 Simplify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.2.4 Substitutions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.2.5 Differentiate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.2.6 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.2.7 Factorization . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
6.2.8 MathML Output . . . . . . . . . . . . . . . . . . . . . . . . . 213
6.2.9 Integration with DMelt Plotting Canvases . . . . . . . 213
6.3 Using SymPy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
7 Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
7.1 One-Dimensional Histogram . . . . . . . . . . . . . . . . . . . . . . . 220
7.1.1 Probability Distribution and Probability Density . . . 224
7.1.2 Histogram Characteristics. . . . . . . . . . . . . . . . . . . 225
7.1.3 Initialization and Filling Methods . . . . . . . . . . . . . 225
7.1.4 Accessing Histogram Values . . . . . . . . . . . . . . . . 228
7.1.5 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
7.1.6 Histogram Operations . . . . . . . . . . . . . . . . . . . . . 230
7.1.7 Accessing Low-Level Jaida Classes. . . . . . . . . . . . 231
7.1.8 Graphical Attributes . . . . . . . . . . . . . . . . . . . . . . 232
7.2 Histogram in 2D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
7.2.1 Histogram Operations . . . . . . . . . . . . . . . . . . . . . 236
7.2.2 Graphical Representation . . . . . . . . . . . . . . . . . . . 236
7.3 Histograms in Jaida . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
7.4 Histogram in 3D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
7.5 Profile Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
xviii Contents

7.6 Histogram Input and Output. . . . . . . . . . . . . . . . . . . . . . . . 244


7.6.1 External Programs for Histograms. . . . . . . . . . . . . 246
7.7 Analyzing Histograms from Multiple Files. . . . . . . . . . . . . . 247
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
8 Scientific visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.1 Graphical Canvases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.2 HPlot Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
8.2.1 Working with the HPlot Canvas . . . . . . . . . . . . . . 255
8.2.2 Saving Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.2.3 Reading Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8.2.4 Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8.2.5 Summary of the HPlot Methods . . . . . . . . . . . . . . 259
8.2.6 Exporting to Image Files . . . . . . . . . . . . . . . . . . . 261
8.2.7 Labels and Keys . . . . . . . . . . . . . . . . . . . . . . . . . 262
8.2.8 Geometrical Primitives. . . . . . . . . . . . . . . . . . . . . 265
8.2.9 Text Strings and Symbols . . . . . . . . . . . . . . . . . . 266
8.3 Interconnected Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
8.4 Showing Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
8.5 Lightweight Canvases . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
8.5.1 Henon Attractor Again . . . . . . . . . . . . . . . . . . . . 275
8.6 Canvas for Interactive Drawing . . . . . . . . . . . . . . . . . . . . . 276
8.6.1 Drawing Diagrams . . . . . . . . . . . . . . . . . . . . . . . 277
8.6.2 SHPlotJa Class . . . . . . . . . . . . . . . . . . . . . . . . . . 279
8.7 Custom Plotting in XY . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
8.7.1 HPlotXY Canvas . . . . . . . . . . . . . . . . . . . . . . . . 279
8.7.2 WPlot Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . 280
8.7.3 HPlotJas Canvas . . . . . . . . . . . . . . . . . . . . . . . . . 281
8.8 HPlot2D Canvas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
8.9 Visualization in 3D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
8.9.1 HPlot3D Canvas . . . . . . . . . . . . . . . . . . . . . . . . . 285
8.9.2 HPlot3DP Canvas . . . . . . . . . . . . . . . . . . . . . . . . 285
8.9.3 Mathematical Objects in 3D . . . . . . . . . . . . . . . . . 289
8.10 Plotting Real-Time Data . . . . . . . . . . . . . . . . . . . . . . . . . . 291
8.10.1 Real-Time Data Using SPlot . . . . . . . . . . . . . . . . 292
8.10.2 Real-Time Data Using HPlotRT . . . . . . . . . . . . . . 293
8.11 Graphs and Java GUI Components . . . . . . . . . . . . . . . . . . . 293
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
9 File Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
9.1 Nonpersistent Data: Memory-Based Data. . . . . . . . . . . . . . . 297
9.2 Object Serialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
9.3 Persistent Event Records . . . . . . . . . . . . . . . . . . . . . . . . . . 300
9.3.1 Sequential Input and Output . . . . . . . . . . . . . . . . . 300
9.3.2 Opening Data in a Browser . . . . . . . . . . . . . . . . . 302
Contents xix

9.3.3 Saving Event Records Persistently. . . . . . . . . . . . . 303


9.3.4 Buffer Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
9.3.5 XML File Format . . . . . . . . . . . . . . . . . . . . . . . . 305
9.4 PFile Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
9.4.1 Browser for PFile File Data . . . . . . . . . . . . . . . . . 308
9.5 HBook XML Data Output . . . . . . . . . . . . . . . . . . . . . . . . . 309
9.6 Text File Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
9.6.1 Working with ASCII Files . . . . . . . . . . . . . . . . . . 311
9.6.2 CSV File Format . . . . . . . . . . . . . . . . . . . . . . . . 312
9.6.3 EDN File Format . . . . . . . . . . . . . . . . . . . . . . . . 315
9.6.4 DIF File Format . . . . . . . . . . . . . . . . . . . . . . . . . 316
9.7 Reading ROOT and AIDA Files. . . . . . . . . . . . . . . . . . . . . 317
9.7.1 ROOT Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
9.7.2 AIDA Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
9.8 Google’s Protocol Buffer Format . . . . . . . . . . . . . . . . . . . . 318
9.8.1 Prototyping Data Records . . . . . . . . . . . . . . . . . . 319
9.8.2 Dealing with Data Using Java . . . . . . . . . . . . . . . 321
9.8.3 Switching to Jython . . . . . . . . . . . . . . . . . . . . . . 323
9.8.4 Adding New Data Records. . . . . . . . . . . . . . . . . . 324
9.8.5 Using C++ with the Protocol Buffers. . . . . . . . . . . 325
9.8.6 Some Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.9 Creating Excel Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
9.10 Non-SQL Object Databases . . . . . . . . . . . . . . . . . . . . . . . . 330
9.10.1 Nonsequential Input and Output . . . . . . . . . . . . . . 330
9.10.2 Persistent Map . . . . . . . . . . . . . . . . . . . . . . . . . . 332
9.10.3 MapDB Database . . . . . . . . . . . . . . . . . . . . . . . . 333
9.10.4 NeoDatis Database . . . . . . . . . . . . . . . . . . . . . . . 334
9.11 Relational SQL Databases . . . . . . . . . . . . . . . . . . . . . . . . . 335
9.11.1 Derby SQL Database. . . . . . . . . . . . . . . . . . . . . . 336
9.11.2 HyperSQL Database . . . . . . . . . . . . . . . . . . . . . . 341
9.11.3 SQLite Database . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.12 Miscellaneous Input–Output Topics . . . . . . . . . . . . . . . . . . 343
9.12.1 Building List of Files . . . . . . . . . . . . . . . . . . . . . 343
9.12.2 Reading Configuration Files . . . . . . . . . . . . . . . . . 344
9.13 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
9.13.1 Dealing with Single Objects . . . . . . . . . . . . . . . . . 347
9.13.2 Dealing with Object Collections . . . . . . . . . . . . . . 347
9.13.3 Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
9.13.4 Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
10 Probability and Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
10.1 Descriptive Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
10.1.1 Comparing Data . . . . . . . . . . . . . . . . . . . . . . . . . 355
10.2 Statistical Analysis Using Python . . . . . . . . . . . . . . . . . . . . 356
xx Contents

10.3 Random Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359


10.3.1 Using Random Numbers . . . . . . . . . . . . . . . . . . . 360
10.3.2 Random Numbers in Colt . . . . . . . . . . . . . . . . . . 362
10.3.3 Other Packages with Random Numbers . . . . . . . . . 364
10.4 Random Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
10.4.1 Methods of 1D Arrays. . . . . . . . . . . . . . . . . . . . . 368
10.4.2 Methods of 2D Arrays. . . . . . . . . . . . . . . . . . . . . 370
10.4.3 Sampling Using the Colt Package . . . . . . . . . . . . . 372
10.5 Statistical Significance and Confidence Levels . . . . . . . . . . . 373
10.5.1 Statistical Significance . . . . . . . . . . . . . . . . . . . . . 373
10.5.2 Discovery Sensitivity. . . . . . . . . . . . . . . . . . . . . . 376
10.5.3 Confidence Interval . . . . . . . . . . . . . . . . . . . . . . . 377
10.5.4 Confidence Levels for Small Statistics . . . . . . . . . . 378
10.5.5 Statistical Tests. . . . . . . . . . . . . . . . . . . . . . . . . . 382
10.5.6 Confidence Levels for Distributions. . . . . . . . . . . . 385
10.6 Error Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
10.6.1 Propagation Using Monte Carlo Technique . . . . . . 395
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
11 Linear Regression and Curve Fitting . . . . . . . . . . . . . . . . . . . . . 399
11.1 Linear Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
11.1.1 Creating Input Data. . . . . . . . . . . . . . . . . . . . . . . 400
11.1.2 Performing a Linear Regression . . . . . . . . . . . . . . 400
11.2 Curve Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
11.2.1 Preparing a Fit . . . . . . . . . . . . . . . . . . . . . . . . . . 404
11.2.2 Creating a Fit Function . . . . . . . . . . . . . . . . . . . . 406
11.2.3 Displaying Fit Functions . . . . . . . . . . . . . . . . . . . 410
11.2.4 Making a Fit . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
11.3 Real-Life Example. Signal Plus Background . . . . . . . . . . . . 413
11.3.1 Preparing a Data Sample . . . . . . . . . . . . . . . . . . . 413
11.3.2 Performing Curve Fitting . . . . . . . . . . . . . . . . . . . 413
11.3.3 Fitting Multiple Peaks . . . . . . . . . . . . . . . . . . . . . 415
11.3.4 Fitting Histograms in 3D . . . . . . . . . . . . . . . . . . . 417
11.4 Interactive Fit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
11.4.1 HFit Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
11.4.2 JAS Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
11.5 Polynomial Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
11.6 Advanced Data Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
11.7 Fitting Using Parametric Equations . . . . . . . . . . . . . . . . . . . 425
11.8 Symbolic Regression. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
12 Data Analysis and Data Mining . . . . . . . . . . . . . . . . . . . . . . . . . 431
12.1 First Steps in Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . 432
Contents xxi

12.2 Real Life Example. Analyzing a Gene Catalog . . . ..... . . . 434


12.2.1 Data Transformation . . . . . . . . . . . . . . ..... . . . 435
12.2.2 Data Skimming. . . . . . . . . . . . . . . . . . ..... . . . 435
12.2.3 Data Slimming . . . . . . . . . . . . . . . . . . ..... . . . 436
12.2.4 Data Sorting. . . . . . . . . . . . . . . . . . . . ..... . . . 436
12.2.5 Removing Duplicate Records . . . . . . . . ..... . . . 438
12.2.6 Sorting and Duplicate Removal in Java . ..... . . . 439
12.3 Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... . . . 440
12.3.1 Using Built-In Metadata File . . . . . . . . ..... . . . 441
12.3.2 External Metadata Files . . . . . . . . . . . . ..... . . . 444
12.4 Multithreaded Programming . . . . . . . . . . . . . . . . ..... . . . 445
12.4.1 Reading Data in Parallel . . . . . . . . . . . ..... . . . 446
12.4.2 Reading a Single File in Parallel . . . . . . ..... . . . 448
12.4.3 Numerical Computations Using Multiple Cores. . . . 451
12.5 Data Consistency and Security . . . . . . . . . . . . . . ..... . . . 452
12.5.1 MD5 Fingerprint at Runtime . . . . . . . . ..... . . . 453
12.5.2 Fingerprinting Files . . . . . . . . . . . . . . . ..... . . . 454
12.6 Real-Life Examples . . . . . . . . . . . . . . . . . . . . . ..... . . . 455
12.6.1 Single-Particle Densities . . . . . . . . . . . ..... . . . 455
12.6.2 Fluctuations and Correlations . . . . . . . . ..... . . . 458
12.6.3 Analyzing Nearby Galaxies . . . . . . . . . ..... . . . 468
12.6.4 Analyzing Elementary Particles. . . . . . . ..... . . . 470
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... . . . 473
13 Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
13.2 A Basic Neural Network . . . . . . . . . . . . . . . . . . . . . . . . . . 476
13.2.1 Encog Approach . . . . . . . . . . . . . . . . . . . . . . . . . 477
13.2.2 Using Neuroth . . . . . . . . . . . . . . . . . . . . . . . . . . 479
13.3 Backpropagation with Multiple Outputs. . . . . . . . . . . . . . . . 480
13.4 Numeric Predictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
13.4.1 Generating a Data Sample . . . . . . . . . . . . . . . . . . 483
13.4.2 Data Preparation . . . . . . . . . . . . . . . . . . . . . . . . . 484
13.4.3 Building a Neural Net . . . . . . . . . . . . . . . . . . . . . 486
13.4.4 Training and Verifying . . . . . . . . . . . . . . . . . . . . 488
13.5 Bayesian Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
13.5.1 Creating Bayesian Network Using Scripts . . . . . . . 491
13.5.2 HBayes Method . . . . . . . . . . . . . . . . . . . . . . . . . 494
13.6 Kohonen Self-organizing Map . . . . . . . . . . . . . . . . . . . . . . 494
13.6.1 Kohonen SOFM in 2D . . . . . . . . . . . . . . . . . . . . 495
13.6.2 Kohonen SOFM in 3D . . . . . . . . . . . . . . . . . . . . 497
xxii Contents

13.7 Bayesian Self-organizing Map . . . . . . . . . . . . . . . . . . . . . . 498


13.7.1 Noninteractive BSOM . . . . . . . . . . . . . . . . . . . . . 500
13.8 Neural Network Using Python Libraries . . . . . . . . . . . . . . . 502
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
14 Finding Regularities and Data Classification . . . . . . . . . . . . . . . . 505
14.1 Cluster Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
14.1.1 Preparing a Data Sample . . . . . . . . . . . . . . . . . . . 507
14.1.2 Clustering Analysis . . . . . . . . . . . . . . . . . . . . . . . 509
14.1.3 Interactive Clustering Analysis . . . . . . . . . . . . . . . 512
14.2 Clustering Particles into Jets. Real-Life Example . . . . . . . . . 513
14.3 Smoothing and Interpolation . . . . . . . . . . . . . . . . . . . . . . . 515
14.4 Peak Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
14.5 Principal Component Analysis . . . . . . . . . . . . . . . . . . . . . . 522
14.6 Decision Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
15 Miscellaneous Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
15.1 Working with Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
15.1.1 Downloading Files from the Web . . . . . . . . . . . . . 527
15.1.2 Extracting Data from Figures . . . . . . . . . . . . . . . . 528
15.1.3 Tables and Spreadsheets . . . . . . . . . . . . . . . . . . . 529
15.2 Measurements with Units . . . . . . . . . . . . . . . . . . . . . . . . . 531
15.3 Cellular Automaton. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
15.4 Image Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
15.4.1 Image Modification . . . . . . . . . . . . . . . . . . . . . . . 537
15.4.2 Transforms Using Multiple Cores . . . . . . . . . . . . . 538
15.5 Market and Financial Analysis . . . . . . . . . . . . . . . . . . . . . . 539
15.5.1 Time Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
15.5.2 Financial Charts . . . . . . . . . . . . . . . . . . . . . . . . . 544
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
16 Using Other Languages on the Java Platform . . . . . . . . . . . . . . . 547
16.1 Python Scripting with DMelt . . . . . . . . . . . . . . . . . . . . . . . 547
16.1.1 Operations with Data Holders. . . . . . . . . . . . . . . . 550
16.1.2 Adding Python Modules . . . . . . . . . . . . . . . . . . . 551
16.2 Using Java Programming. . . . . . . . . . . . . . . . . . . . . . . . . . 551
16.2.1 External Java Libraries . . . . . . . . . . . . . . . . . . . . 554
16.2.2 Working Java Projects . . . . . . . . . . . . . . . . . . . . . 554
16.2.3 Embedding DMelt in Applets . . . . . . . . . . . . . . . . 555
16.3 Using BeanShell Language . . . . . . . . . . . . . . . . . . . . . . . . 558
16.4 Using Groovy Language . . . . . . . . . . . . . . . . . . . . . . . . . . 560
16.5 Using Ruby Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
16.6 Using Octave Language . . . . . . . . . . . . . . . . . . . . . . . . . . 564
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Contents xxiii

17 Octave-Style Scripting Using Java. . . . . . . . . . . . . . . . . . . . . . . . 567


17.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
17.2 Variables and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . 569
17.2.1 Symbolic Variables . . . . . . . . . . . . . . . . . . . . . . . 572
17.2.2 Operators and Commands . . . . . . . . . . . . . . . . . . 573
17.3 Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
17.4 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
17.5 Vectors and Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
17.5.1 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
17.5.2 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
17.6 Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
17.6.1 Benchmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
17.6.2 File Input and Output . . . . . . . . . . . . . . . . . . . . . 590
17.7 Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
17.7.1 Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . 590
17.7.2 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
17.7.3 Indefinite Integral . . . . . . . . . . . . . . . . . . . . . . . . 592
17.7.4 Transformations . . . . . . . . . . . . . . . . . . . . . . . . . 593
17.7.5 Simplifying Expressions . . . . . . . . . . . . . . . . . . . 594
17.8 Data Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
17.8.1 Plotting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
17.8.2 Plot2D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
17.8.3 Plot3D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
17.9 Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
17.9.1 Systems of Linear Equations . . . . . . . . . . . . . . . . 604
17.9.2 Nonlinear Equations . . . . . . . . . . . . . . . . . . . . . . 605
17.9.3 Systems of Equations . . . . . . . . . . . . . . . . . . . . . 606
17.9.4 Differential Equations . . . . . . . . . . . . . . . . . . . . . 607
17.10 Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
17.10.1 Descriptive Statistics . . . . . . . . . . . . . . . . . . . . . . 608
17.10.2 Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . 610
17.10.3 Data Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
17.10.4 Histograms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
17.11 Again About Integration with Java . . . . . . . . . . . . . . . . . . . 611
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
Conventions and Acronyms

This book uses the following typographical convention: A box with a code inside
usually means interactive Python/Jython commands typed in the “Jython Shell.” All
such commands start with the symbol [[[ which is the usual invitation in
Python to type a command. This is shown in the example below:

Working interactively with the Jython prompt has the drawback that it is
impossible to save typed commands. In most cases, the code snippets are not so
short, although they are still much shorter than in any other programming language.
Therefore, it is desirable to save the typed code in a file for further modification and
execution. In this case, we use Jython macro files, i.e., we write a code using the
DMelt (or any other) editor [15], save it in a file with the extension “.py”, and run it
using the keyboard shortcut [F8] or the button “run” from the DMelt tool bar
menu. Such code examples are also shown inside the box, but code lines do not
start with the Python invitation symbol [[[ . In such situations, the example
codes will be shown as:

For examples written in the Python language, double quotes and apostrophe are
interchangeable. For Java and other languages, this is not the case. So, to make our
code to be easily convertible to Java or Groovy, we will use double quotes around
strings. As in the above example, we will try to comment code lines as much as we
can. For Python, comments are preceded by the hash character.
If a code snippet is used as a Python/Jython module by other programs, then we
should write our code inside a file. A Python code always imports an external
module using its file name. Since the file names are important, we will indicate
exactly which file name should be used under the box with a code. For example, if a
program code is considered a module that has to be imported by another code
example, we will show it as:

xxv
xxvi Conventions and Acronyms

Listing 1 File “hello.py”

with the description indicating the file name. For instance,

imports the file “hello.py” and executes it, printing the string. In other cases, we
will use arbitrary file names for the code snippets.
We use typewriter font for Jython and Java classes and methods. For file
names and directories, we also use the same font style with additional parentheses.
We remind that the directory name separators are backward slashes for
Windows, and slashes for Linux and Mac computers. For example, the directory
with examples will be shown as:
macro/examples/
For Windows computers, the same directory should be shown as:
macro\examples\
The dots in this example are used to indicate the upper-level directory.
We will try to avoid using abbreviations. When we use abbreviations, we will
explain their meaning directly in the text. When space allows, we will use mean-
ingful names for variables. This is all.
Chapter 1
Java Computational Platform

1.1 Introduction

Java is both a programming language and a computing platform which runs Java
code. This book uses both. But the Java programming language is not necessary
for the approach adopted in this book, since the Java platform allows the usage of
scripting languages, such as Jython/Python, Groovy, Ruby/JRuby, BeanShell, and
others.
The heart of the Java platform is the Java Virtual Machine (JVM) that runs
programs converted to Java bytecode programs. The conversion to bytecode is done
by Java compiler. Bytecode is the optimized and effective machine language of
JVM. The JVM reads this bytecode, interprets it, and executes the program.
In fact, even if you write your code using other programming languages, such as
Python and Groovy, which are simpler than the Java language, your code still will
be converted to Java bytecode programs.
The JVM is ported to different platforms and insulates the program from the
underlying hardware and operating system. Thus it provides hardware- and
operating-system independence. The Java application programming interface (API)
is also a part of the Java platform. Java API classes are used for building software
applications.

1.1.1 Programming in Java

First, let us discuss the Java programming language, one of the most popular
object-oriented programming languages in use. The statistics of SourceForge reports
that the number of open-source applications written in Java is close to those
written in C++. According to the TIOBE software index (http://www.tiobe.com/), a


c Springer International Publishing Switzerland 2016 1
S.V. Chekanov, Numeric Computation and Statistical Data Analysis
on the Java Platform, Advanced Information and Knowledge Processing,
DOI 10.1007/978-3-319-28531-3_1
2 1 Java Computational Platform

programming-language popularity website, Java is among the most popular object-


oriented languages at the time when this book is written.
Let us briefly discuss the main features of Java that make this language number
one in the industry:
• Java is multi-platform with the philosophy of “write once, run anywhere”;
• Well structured, clean, efficient, simpler (no pointers);
• Stable, robust, and well supported: Java programs written (or compiled) many
years from now can be compiled (or executed) without modifications even today.
This is true even for Java source code with graphic widgets. In contrast, C/C++
programs usually require continuous time-consuming maintenance in order to
follow up the development of C++ compilers and graphic desktop environment;
• Java has the reflection technology, which is not present in C++. The reflec-
tion allows an application to discover information about created objects, thus a
program can design itself at runtime. In particular, this is considered to be an
essential feature for building integrated development environments (IDEs);
• Java has several “intelligent” IDEs, which are indispensable tools for large soft-
ware projects. Some of them, such as Eclipse or Netbeans, are free. We probably
should note that one can also use free IDEs for C/C++, but they are not as intelli-
gent as those for Java and usually miss many important features;
• Automatic garbage collection: Having in hand this feature, a programmer does
not need to perform a low-level memory management;
• Extensive compile-time and runtime checking;
• Java always passes references to objects instead of objects themselves, therefore,
independent of how you program in Java, your code will be rather efficient;
• Java is truly multithreaded. This significantly simplifies the development of appli-
cations that should run in parallel on multi-core machines;
• Advanced serialization: Almost any Java object can be written/retrieved to/from
a file;
• Programs written in Java can be embedded to the Web. This is important for dis-
tributed analysis environment (Java WebStart, plugins, applets), especially when
data-analysis tools are not localized in one single place but scattered over the Web
(nowadays, this is the most common situation).
Sometimes, one can hear that Java is slower than C++. The subject itself is con-
troversial, since the answer totally depends on the nature and the goal of an applica-
tion. Nowadays, most people agree that after introduction of Just-in-Time compiler
(JIT), Java is as fast as C++. Probably, in some areas, Java is still slower than C++,
but the nature of such controversy is already a sign that the performance gap is now
quite small and there is no alarming difference in speed between Java and C++ pro-
grams. And anyway, the proper comparisons with C++ is usually unfair: Java does
a tremendous amount of runtime checks, such as array bound checking, thread syn-
chronization, runtime checking, garbage collection, etc., to make sure that a Java
code runs without problems, and without putting extra stress on a programmer.
Execution of a code on the JVM has a feel of “slowness” since it takes a few mil-
liseconds for the JVM to startup. But when JVM runs a bytecode code, the execution
Random documents with unrelated
content Scribd suggests to you:
"We followed Mexicali; we saw him come up here; Deveril followed
him into camp. He told where his gold was. And you heard it all!"
"Well?" said Lynette, striving with herself for calmness. She was
thinking: "If only I can have a little time. He will come for me.... If
only I can have a little time."
"What do you mean by that?" demanded Taggart. "The whole earth
ain't Joe's because he picked up a nugget or two. Anybody's got a
right to stake a claim; I got a right and so has the boys ... and so
have you."
"Suppose," offered Lynette as coolly as she could, "that I refused to
tell?"
There came a look into Taggart's hard eyes which answered her
more eloquently than any words from the man could have done,
which put certain knowledge and icy fear into her.
Always, when nervous or frightened, Lynette's laughter came easily
to her and now without awaiting any other answer from this man
she began laughing in such a fashion as to perplex him and bring a
dragging frown across his brows.
"Are you going to tell us?" he asked.
"If I do," she temporized, "do I have the chance to drive the first
stakes?"
"By God, yes! And say, little one, you're a peach into the bargain."
She did not appear to hear; she was thinking over and over: "Bruce
Standing will come after us as soon as he finds I am gone. I must
gain a little time, that is all."
If only she could make them think that the gold was somewhere
near by so that Standing must readily find them. But now Deveril
had rejoined them and she recalled how he had heard something,
though not all, of Joe's triumphant announcement. For Joe had
shouted out at the top of his voice, to catch and hold Timber-Wolf's
attention: "Light Ladies' Gulch!" Deveril had heard that; and Light
Ladies' Gulch was many miles away, down toward Big Pine....
Deveril was looking at her with eyes which were bright and hard and
told no tales of the man's thoughts.
"This lovely and altogether too charming young woman," Deveril
said lightly, his eyes still upon her, though his words were for the
others, "has a mind of her own. It would be as well to hear what she
has to say and learn what she intends to do."
"Will you try to lie to us?" demanded Taggart. "Or will you tell us the
truth?"
She, too, strove for lightness, saying:
"Think that out for yourself, Mr. Taggart. Bruce Standing knows
where the gold is now; both you and I know the sort of man he is
and we can imagine that if he drives the first stake he will see to it
that he takes the whole thing. Do you really think that after I came
into this country for gold myself I am going to miss my one chance
now?" She puzzled them again with her laughter and said: "Not that
it would not be a simple matter to trick you, were I minded to let my
own chances go for the sake of spoiling yours; Mexicali Joe fooled
you so easily."
"Yet you yelled for Standing just now...."
"After you came rushing upon me as if you meant to tear me to
pieces, frightening the wits out of me."
"Well, then, tell us."
"If I told you now, then what? You'd desert me in a minute; you
would race on ahead; when I caught up with you there would be
nothing left."
Deveril's eyes flashed and he said quickly:
"And give you the chance to send us to the wrong place, were you
so minded, so that you could slip off alone and be first at the other
spot! Very clever, Miss Lynette, but that won't work. You go with us."
And all the while she was trying so hard to think; and all the while
listening so eagerly for a certain glorious, golden voice shouting
after her. Deveril had heard part of Joe's exclamation....
"It is in Light Ladies' Gulch," she said quietly.
"Yes!" Here was Young Gallup speaking, his covetous soul aflame.
"We know that; Deveril heard. But Light Ladies' Gulch is forty miles
long. Where abouts in the gulch?"
She told herself that she would die before she led them aright. And
yet she realized to the full the danger to herself if she tricked them
as Joe had done and they discovered her trickery before Standing
came. Yet most of all was she confident that he would come and
swiftly.... Joe's words still rang in her memory; he had told first of
the Red Cliffs, how he had found color there last year; how he had
made prospect holes; how his real mine lay removed three or four
miles. Still she temporized, saying:
"Bruce Standing and Billy Winch and Joe have horses. We are on
foot. Tell me how we can hope to come to the spot first?"
"We'll have horses ourselves in a jiffy," said Taggart. "Stepping lively,
we're not more than a couple of hours from a cattle outfit over the
ridge. We'll get all the horses we want and we'll ride like hell!"
"You know where the Red Cliffs are? At the foot of the cliffs I'll show
you Joe's prospect holes...."
The pale-eyed, hawk-faced Cliff Shipton spoke for the first time.
"Not half a dozen miles out of Big Pine! I told you last year,
Gallup...."
Deveril, the keenest of them all, the one who knew her best,
suspected her from the beginning. His eyes never once left her face.
"How do we know," he said quietly, "that there's any gold there?
That Joe's gold is not somewhere else?"
"You will have to make your own decision," she told him as coolly as
she could. "If you think that I am mistaken or that I am trying to
play with you as Joe did, you are free to go where you please."
Taggart began cursing; his grip tightened on her arm so that he hurt
her terribly as he shouted at her:
"I'll give you one word of warning, little one! If you put up a game
on us now, you cut your own throat. In the first place I'll make it my
business that if we get shut out, you get shut out along with us. And
in the second place when I'm through with you no other man in the
world will have any use for you. Got that?"
She knew what he had done to Mexicali Joe; she could guess what
other unthinkable things he would have done. And she knew that if
now she tricked Jim Taggart and he found her out ... before Bruce
Standing came ... she could only pray to die.
And yet at this, the supreme test in her life, she held steady to a
swiftly taken purpose. She would not put the game into these men's
hands. And she held steadfastly to her certainty, knowing the man,
that Bruce Standing would come. Therefore, though her face went a
little pale, and her mouth was so dry that she did not dare speak,
she shrugged her shoulders.
"Come, then," said Taggart. "Enough palaver. We're on our way."
And of them all, only Babe Deveril was still distrustful.

And thus Lynette, accepting her own grave risk with clear-eyed
comprehension and yet with unswerving determination, led these
four men to a spot where she knew that they would not find that
gold for which every man of them had striven so doggedly; thus it
was she who made it possible for Bruce Standing to be before all
others and to triumph and strike the death-blow to Big Pine and to
begin that relentless campaign which was to end in humbling his
ancient enemy, Young Gallup. Yet there was little exultation in
Lynette's heart, but a growing fear, when, after hours of furious
haste, she and the four men came at last into Light Ladies' Gulch
and to the base of the towering red cliffs.
Cliff Shipton knew more of gold-mining than any of the others and
Lynette watched him narrowly as he went up and down under the
high cliffs. And she knew that she in turn was watched; in the first
excitement of coming to the long-sought spot she had hoped that
she might escape. But both Taggart and Deveril followed her at
every step with their eyes.
Desperately she clung to her assurance that Bruce Standing would
come for her. He had said that he would come "though it were ten
thousand mile." He might have difficulties in finding her; she might
have to wait a little while, an hour or two, or three hours. But it
remained that he was a man to surmount obstacles insurmountable
to other men; a man to pin faith upon. Yet time passed and he did
not come.
They found indications of Mexicali Joe's labors, rock ledges at which
he had chipped and hammered, prospect holes lower on the steep
slope. And Cliff Shipton acknowledged that "the signs were all right."
But they did not find the gold and they did not find anything to show
that Joe or another had worked here recently.
"All this work," said Shipton, staring and frowning, "was done a year
ago."
"He'd be crafty enough," muttered Gallup, "to hide his real signs. We
got to look around every clump of brush and in every gully where
maybe he's covered things up.... You're sure," and he whipped about
upon Lynette, "that you got straight all he said?"
"I'm sure," said Lynette. And she was afraid that the men would
hear the beating of her heart.
"I am going up to the top of the cliffs again and see what I can see,"
she said.
"If there's gold anywhere it's down here," said Shipton. "There's
nothing on the top."
"Just the same I'm going!"
"Where the horses are?" jeered Taggart. "By God, if you have...."
"If you think I am trying to run away you can follow and watch me. I
am going!"
She turned. Deveril was watching her with keen, shrewd eyes.
Taggart took a quick stride toward her, his hand lifted to drag her
back. Deveril stepped before him, saying coolly:
"I'll go up with her, Taggart. And I guess you know how I stand on
this, don't you?"
"All right," conceded the sheriff. "Only keep your eye peeled. I'm
getting leery."
It was a long climb to the cliff tops and neither Lynette nor Deveril at
her heels spoke during the climb. They were silent when at last they
stood side by side near the tethered horses. Deveril's eyes were
upon her pale face; her own eyes ran swiftly, eagerly across the
deep cañon to the wooded lands beyond. She prayed with the fervor
of growing despair for the sight of a certain young blond giant of a
man racing headlong to her relief.
"Well?" said Deveril presently in a tone so strange, so vibrant with
suppressed emotion that he made her start and drew her wondering
eyes swiftly. "What are you looking for now?"
"Why do you talk like that ... what is the matter?"
His bitter laughter set her nerves quivering.
"Is the gold here, Lynette? Or is it some miles away, with Bruce
Standing already sinking his claws into it, Standing style?"
Again her eyes left him, returning across the gorge to the farther
wooded lands. Over there was a road, the road into which she and
Babe Deveril had turned briefly that night, a thousand years ago,
when they had fled from Big Pine in the dark; a road which led to
Bruce Standing's headquarters. From the top of the cliffs she caught
a glimpse of the road, winding among the trees; her eyes were
fixedly upon it; her lips were moving softly, though the words were
not for Babe Deveril's ears.
"Lynette," he said in that strangely tense and quiet voice, "if you
have been fool enough to try to put something over on this crowd....
Can't you guess how you'd fare in Jim Taggart's hands?"
She was not looking at him; she did not appear to mark his words.
He saw a sudden change in her expression; she started and the
blood rushed back into her cheeks and her eyes brightened. He
looked where she was looking. Far across the cañon, rising up
among the trees, was a cloud of dust. Some one was riding there,
riding furiously....
Together they watched, waiting for that some one to appear in the
one spot where the winding road could be glimpsed through the
trees. And in a moment they saw not one man only, but a dozen or a
score of men, men stooping in their saddles and riding hard, veiled
in the rising dust puffing up under their horses' flying feet. Now and
then came a pale glint of the sun striking upon the rifles which, to
the last man, they carried. They came into view with a rush, were
gone with a rush. The great cloud of dust rose and thinned and
disappeared.
"That road will bring them down into Light Ladies' Gulch where it
makes the wide loop about three miles from here," said Deveril.
"Have you an idea who they are, Lynette?"
"No," she said, her lips dry; "I don't understand."
"I think that I do understand," he told her, with a flash of anger.
"Those are Standing's men and they are riding, armed, like the mill-
tails of hell. Listen to me while you've got the chance! That's not the
first bunch of men who have ridden over there like that to-day. Two
hours ago, when you went down the cliffs with the others and I
stopped up here, I saw the same sort of thing happening. If you're
so innocent," he sneered at her, "I'll read you the riddle. I've told
you those are Standing's men; then why the devil are they riding like
that and in such numbers? They're going straight down into the
Gulch where the gold is while you hold us back, up here. And
Standing is paying off an old grudge and jamming more gold into his
bulging pockets.... And you've got some men to reckon with in ten
minutes who'll make you sorry that you were ever born a girl!"
"No!" she cried hoarsely. "No. I won't believe it...."

He failed to catch just what she was thinking. She refused to believe
that Bruce Standing, instead of coming to her had raced instead to
Mexicali Joe's gold; that instead of scattering his men across fifty
miles of country seeking her, he was massing them at a new gold-
mine. Bruce Standing was not like that! She cried it passionately
within her spirit. She had stood loyally by him; she had, at all costs,
kept her word to him ... she had come to believe in his love for her
and to long for his return....
"If you saw men before ... if you thought the thing that you think
now ... why didn't you rush on after them? It's not true!"
"I didn't rush after them," he returned curtly, "because I'd be a fool
for my pains and would only give that wolf-devil another chance to
laugh in my face. For if he's got this lead on us ... why, then, the
game is his."
"But I won't believe...."
"If you will watch you will see. I'll bet a thousand dollars he has a
hundred men down there already and that they'll be riding by all
day; they'll be staking claims which he will buy back from them at
the price of a day's work; he'll work a clean shut-out for Gallup and
Taggart. That's what he'd give his right hand to do. You watch a
minute."
They watched. Once Taggart shouted up to them.
"Down in a minute, Taggart." Deveril called back.
Before long Lynette saw another cloud of dust; this time three or
four men rode into sight and sped away after the others; before the
dust had cleared another two or three men rode by. And at last
Lynette felt despair in her heart, rising into her throat, choking her.
For she understood that in her hour of direst need Bruce Standing
had failed her.
"Taggart will be wanting you in a minute," said Deveril. He spoke
casually; he appeared calm and untroubled; he took out tobacco and
papers and began rolling a cigarette. But Lynette saw that the man
was atremble with rage. "Before you go down to him, tell me: did
you know what you were doing when you brought us to the wrong
place?"
"Yes!" It was scarcely above a whisper, yet she strove with all her
might to make it defiant. She was afraid and yet she fought with
herself, seeking to hide her fear from him.
He shrugged elaborately, as though the matter were of no great
interest and no longer concerned him.
"Then your blood be on your own head," he said carelessly. "I, for
one, will not raise my hand against you; what Taggart does to you
concerns only you and Taggart."
"Babe Deveril!"
She called to him with a new voice; she was afraid and no longer
strove to hide her fear. Until now she had carried on, head high, in
full confidence; confidence in a man. And that man, like Babe Deveril
before him, had thought first of gold instead of her. Bruce Standing
had spoken of love and had turned aside for gold; with both hands
full of the yellow stuff he thought only of more to be had, and not of
her.
"Babe Deveril! Listen to me! I have been a fool ... oh, such a fool! I
knew so little of the real world and of men, and I thought that I
knew it all. My mother had me raised in a convent, thinking thus to
protect me against all the hardships she had endured; but she did
not take into consideration that her blood and Dick Brooke's blood
was my blood! This was all a glorious adventure to me; I thought ...
I thought I could do anything; I was not afraid of men, not of you
nor of Bruce Standing nor of any man. Now I am afraid ... of Jim
Taggart! You helped me to run from him once; help me again. Now.
Let me have one of the horses ... let me go...."
All the while he stood looking at her curiously. Toward the end there
was a look in his eyes which hinted at a sudden spiritual
conflagration within.
"You're not used to this sort of thing?" And when she shook her
head vehemently, he added sternly: "And you are not Bruce
Standing's? And have never been?"
"No, no!" she cried wildly, drawing back from him. "You don't think
that...."
Now he came to her and caught her two hands fiercely.
"Lynette!" he said eagerly. "Lynette, I love you! To-day you have
stood between me and a fortune, and I tell you ... I love you! Since
first you came to the door of my cabin I have loved you, you girl
with the daring eyes!"
"Don't!" she pleaded. "Let me go. Can't you see...."
"Tell me, Lynette," he said sternly, still holding her hands tight in his,
"is there any chance for me? I had never thought to marry; but now
I'd rather have you mine than have all the gold that ever came out
of the earth. Tell me and tell me the truth; we know each other
rather well for so few days, Lynette. So tell me; tell me, Lynette."
Again she shook her head.
"Let me go," she pleaded. "Let me have a horse and go. Before they
come up for me...."
"Then there's no chance, ever, for me?"
"Neither for you nor for any other man.... I have had enough of all
men.... Let me go, Babe Deveril!"
Still he held her, his hands hardening on her, as he demanded:
"And what of Bruce Standing?"
"I don't know ... I can't understand men ... I thought there never
was another man like him, a hard man who could be tender, a man
who ... I don't know; I want to go."
"Go?" There came a sudden gleam into his eyes. "And where? Back
to Bruce Standing maybe?"
"No! Anywhere on earth but back to him. To the stage which will be
leaving Big Pine in a little while; back to a land where trains run,
trains which can take me a thousand miles away. Oh, Babe
Deveril...."
Taggart's voice rose up to them, sounding savage.
"What in hell's name are you doing up there?"
Then Deveril released her hands.
"Go to the horses," he commanded. "Untie all four. I'll ride with you
to the stage ... and we'll take the other horses along!"
She had scarcely hoped for this; for an instant she stood staring at
him, half afraid that he was jeering at her. Then she ran to the
horses and began wildly untying their ropes. Deveril, smoking his
cigarette, appeared on the edge of the cliff for Taggart to see, and
called down carelessly:
"What's all the excitement, Taggart?"
"Keep your eye on that girl. Shipton thinks she's fooled us. I want
her down here."
Deveril laughed at him and turned away. Once out of Taggart's sight
he ran. Lynette already was in the saddle; he mounted and took
from her the tie ropes of the other horses.
"On our way," he said crisply. "They'll be after us like bees out of a
jostled hive."

They did not ride into Big Pine, but into the road two or three miles
below where the stage would pass. Deveril hailed the stage when it
came and the driver took Lynette on as his solitary passenger. At the
last minute she caught Babe Deveril's hand in both of hers.
"There is good and bad in you, Babe Deveril, as I suppose there is in
all of us. But you have been good to me! I will never forget how you
have stood my friend twice; I will always remember that you were a
man; a man who never did little, mean things. And I shall always
thank God for that memory. And now, good-by, Babe Deveril and
good luck go with you!"
"And Standing?" he demanded at the end. "You are done with him,
too?"
Suddenly she looked wearier than he had ever seen her even during
their days and nights together in the mountains. She looked a poor
little broken-hearted girl; there was a quick gathering of tears in her
eyes, which she strove to smile away. But despite the smile, the
tears ran down. She waved her hand; the stage driver cracked his
long whip.... Deveril stood in the dusty road, his hat in his hand,
staring down a winding roadway. A clatter of hoofs, a rattle of
wheels, a mist of dust ... and Lynette was gone.
CHAPTER XXVI
Deveril went back to his horse, mounting listlessly like a very tired
man. The spring had gone out of his step and something of the
elasticity out of that ever-young spirit which had always been his no
matter from what quarter blew the variable winds of chance. Lynette
was gone and he could not hold back his thoughts from winging
back along the trail he and she had trod together; there had been
the time, and now he knew it, when all things were possible; the
time before Bruce Standing came into her life, when Babe Deveril,
had he then understood both himself and her, might have won a
thing more golden than any man's mere gold. In his blindness he
had judged her the light adventuress which she seemed; now that it
was given him to understand that in Lynette Brooke he had found a
pure-hearted girl whose inherited adventuresome blood had led her
into tangled paths, he understood that in her there had come that
one girl who comes once to all men ... and that she had passed on
and out of his life.
He caught up the reins of the horse she had left behind. His face
grew grim; he still had Jim Taggart to deal with and, therefore, it
was as well to take this horse and the others back to Big Pine and
leave them there for Taggart. For the first thing which would suggest
itself to the enraged sheriff would be to press a charge against him
of horse stealing, and in this country horse thieves were treated with
no gentle consideration.
"I'll leave the horses there ... and go."
Where? It did not matter. There was nothing left for him in these
mountains; Bruce Standing had the gold and the girl was on the
stage.
But in his bleak broodings there remained one gleam of gloating
satisfaction: he had tricked Standing out of the girl! That Lynette
already loved his kinsman or at the least stood upon the very brink
of giving her heart unreservedly into his keeping, Deveril's keen
eyes, the eyes of jealous love, had been quick to read. It did not
once suggest itself to him that Standing could by any possibility have
failed to love Lynette. The two had been for days together, alone in
the mountains; why should Standing have kept her and have been
gentle with her, as he must have been, save for the one reason that
he loved her? Further, what man could have lived so long with
Lynette of the daring eyes and not love her? And he, Babe Deveril,
had stolen her away from Bruce Standing, had tricked him with a
pencil scrawl, had lost Lynette to him for all time. The stage carrying
her away now was as inevitable an instrument in the hand of fate as
death itself.
He turned back for the other horses which he had tethered by the
roadside and led them on toward Big Pine.
"What the devil is love, anyway?" he muttered once.
It was not for a man such as Babe Deveril to know clearly; for love is
winged with unselfishness and self-sacrifice. And yet, after his own
fashion, he loved her and would love her always, though other pretty
faces came and went and he laughed into other eyes. She was lost
to him; there was the one great certainty like a rock wall across his
path. And she had said at the parting ... her last words to him were
to ring in his memory for many a long day ... that there was both
good and bad in him; and she chose to remember the good! He
tried to laugh at that; what did he care for good and bad? He, a man
who went his way and made reckoning to none?
And she had said that she knew him for a man; one who, whatever
else he might have done, had never stooped to a mean,
contemptible act; she thought of him and would always think of him
as a man who, though he struck unrighteous blows, dealt them in
the open, man-style.... And yet ... the one deed of a significance so
profound that it had directed the currents of three lives, that writing
of seven words, that signing of her name under them....
"I am glad that I did that!" he triumphed. And gladdest of all, in his
heart, was he that Lynette did not know ... would never know.
Thus Babe Deveril, riding with drooping head, found certain living
fires among the ashes of dead hopes: A row to come with Taggart?
He could look forward to it with fierce eagerness. Standing and
Lynette separated; vindictive satisfaction there. He'd got his knife in
Standing's heart at last! He'd like to wait a year or a dozen until
some time Lynette forgot and another man came despite her
sweeping avowal and she married; he would like then to come back
to Bruce Standing and tell him the fool he had been and how it had
been none other than Baby Devil who had knifed him.
... And yet, all the while, Lynette's farewell words were in his mind.
And he saw before him, wherever he looked, her face as he had
seen it last, her eyes blurred with her tears. And he fought
stubbornly with himself against the insistent admission: It was Babe
Deveril and none other who, saying that he loved her, had put those
tears there. Good and bad? What the devil had he to do with
sticking those labelling tags upon what he or others did?

Bruce Standing was still in his office. He was a man who had won
another victory and yet one who had the taste of despair in his
mouth. Gallup's town was doomed; it was one of those little
mountain towns which had already outlived its period of usefulness
and now with a man like Timber-Wolf waging merciless war against
it, Big Pine had its back broken almost at the first savage blow
struck. But Standing strode up and down restlessly like a man
broken by defeat rather than one whose standards went flying on
triumphantly; he knew that a new rival town, his own town, was
springing into being in a few hours; he had the brief satisfaction of
knowing that he was keeping an ancient promise and striking a body
blow from which there would be no recovery, making Big Pine take
the count and drop out of all men's consideration; he knew, from
having seen it many times, that pitiful spectacle which a dead and
deserted town presents; so, briefly, just as his kinsman was doing at
the same moment, he extracted what satisfaction he could from the
hour. He even had word sent to Gallup: "I am killing your town very
much as a man may kill an ugly snake. I shall see to it that goods
are sold cheaper here than at your store; there will be a better hotel
here, with a better shorter road leading to it. And I will build cabins
as fast as they are called for, to house deserters from your dying
town. And I will see to it that men from my town never set foot in
your town. This from me, Young Gallup: 'For the last time I have set
foot upon your dung heap. I'm through with you and the world is
through with you. You're dead and buried.'"
During the day, word came to him that several men and one girl had
been seen hastily occupied at the foot of the Red Cliffs; the girl
Lynette; one of the men, Deveril. And it seemed very clear to
Standing that Lynette had led Deveril and the others in hot haste to
the Red Cliffs only because she had misunderstood Mexicali Joe's
directions, confused by his mention of these cliffs where he had
prospected last year.
"I'll go get them." Standing told himself a score of times. "Just as
soon as I know how to handle them. When I know how I can hurt
him most and her...."
Mexicali Joe swelled about the landscape all day like a bursting
balloon, a man swept up in a moment from a condition of less than
mediocrity to one, as Mexicali regarded it, of monumental
magnificence and the highest degree of earthly joy. Graham could
not keep him out of Standing's office; the second time he came in
Timber-Wolf lifted him upon his boot hurling him out through the
door and promising him seven kinds of ugly death if he ever came
back. Whereupon Mexicali Joe, shaking his head, went away without
grumbling; for in the sky of his adoration stood just two: God and
Bruce Standing.
Graham was still laughing, when another man rode up to the door,
and Graham on the instant became alert and concerned. He
hastened to Standing, saying quickly:
"Mr. Deveril to see you. He has ridden his horse nearly to death. And
I don't like the look on his face."
"Show him in!" shouted Standing. "You fool ... don't you know he's
the one man in the world...."
Graham hurried out. Deveril, his face pale and hard, his eyes burning
as though the man were fever-ridden, came into the room. The door
closed after him.
"Well?" snapped Standing.
"Not so well, thanks," retorted Deveril with an attempt at his
characteristic inconsequential insolence. "Here's hoping the same to
you ... damn you!"
"If you've got anything to say, get it done with," commanded
Standing angrily.
"I'll say it," Deveril muttered. "But first I'll say this, though I fancy it
goes without saying: there is no man on earth I hate as I hate you.
As far as you and I are concerned I'd rather see you dead than any
other sight I'll ever see. And now, in spite of all that, I've come to do
you a good turn."
Standing scoffed at him, crying out: "I want none of your good
turns; I am satisfied to have your hate."
Deveril, with eyes which puzzled Timber-Wolf, was staring at him
curiously.
"Tell me, Bruce Standing," he demanded, "do you love her?"
"Love her?" cried Standing. "Rather I hate the ground she walks on!
She is your kind, Baby Devil; not mine." And he laughed his scorn of
her. But now there was no chiming of golden bells in that great
volume of laughter but rather a sinister ring like the angry clash of
iron. All the while Babe Deveril looked him straight in the eye ... and
understood!
"For once you lie! You love her and what is more ... and worse!...
she loves you! And that is why...."
"Loves me? Are you drunk, man, or crazy? Loves me and leaves me
for you; leads you and your crowd to the Gulch, trying to stake on
Joe's claim, trying to...."
"She did not leave you for me! I took Taggart and Gallup to her, and
Taggart put her under arrest ... for shooting you! And she did not
lead us to the spot where she knew Joe's claim was; she made fools
of us and led us to the Red Cliffs, miles away!"
Standing's face was suddenly as tense as Deveril's, almost as white.
"She left a note; saying that she was going back to you...."
Deveril strode by him to a table on which lay some letter paper and
wrote slowly and with great care, laboring over each letter:

I am going back to Babe Deveril.


Lynette.

And then he threw the pencil down and stood looking at Standing.
And he saw an expression of bewilderment, and then one of
amazement wiping it out, and then a great light leaping into
Standing's eyes.
"You made her go! You dragged her away! And you wrote that!"
Deveril turned toward the door.
"I have told you that she loves you. So it is for her happiness, much
as I hate you, that I have told you.... She, thinking that you
preferred gold to her, has just gone out on the down stage...."
"By the Lord, man," and now Standing's voice rang out joyously,
clear and golden once more, "you've done a wonderful thing to-day!
I wonder if I could have done what you are doing? By thunder, Babe
Deveril, you should be killed for the thing you did ... but you've
wiped it out. After this ... need there be hatred between us?"
He put out his hand. Deveril drew back and went out through the
door. His horse, wet with sweat and flecked with foam, was waiting
for him. As he set foot into the stirrup he called back in a voice
which rang queerly in Standing's ears:
"She doesn't know I wrote that. Unless it's necessary ... You see, I'd
like her to think as well...." He didn't finish, but rode away. And as
long as he was in sight he sat very erect in the saddle and sent back
for any listening ears a light and lively whistled tune.

The stage, carrying its one passenger came rocking and clattering
about the last bend in the grade where the road crosses that other
road which comes down from the mountains farther to the east,
from the region of Bruce Standing's holdings. The girl's figure
drooped listlessly; her eyes were dry and tired and blank with utter
hopelessness. Long ago the garrulous driver had given over trying to
talk with her. Now she was stooping forward, so that she saw
nothing in all the dreary world but the dusty dashboard before her ...
and in her fancy, moving across this like pictures on a screen, the
images of faces ... Bruce Standing's face when he had chained her;
when he had cried out that he loved her....
The driver slammed on his brakes, muttering; the wheels dragged;
the stage came to an abrupt halt. She looked up, without interest.
And there in the road, so close to the wheel that she could have put
out a hand and touched him, was Bruce Standing.
"Lynette!" he called to her.
She saw that he had a rifle in his hand; that a buckboard with a
restive span of colts was at the side of the road. The driver was
cursing; he understood that Standing, taking no chances, had meant
to stop him in any case.
"What's this?" he demanded. "Hold up?"
Standing ignored him. His arms were out; there was the gladdest
look in his eyes Lynette had ever seen in any man's; when he called
to her he sent a thrill like a shiver through her. He had come for her;
he wanted her....
"No!" she cried, remembering. "No! Drive on!"
"You bet your sweet life I'll drive on!" the driver burst out. And to
Standing: "Stand aside."
Then Standing put his hands out suddenly, dropping his rifle in the
road, and caught Lynette to him, lifting her out of her seat despite
her efforts to cling to the stage, and took up his rifle again, saying
sternly to the stage-driver:
"Now drive on!"
"No!" screamed Lynette, struggling against the one hand restraining
her ... and against herself! "He can't do this ... don't let him...."
But in the end she knew how it would be. The stage-driver was no
man to stand out against Bruce Standing ... she wondered if
anywhere on earth there lived a man to gainsay him when that light
was in his eyes and that tone vibrated in his voice.
"He's got the drop on me ... he'd drop me dead soon as not.... I'll
go, Miss; but I'll send back word...." And Lynette and Bruce
Standing, in the gathering dusk, were alone again in the quiet lands
at the bases of the mountains.
"Girl ... I did not know how I loved you until to-day!"
She whipped away from him, her eyes scornful.
"Love! You talk of love! And you leave me in the hands of those men
while you go looking for gold!"
"No," he said, "it wasn't that. I thought that you had no further use
for me; that you loved Deveril; that you had gone back to him; that
you were trying to lead him and the rest to Joe's gold; that...."
There was now no sign of weariness in a pair of gray eyes which
flashed in hot anger.
"What right had you to think that of me?" she challenged him. "That
I was a liar, breaking a promise I had made; and worse than a liar,
to betray a confidence? What right have you to think a thing like
that, Bruce Standing ... and talk to me of love!"
He could have told her; he could have quoted to her that message
which had been left behind, signed with her name. But, after all, in
the end he had Babe Deveril to think of, a man who had shown
himself a man, who had done his part for love of her, whose one
reward if Bruce Standing himself were a man, must lie in the meagre
consolation that Lynette held him above so petty an act as that one
which he had committed. So for a moment Standing was silent; and
then he could only say earnestly:
"I am sorry, Lynette. I wronged you and I was a fool and worse. But
there were reasons why I thought that.... And after all we have
misunderstood each other; that is all. Joe's gold is still Joe's gold; I
have made it safe for him and not one cent of it is mine or will ever
be mine...."
"Nor do I believe that!" she cried. "Nor any other thing you may ever
tell me!"
"That, at least, I can make you believe." He was very stern-faced
now and began wondering if Deveril had been mad when he had
told him that Lynette loved him. How could Deveril know that? There
was little enough of the light of love in her eyes now. And yet....
"Are you willing to come back to headquarters with me?" he asked
gently. "There, at least, you can learn that I have told you the truth
about Mexicali Joe's gold. No matter how things go, girl, I don't want
you to think of me that I did a trick like that ... forgetting you to go
money-grabbing...."
"You can make me come," she said bitterly. "You have put a chain on
me before now. But you can never make me love you, Bruce
Standing."
Now she saw in his face a look which stirred her to the depths; a
look of profound sadness.
"No," he said, "I'll never put chain on you again, girl; I'll never lift
my hand to make you do anything on earth; I would rather die than
force you to anything. But I shall go on loving you always. And
now," and for the first time she heard him pleading! "is it so great a
thing that I ask? If you will not love me, at least I want you to think
as well of me as you can. That is only justice, girl; and you are very
just. If you will only come with me and learn from Mexicali Joe
himself that I have touched and shall touch no single ounce of his
gold."
She knew that he was speaking truth; and yet she could not admit it
to him ... since she would not admit it to herself! And she wanted to
believe, and yet told herself that she would never believe. She was
glad that he was not dragging her back with him as she had been so
certain that he would ... and she did not know that she was not
sorry.
"Will you do that one thing? I shall not try to hold you...."
"Yes," she said stiffly. And then she laughed nervously, saying in a
hard, suppressed voice: "What choice have I, after all? The stage
has gone and I have to go somewhere and find a stage again or a
horse...."
"No. That is not necessary. If you will not come with me freely, I will
take you now where you wish; to overtake the stage."
And thus, when already it was hard enough for her, he unwittingly
made it harder. She wanted to go ... she did not want to go ... most
of all she did not want him to know what she wanted or did not
want. She cried out quickly:
"Let us go then! I don't believe you! And, if you dare let me talk
alone with Mexicali Joe, I shall know you for what you are!"

Lynette was in Bruce Standing's study. He had gone for Mexicali Joe.
She looked about her, seeing on all hands as she had seen during
their racing drive, an expression of the man himself. Here was a vital
centre of enormous activities; Standing was its very heart. The
biggest man she had ever known or dreamed of knowing; one who
did big things; one who was himself untrammelled by the dictates
and conventions of others. And in her heart she did believe every
word that he spoke; and thus she knew that he, this man among
men, loved her!... And she loved him! She knew that; she had
known it ... how long? Perhaps with clear definiteness for the first
time while she spoke of him with Deveril, yearning for his coming;
certainly when she had started at the sight of him at the stage
wheel. So she held at last that it was for no selfish mercenary gain
that he had been so long coming to her, but rather because he had
lost faith in her, thinking ill of her. That was what hurt; that was
what held her back from his arms, since she would not admit that he
could love her truly and misdoubt her at the same time. For certainly
where one loved as she herself could love, one gave all, even unto
the last dregs of loyal, confident faith. How confident all day she had
been that he would come to her!
Lynette, restless, walked up and down, back and forth through the
big rooms, waiting. Her wandering eyes were everywhere ... upon
only one of the shining table tops was a scrap of paper. In her
abstraction she glanced at it. Her own name! Written as though
signed to a note.
In a flash her quickened fancies pictured much of all that had
happened: Deveril to-day had told Standing she was going out on
the stage; Deveril had told Standing all that had happened ...
because Deveril, too, loved her and knew that she loved his
kinsman. She recalled now how Deveril had stopped a little while in
camp after Taggart had dragged her away. So Deveril had left this
note behind? And Standing knew now; he had said there were
reasons why he had been so sure she had gone to Deveril. She
understood how now it would be with him; Deveril had told him
everything and he, accepting a rich, free gift from the hand of a man
he hated was not the man in turn to speak ill of one who had striven
to make restitution, though by speaking the truth he might gain
everything! These were men, these two; and to be loved by two
such men was like having the tribute of kings.... She heard Standing
at the door, bringing Mexicali Joe. There was a little fire in the
fireplace; she ran to it and dropped the paper into the flames behind
the big log. The door opened to Standing's hand. At his heels she
saw Mexicali Joe.
"No!" she cried, and he saw and marvelled at the new, shining look
in her eyes; a look which made him stop, his heart leaping as he
cried out wonderingly:
"Girl! oh, girl ... at last?"
"Don't bring Joe in! I don't want to talk with him; I want your word,
just yours alone, on everything!"
Now it was Mexicali Joe who was set wondering. For Standing, with
a sudden vigorous sweep of his arm, slammed the door in Joe's
perplexed face and came with swift eager strides to Lynette.
"It is I who have been of little faith and disloyal," she said softly. "I
was ungrateful enough to forget how you were big enough to take
my unproven word that it was not I who shot you, a thing I could
never prove! And yet I asked proof of you! I should have known all
the time that ... 'though it were ten thousand mile....'"
She was smiling now and yet her eyes were wet. She lifted them to
his that he might look down into them, through them into her heart.
"Let me say this ... first ..." she ran on hastily. "Babe Deveril saved
me the second time to-day from Taggart. And he told you where to
find me. I think that he has made amends."
"He wiped his slate clean," said Standing heartily. "Henceforth I am
no enemy of his. But it is not of Deveril now that we must talk. Girl,
can't you see...."
"Am I blind?" laughed Lynette happily.
Transcriber's Note:

A Table of Contents has been added.


*** END OF THE PROJECT GUTENBERG EBOOK TIMBER-WOLF ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.

You might also like