Programming in JuliaPackages
Julia has a built-in package management system. Package management is important because dependencies and versions can quickly become a mess if you are trying to copy code files from other people and put them alongside the files in your project. The package manager is alert to these dependencies and does the computational work to resolve them. It also stores the package code in a central location on your computer so that it is visible to Julia regardless of where your scripts are located.
To add a Julia package, do
using Pkg; Pkg.add("PackageName") from a Julia session. Then
using PackageName to load the package. Important packages include
PlotsThere are many plotting packages in Julia, but this is the closest the ecosystem has to a standard.
DataFramesThe standard package for storing tabular data.
CSVReading data stored in comma-separated value files.
PyCallInterfacing with Python.
Packages might use lots of variable names internally, and some of them might conflict with names you're using. For this reason, package code is wrapped in a module, which is a separate variable workspace.
You can load a module by running, for example,
import Plots or
using Plots. With the
import keyword, your name space and that of the module are kept separate, and you have to access variables within the module using dot syntax:
Plots.histogram. In the latter case, any names exported by the module become available in the importing namespace (without the dot syntax). You can also choose specific functions to import:
using Plots: histogram
To import just the
DataFrame function from
DataFrames, we would use what statement?
using DataFrames: DataFrame
If we want to be able to solve equations using
SymPy.solve, what import statement should we run first?