Cocalc Notes And Tutorials Ipynb

Leo Migdal
-
cocalc notes and tutorials ipynb

This page represents a collection of notes and tutorials for common functions, methods, definitions, etc. used in our class. This is not comprehensive and is intended as an aid for the course. For additional help, use the SAGE cheat sheet, SAGE tutorial, or stackoverflow. There are many ways to define functions in SAGE. The two main methods are:

defining a function explictly in terms of variables or defining a variable and then using it in a function formula. Note that the show command simply produces a nicely formated output using LaTeX.\LaTeX.LATE​X. By the end of this lecture you will be able to: Define variables and differentiate between global and local variables. Identify and use different object types in python.

Use some of the python's default functions and define your own functions. Introduction to numpy and matplotlib libraries This tutorial notebook will show some of the basic commands needed to perform resilience analysis in fmdtools. For some context, it may be helpful to look through the accompanying presentation. This notebook uses the model defined in ex_pump.py. In this notebook, we will:

Simulate the system in nominal and faulty scenarios To load the fmdtools environment, we have to install and import it. This can be accomplished using pip for both the stable and development versions: There are a number of different syntaxes for importing modules. Because of the long names of the module trees, it is often helpful to load the modules individually and abbreviate (e.g. import fmdtools.sim.propagate as propagate).

Below, import the propagate fmdtools.sim.propagate and fmdtools.analyze modules, as well as sampling using the fmdtools.sim.sample module. This IPython / Jupyter notebook is an interactive tutorial in the use of Python for data analysis. First of all, the interface. The text you see in boxes like this is editable and is written in a format called Markdown similar to the syntax used to edit Wikipedia. If you double-click on this text you will convert it to the raw Markdown for editing. If you want to go back to the nicely-rendered form, click on the editable text and press shift-enter.

Second, code to execute appears in editable textboxes, nicely syntax-highlighted for Python: When you evaluate the cell above (click on it and press shift-enter), output should appear below the cell. Yay. Python is telling you 1+1=2. Not exactly earth-shattering, but that's the basic mode of interaction at work here: Edit the snippet or write another and repeat

This is a notebook. To run it you need Julia and Jupyter/VS Code. To run Julia without a local installation, use (for instance) CoCalc or JuliaHub. Also Colab works, but the support is still (as of mid 2025) a bit tentative. To install Julia on your machine, download and install it. This link contains both instructions for the Microsoft Store and links to binaries for manual download.

You may also want to use VS Code with the Julia extension. It is an IDE (editor and more) that can run script files and notebooks. It works well with windsurf and copilot. To run notebooks from your local installation, you need either (1) VS Code with the Julia extension (see above) or (2) Jupyter/JupyterLab. Online Supplement for "Numerical Methods in Physics with Python" (Cambridge University Press, 2020) We will assume you know how to launch Python and how to use a text editor (like vim or emacs), or even an integrated development environment (IDE), to save code into a file.

While some of the details vary based on which operating system (OS) you employ, most of what we have to say is OS-agnostic. You can run Python code interactively: once you’ve launched a Python shell you get the Python prompt >>> (also known as a chevron). Since this tutorial is in the form of a Jupyter Notebook, the Python prompt will not explicitly appear below. Here are a few examples of things you could type in. You should press Enter after each line you input at the Python interpreter (or Shift-Enter if you're working on the Notebook). This is similar to other interactive environments that you may have seen before, like Mathematica.

It is sometimes called Python’s read-evaluate-print loop (REPL). Note that the first two lines show us we could (if we wanted to) use Python as a calculator. The next line provided us with our first example of using a variable: in this case we created a variable x and assigned the value 42 to it. (Numbers like 3 or 42 are known as literals). We then used the print() function to print out the variable’s value to the screen. This is our first use of a function: as in mathematics, we use parentheses to show that we are passing in an argument.

We won’t go into the different versions of Python at this point, assuming for now that you are using Python 3, where the above example is legitimate. (We discuss Python 2 vs Python 3 in a section near the end of this tutorial). Often when looking at a network, we want to find the most "important" nodes, for some definition of important. The most basic measure of centrality is the degree, or number of links attached to a node. Let's look at the Enron executive email graph: Edge lists are a simple, plain text format for storing graphs.

Since this simple file format doesn't contain information about data types, all node names are assumed to be strings by default. When the node names are given by integers, as they are in this example, we should specify the nodetype=int keyword argument to avoid confusion with the node names. We're going to make use of Python's built-in max function in order to find the node with the highest degree. First, let us recall what the max function does. At its most basic, the max function returns the "greatest" item in a sequence:

People Also Search

This Page Represents A Collection Of Notes And Tutorials For

This page represents a collection of notes and tutorials for common functions, methods, definitions, etc. used in our class. This is not comprehensive and is intended as an aid for the course. For additional help, use the SAGE cheat sheet, SAGE tutorial, or stackoverflow. There are many ways to define functions in SAGE. The two main methods are:

Defining A Function Explictly In Terms Of Variables Or Defining

defining a function explictly in terms of variables or defining a variable and then using it in a function formula. Note that the show command simply produces a nicely formated output using LaTeX.\LaTeX.LATE​X. By the end of this lecture you will be able to: Define variables and differentiate between global and local variables. Identify and use different object types in python.

Use Some Of The Python's Default Functions And Define Your

Use some of the python's default functions and define your own functions. Introduction to numpy and matplotlib libraries This tutorial notebook will show some of the basic commands needed to perform resilience analysis in fmdtools. For some context, it may be helpful to look through the accompanying presentation. This notebook uses the model defined in ex_pump.py. In this notebook, we will:

Simulate The System In Nominal And Faulty Scenarios To Load

Simulate the system in nominal and faulty scenarios To load the fmdtools environment, we have to install and import it. This can be accomplished using pip for both the stable and development versions: There are a number of different syntaxes for importing modules. Because of the long names of the module trees, it is often helpful to load the modules individually and abbreviate (e.g. import fmdtool...

Below, Import The Propagate Fmdtools.sim.propagate And Fmdtools.analyze Modules, As Well

Below, import the propagate fmdtools.sim.propagate and fmdtools.analyze modules, as well as sampling using the fmdtools.sim.sample module. This IPython / Jupyter notebook is an interactive tutorial in the use of Python for data analysis. First of all, the interface. The text you see in boxes like this is editable and is written in a format called Markdown similar to the syntax used to edit Wikiped...