E-Book, Englisch, 216 Seiten
Reihe: Apress Access Books
Lobianco Julia Quick Syntax Reference
1. Auflage 2019
ISBN: 978-1-4842-5190-4
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
A Pocket Guide for Data Science Programming
E-Book, Englisch, 216 Seiten
Reihe: Apress Access Books
ISBN: 978-1-4842-5190-4
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
- Set up the software needed to run Julia and your first Hello World example
- Work with types and the different containers that Julia makes available for rapid application development
- Use vectorized, classical loop-based code, logical operators, and blocks
- Explore Julia functions by looking at arguments, return values, polymorphism, parameters, anonymous functions, and broadcasts
- Build custom structures in Julia
- Interface Julia with other languages such as C/C++, Python, and R
- Program a richer API, modifying the code before it is executed using expressions, symbols, macros, quote blocks, and more
- Maximize your code’s performance
Autoren/Hrsg.
Weitere Infos & Material
1;Table of Contents;4
2;About the Author;10
3;About the Technical Reviewer;11
4;Acknowledgments;12
5;Introduction;13
6;Part I: Language Core;16
6.1;Chapter 1: Getting Started;17
6.1.1;1.1 Why Julia?;17
6.1.2;1.2 Installing Julia;19
6.1.3;1.3 Running Julia;22
6.1.4;1.4 Miscellaneous Syntax Elements;24
6.1.5;1.5 Packages;25
6.1.5.1;1.5.1 Using the Package Manager;26
6.1.5.2;1.5.2 Using Packages;27
6.1.6;1.6 Help System;29
6.2;Chapter 2: Data Types and Structures;31
6.2.1;2.1 Simple Types (Non-Containers);32
6.2.1.1;2.1.1 Basic Mathematic Operations;33
6.2.1.2;2.1.2 Strings;33
6.2.1.2.1;Concatenation;34
6.2.2;2.2 Arrays (Lists);35
6.2.2.1;2.2.1 Multidimensional and Nested Arrays;39
6.2.3;2.3 Tuples;44
6.2.4;2.4 Named Tuples;45
6.2.5;2.5 Dictionaries;46
6.2.6;2.6 Sets;48
6.2.7;2.7 Memory and Copy Issues;48
6.2.8;2.8 Various Notes on Data Types;52
6.2.8.1;2.8.1 Random Numbers;53
6.2.8.2;2.8.2 Missing, Nothing, and NaN;53
6.3;Chapter 3: Control Flow and Functions;55
6.3.1;3.1 Code Block Structure and Variable Scope;55
6.3.2;3.2 Repeated Iteration: for and while Loops, List Comprehension, Maps;57
6.3.3;3.3 Conditional Statements: if Blocks, Ternary Operator;58
6.3.4;3.4 Functions;59
6.3.4.1;3.4.1 Arguments;61
6.3.4.2;3.4.2 Return Value;63
6.3.4.3;3.4.3 Multiple-Dispatch (aka Polymorphism);63
6.3.4.4;3.4.4 Templates (Type Parameterization);64
6.3.4.5;3.4.5 Functions as Objects;65
6.3.4.6;3.4.6 Call by Reference/Call by Value;65
6.3.4.7;3.4.7 Anonymous Functions (aka “Lambda” Functions);66
6.3.4.8;3.4.8 Broadcasting Functions;67
6.3.5;3.5 Do Blocks;68
6.3.6;3.6 Exiting Julia;68
6.4;Chapter 4: Custom Types;70
6.4.1;4.1 Primitive Type Definition;71
6.4.2;4.2 Structure Definition;72
6.4.3;4.3 Object Initialization and Usage;73
6.4.4;4.4 Abstract Types and Inheritance;74
6.4.4.1;4.4.1 Implementation of the Object-Oriented Paradigm in Julia;76
6.4.5;4.5 Some Useful Functions Related to Types;79
6.5;Chapter 5: Input/Output;80
6.5.1;5.1 Reading (Input);81
6.5.1.1;5.1.1 Reading from the Terminal;81
6.5.1.2;5.1.2 Reading from a File;82
6.5.1.2.1;Importing Data for a Matrix;83
6.5.1.2.2;Parsing Comma Separated Value (CSV) Files;83
6.5.1.3;5.1.3 Importing Data from Excel;84
6.5.1.4;5.1.4 Importing Data from JSON;85
6.5.1.5;5.1.5 Accessing Web Resources (HTTP);87
6.5.2;5.2 Writing (Output);88
6.5.2.1;5.2.1 Writing to the Terminal;88
6.5.2.2;5.2.2 Writing to a File;89
6.5.2.3;5.2.3 Exporting to CSV;90
6.5.2.4;5.2.4 Exporting Data to Excel;91
6.5.2.5;5.2.5 Exporting Data to JSON;92
6.5.3;5.3 Other Specialized IO;93
6.6;Chapter 6: Metaprogramming and Macros;94
6.6.1;6.1 Symbols;95
6.6.2;6.2 Expressions;96
6.6.2.1;6.2.1 Creating Expressions;97
6.6.2.1.1;Parse a String;97
6.6.2.1.2;Colon Prefix Operator;97
6.6.2.1.3;Quote Block;97
6.6.2.1.4;Use the Exp Constructor with a Tree;98
6.6.2.2;6.2.2 Evaluating Symbols and Expressions;98
6.6.3;6.3 Macros;100
6.6.3.1;6.3.1 Macro Definition;100
6.6.3.2;6.3.2 Macro Invocation;101
6.6.3.3;6.3.3 String Macros;102
6.7;Chapter 7: Interfacing Julia with Other Languages;104
6.7.1;7.1 Julia ? C;105
6.7.2;7.2 Julia ? C++;107
6.7.2.1;7.2.1 Interactive C++ Prompt;107
6.7.2.2;7.2.2 Embed C++ Code in a Julia Program;108
6.7.2.3;7.2.3 Load a C++ Library;111
6.7.3;7.3 Julia ? Python;113
6.7.3.1;7.3.1 Embed Python Code in a Julia Program;114
6.7.3.2;7.3.2 Use Python Libraries;115
6.7.3.3;7.3.3 PyJulia: Using Julia in Python;116
6.7.3.3.1;Installation;116
6.7.3.3.2;Usage;117
6.7.4;7.4 Julia ? R;119
6.7.4.1;7.4.1 Interactive R Prompt;120
6.7.4.2;7.4.2 Embed R Code in a Julia Program;120
6.7.4.3;7.4.3 Use R Libraries;121
6.7.4.4;7.4.4 JuliaCall: Using Julia in R;122
6.7.4.4.1;Installation;122
6.7.4.4.2;Usage;122
6.8;Chapter 8: Effectively Write Efficient Code;125
6.8.1;8.1 Performance;126
6.8.1.1;8.1.1 Benchmarking;126
6.8.1.2;8.1.2 Profiling;128
6.8.1.3;8.1.3 Type Stability;132
6.8.1.4;8.1.4 Other Tips to Improve Performance;134
6.8.1.4.1;Avoid Using Global Variables and Run Performance-Critical Code Within Functions;134
6.8.1.4.2;Annotate the Type of Data Structures;134
6.8.1.4.3;Annotate the Fields of Composite Types;134
6.8.1.4.4;Loop Matrix Elements by Column and Then by Row;135
6.8.2;8.2 Code Parallelization;136
6.8.2.1;8.2.1 Adding and Removing Processes;136
6.8.2.2;8.2.2 Running Heavy Computations on a List of Items;138
6.8.2.3;8.2.3 Aggregate Results;139
6.8.3;8.3 Debugging;140
6.8.3.1;8.3.1 Introspection Tools;141
6.8.3.2;8.3.2 Debugging Tools;142
6.8.4;8.4 Managing Runtime Errors (Exceptions);145
7;Part II: Packages Ecosystem;146
7.1;Chapter 9: Working with Data;147
7.1.1;9.1 Using the DataFrames Package;148
7.1.1.1;9.1.1 Installing and Importing the Library;148
7.1.1.2;9.1.2 Creating a DataFrame or Loading Data;149
7.1.1.3;9.1.3 Getting Insights About the Data;151
7.1.1.4;9.1.4 Filtering Data (Selecting or Querying Data);152
7.1.1.5;9.1.5 Editing Data;155
7.1.1.6;9.1.6 Editing Structure;156
7.1.1.6.1;Merging/Joining/Copying Datasets;158
7.1.1.7;9.1.7 Managing Missing Values;158
7.1.1.8;9.1.8 The Split-Apply-Combine Strategy;159
7.1.1.8.1;Aggregating;160
7.1.1.8.2;Computing the Cumulative Sum by Categories;162
7.1.1.9;9.1.9 Pivoting Data;163
7.1.1.9.1;Stacking Columns;165
7.1.1.9.2;Unstacking;165
7.1.1.9.3;The Pivot Function;167
7.1.1.9.4;Sorting;169
7.1.1.10;9.1.10 Dataframe Export;169
7.1.1.10.1;Exporting to CSV;169
7.1.1.10.2;Exporting to the OpenDocument Spreadsheet File;169
7.1.1.10.3;Exporting to a Matrix;170
7.1.1.10.4;Exporting to a Dict;170
7.1.1.10.5;Exporting to the hdf5 Format;171
7.1.2;9.2 Using IndexedTables;171
7.1.2.1;9.2.1 Creating an IndexedTable (NDSparse);172
7.1.2.2;9.2.2 Row Filtering;173
7.1.2.3;9.2.3 Editing/Adding Values;174
7.1.3;9.3 Using the Pipe Operator;174
7.1.4;9.4 Plotting;176
7.1.4.1;9.4.1 Installation and Backends;176
7.1.4.2;9.4.2 The Plot Function;179
7.1.4.3;9.4.3 Plotting from DataFrames;182
7.1.4.4;9.4.4 Saving;185
7.2;Chapter 10: Mathematical Libraries;186
7.2.1;10.1 JuMP, an Optimization Framework;187
7.2.1.1;10.1.1 The Transport Problem: A Linear Problem;189
7.2.1.1.1;The Problem;189
7.2.1.1.2;Importing the Libraries;190
7.2.1.1.3;Defining the Sets;190
7.2.1.1.4;Defining the Parameters;191
7.2.1.1.5;Declaring the Model;192
7.2.1.1.6;Declaring the Model Variables;193
7.2.1.1.7;Declaring the Model Constraints;193
7.2.1.1.8;Declaring the Model Objective;194
7.2.1.1.9;Human-Readable Visualization of the Model (Optional);194
7.2.1.1.10;Resolution of the Model;194
7.2.1.1.11;Visualization of the Results;195
7.2.1.2;10.1.2 Choosing Between Pizzas and Sandwiches, a Non-Linear Problem;197
7.2.1.2.1;The Problem;197
7.2.1.2.2;Importing the Libraries and Declaring the Model;198
7.2.1.2.3;Declaring the Model Variables, Constraints, and Objectives;198
7.2.1.2.4;Resolution of the Model and Visualization of the Results;199
7.2.2;10.2 SymPy, a CAS System;200
7.2.2.1;10.2.1 Loading the Library and Declaring Symbols;200
7.2.2.2;10.2.2 Creating and Manipulating Expressions;201
7.2.2.3;10.2.3 Solving a System of Equations;202
7.2.2.4;10.2.4 Retrieving Numerical Values;202
7.2.3;10.3 LsqFit, a Data Fit Library;203
7.2.3.1;10.3.1 Loading the Libraries and Defining the Model;204
7.2.3.2;10.3.2 Parameters;204
7.2.3.3;10.3.3 Fitting the Model;205
7.2.3.4;10.3.4 Retrieving the Parameters and Comparing them with the Observations;205
7.3;Chapter 11: Utilities;207
7.3.1;11.1 Weave for Dynamic Documents;207
7.3.2;11.2 Zip Files;211
7.3.2.1;11.2.1 Writing a Zip Archive;211
7.3.2.2;11.2.2 Reading from a Zipped Archive;212
7.3.3;11.3 Interact and Mux: Expose Interacting Models on the Web;214
7.3.3.1;11.3.1 Importing the Libraries;214
7.3.3.2;11.3.2 Defining the Logic of the Model;214
7.3.3.3;11.3.3 Defining Controls and Layout;215
7.3.3.4;11.3.4 Providing Widgets to Web Users;216
8;Index;218




