<jupyter_start><jupyter_text>The cell above loads all the necessary packages for all the labs. If you executed it without error, you are all set :) Introduction to Jupyter NotebooksA Notebook is devided into **cells**. Each cell can be either a text (like this one) or contain *python* code.Running a text cell won't change much, the most it does it make it look pretty. But running a code cell, will execute the code in it, and output the results. Code cells are marked with `In [ ]`, for input. You have two options for running cells. After you select it, you can either click the [**&9658; Run**] button on the top bar, or by pressing **Ctrl + Enter** on the keyboard.Try running the cell below.<jupyter_code>print('Did this work?')<jupyter_output><empty_output><jupyter_text>Great, that hopefully worked. You shoudn't be afraid of getting your hands dirty and changing the code. If you made a mistake, you can undo the changes by selecting the cell and using **[Ctrl + z]**, or in the worst case senario, you can always download the notebook again. The best way to learn how this all works is by changing the code and seeing what happens!**Now try changing the code to make it print something more appropriate** :)---Not every code has has an output. Some code will only load packages, data or functions and keep them in memory for a later use.An example is the next cell, all the code below does is define a function that we will use later.Let's run it.<jupyter_code>def cumulative_sum(n):
    sum = 0;
    for i in range(n+1):
        sum = sum + i
    return sum<jupyter_output><empty_output><jupyter_text>If you provide the function above with a number $n$ as an input, it calculates the sum of all the numbers from 1 to $n$. And now that function is stored for future use.Let's test it.<jupyter_code>cumulative_sum(5)<jupyter_output><empty_output><jupyter_text>**Now try to use it to calculate the sum of all the numbers from 1 to 20.**---Another type ou output a cell can have is a plot.You will be using plots a lot on the next few labs to help you understand the theory and analysis. The next cell will plot a sine wave$$ y = \sin(t) $$Try it :)<jupyter_code>time = np.arange(0, 10, 0.1)
amplitude = np.sin(time)

plt.plot(time, amplitude)
plt.title('Sine wave')
plt.xlabel('Time')
plt.ylabel('Amplitude')<jupyter_output><empty_output><jupyter_text>Look at that beautiful plot! :)**Now try changing some features of the plot. Maybe title, increase the time span or even the color.**---One final useful thing to talk about are the interactive elements. We will use it in some labs to make it easier for you to interact with the code, without actually having to change a line of code. Let's see how it is, run the next cell, and see if you can get your desired plot.<jupyter_code>import matplotlib.colors as mcolors

def interactive_sine(Title, Time_span, Color):
    time = np.arange(0, Time_span, 0.1)
    amplitude = np.sin(time)
    plt.plot(time, amplitude, color = Color)
    plt.title(Title)
    plt.xlabel('Time')
    plt.ylabel('Amplitude')
    
interact_plot=interact_manual.options(manual_name="Plot")
interact_plot(interactive_sine, Title = Text('Title'), Time_span = FloatSlider(min=1,max=100,value=1), Color = list(mcolors.TABLEAU_COLORS))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08502884907379289, 'fraction_numerical': 0.0072881870634679624, 'mean_word_length': 4.630769230769231, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '81297', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 983, 'n_tokens_neox': 943, 'n_words': 463, 'path': 'lab/Lab0/Lab0.ipynb', 'repo_name': 'ashwini-girish/cb2030', 'size': '3293'}