import%20marimo%0A%0A__generated_with%20%3D%20%220.11.8%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%20Introduction%20to%20Programming%20with%20Python%0A%20%20%20%20%20%20%20%20---%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20**Goals**%0A%0A%20%20%20%20%20%20%20%201.%20Learn%20the%20basics%20of%20programming%20in%20*Python*%3B%0A%20%20%20%20%20%20%20%202.%20Get%20familiar%20with%20*Marimo%20Notebook*%3B%0A%20%20%20%20%20%20%20%203.%20Use%20the%20modules%20of%20scientific%20computing.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20Numerical%20variables%20%26%20types%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20a%20%3D%201%20%23%20An%20integer%0A%20%20%20%20print('The%20variable%20a%20%3D%20%7B%7D%20is%20of%20type%20%7B%7D'.format(a%2C%20type(a)))%0A%20%20%20%20return%20(a%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20b%20%3D%20-1.25%20%23%20A%20floating%20number%0A%20%20%20%20print('The%20variable%20b%20%3D%20%7B%7D%20is%20of%20type%20%7B%7D'.format(b%2C%20type(b)))%0A%20%20%20%20return%20(b%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20c%20%3D%201%2B0.5j%20%23%20A%20complex%20number%20%0A%20%20%20%20print('The%20variable%20c%20%3D%20%7B%7D%20is%20of%20type%20%7B%7D'.format(c%2C%20type(c)))%0A%20%20%20%20return%20(c%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20Strings%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20msg%20%3D%20%22My%201st%20lab!%22%0A%20%20%20%20print(msg%2C%20type(msg)%2C%20sep%20%3D%20'%5Cn***%5Cn')%20%23%20%5Cn%3A%20Carriage%20Return%20%26%20Line%20Feed%0A%20%20%20%20print(msg%20%2B%203*%20'%5CnPython%20is%20awesome')%0A%20%20%20%20return%20(msg%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20longMsg%20%3D%20%22%22%22This%20is%20a%20long%20message%2C%0A%20%20%20%20spanned%20over%20multiple%20lines%22%22%22%0A%20%20%20%20print(longMsg)%0A%20%20%20%20return%20(longMsg%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Indexing%20and%20slicing_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(msg)%3A%0A%20%20%20%20%23%20Positive%20indexing%0A%20%20%20%20print(msg%2C%20msg%5B1%3A5%5D%2C%20sep%20%3D%20'%20-----%3E%20')%0A%20%20%20%20%23%20Negative%20indexing%0A%20%20%20%20print(msg%2C%20msg%5B-5%3A-1%5D%2C%20sep%20%3D%20'%20-----%3E%20')%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_String%20transformations_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20msg_1%20%3D%20'A%20message'%0A%20%20%20%20print(len(msg_1))%0A%20%20%20%20print(msg_1.lower())%0A%20%20%20%20print(msg_1.upper())%0A%20%20%20%20print(msg_1.split('%20'))%0A%20%20%20%20print(msg_1.replace('mes'%2C%20'MES'))%0A%20%20%20%20print('a'%20in%20msg_1)%0A%20%20%20%20return%20(msg_1%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20price%2C%20number%2C%20perso%20%3D%20300%2C%207%2C%20'A%20customer'%0A%20%20%20%20print('%7B%7D%20asks%20for%20%7B%7D%20pieces.%20They%20cost%20%7B%7D%20TND!'.format(perso%2C%20number%2C%20price))%0A%20%20%20%20print('%7B1%7D%20demande%20%7B2%7D%20pi%C3%A8ces.%20They%20cost%20%7B0%7D%20TND!'.format(price%2C%20perso%2C%20number))%0A%20%20%20%20return%20number%2C%20perso%2C%20price%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20Binary%2C%20octal%20%26%20hexadecimal%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20x%20%3D%200b0101%20%23%200b%20%3A%20binary%0A%20%20%20%20print(x%2C%20type(x)%2C%20sep%20%3D%20'%5Ct----%5Ct')%20%23%20%5Ct%20%3A%20tabular%0A%20%20%20%20y%20%3D%200xAF%20%23%20Ox%20%3A%20hexadecimal%0A%20%20%20%20print(y%2C%20type(y)%2C%20sep%20%3D%20'%5Ct'%20%2B%20'---'*5%20%2B%20'%5Ct')%0A%20%20%20%20z%20%3D%200o010%20%23%200o%20%3A%20octal%0A%20%20%20%20print(z%2C%20type(z)%2C%20sep%20%3D%20'%2C%20')%0A%20%20%20%20return%20x%2C%20y%2C%20z%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Boolean_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20a_1%20%3D%20True%0A%20%20%20%20b_1%20%3D%20False%0A%20%20%20%20print(a_1)%0A%20%20%20%20print(b_1)%0A%20%20%20%20return%20a_1%2C%20b_1%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20print(%2250%20%3E%2020%20%3F%20%3A%20%7B%7D%20%5Cn50%20%3C%2020%20%3F%20%3A%20%7B%7D%20%5Cn50%20%3D%2020%20%3F%20%3A%20%7B%7D%5Cn50%20%2F%3D%2020%20%3F%20%3A%20%7B%7D%22%0A%20%20%20%20%20%20%20%20%20%20.format(50%20%3E%2020%2C%2050%20%3C%2020%2C%2050%20%3D%3D%2020%2C%2050%20!%3D%2020)%0A%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20print(bool(123)%2C%20bool(0)%2C%20bool('Lab')%2C%20bool())%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20var1%20%3D%20100%0A%20%20%20%20print(isinstance(var1%2C%20int))%0A%20%20%20%20var2%20%3D%20-100.35%0A%20%20%20%20print(isinstance(var2%2C%20int))%0A%20%20%20%20print(isinstance(var2%2C%20float))%0A%20%20%20%20return%20var1%2C%20var2%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20Lists%2C%20tuples%20%26%20dictionaries%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22In%20Python%2C%20a%20list%20is%20an%20ordered%20collection%20of%20items%20that%20can%20be%20of%20any%20data%20type%20(including%20other%20lists).%20Lists%20are%20defined%20using%20square%20brackets%2C%20with%20items%20separated%20by%20commas.%20For%20example%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20shopping_list%20%3D%20%5B'milk'%2C%20'eggs'%2C%20'bread'%2C%20'apples'%5D%0A%20%20%20%20return%20(shopping_list%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22A%20tuple%20is%20also%20an%20ordered%20collection%20of%20items%2C%20but%20it%20is%20immutable%2C%20meaning%20that%20the%20items%20it%20contains%20cannot%20be%20modified%20once%20the%20tuple%20is%20created.%20Tuples%20are%20defined%20using%20parentheses%2C%20with%20items%20separated%20by%20commas.%20For%20example%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20point%20%3D%20(3%2C%205)%0A%20%20%20%20return%20(point%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22A%20dictionary%20is%20a%20collection%20of%20key-value%20pairs%2C%20where%20the%20keys%20are%20unique%20and%20used%20to%20look%20up%20the%20corresponding%20values.%20Dictionaries%20are%20defined%20using%20curly%20braces%2C%20with%20the%20key-value%20pairs%20separated%20by%20commas.%20The%20keys%20and%20values%20are%20separated%20by%20a%20colon.%20For%20example%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20phonebook%20%3D%20%7B'Alice'%3A%20'555-1234'%2C%20'Bob'%3A%20'555-5678'%2C%20'Eve'%3A%20'555-9101'%7D%0A%20%20%20%20return%20(phonebook%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22You%20can%20access%20the%20items%20in%20a%20list%20or%20tuple%20using%20an%20index%2C%20and%20you%20can%20access%20the%20values%20in%20a%20dictionary%20using%20the%20corresponding%20keys.%20For%20example%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(phonebook%2C%20point%2C%20shopping_list)%3A%0A%20%20%20%20%23%20Accessing%20the%20second%20item%20in%20a%20list%0A%20%20%20%20print(shopping_list%5B1%5D)%20%20%23%20prints%20'eggs'%0A%0A%20%20%20%20%23%20Accessing%20the%20first%20item%20in%20a%20tuple%0A%20%20%20%20print(point%5B0%5D)%20%20%23%20prints%203%0A%0A%20%20%20%20%23%20Accessing%20the%20phone%20number%20for%20'Bob'%20in%20the%20phonebook%20dictionary%0A%20%20%20%20print(phonebook%5B'Bob'%5D)%20%20%23%20prints%20'555-5678'%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%23%20List%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20lst%20%3D%20%5B'a'%2C%20'b'%2C%20'c'%2C%201%2C%20True%5D%20%23%20An%20aggregate%20of%20various%20types%0A%20%20%20%20print(lst)%0A%20%20%20%20return%20(lst%2C)%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20print(len(lst))%20%23%20Length%20of%20%60lst%60%20variable%0A%20%20%20%20print(lst%5B1%3A3%5D)%20%23%20Accessing%20elements%20of%20%60lst%60%0A%20%20%20%20lst%5B0%5D%20%3D%20%5B'1'%2C%200%5D%20%23%20Combined%20list%0A%20%20%20%20print(lst)%0A%20%20%20%20print(lst%5B3%3A%5D)%0A%20%20%20%20print(lst%5B%3A3%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20lst.append('etc')%20%23%20Insert%20'etc'%20at%20the%20end%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20lst.insert(1%2C%20'xyz')%20%23%20Inserting%20'xyz'%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20lst.pop(1)%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20lst.pop()%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20del%20lst%5B0%5D%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20lst.append('b')%0A%20%20%20%20print(lst)%0A%20%20%20%20lst.remove('b')%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20%23%20Loop%0A%20%20%20%20for%20k%20in%20lst%3A%0A%20%20%20%20%20%20%20%20print(k)%0A%20%20%20%20return%20(k%2C)%0A%0A%0A%40app.cell%0Adef%20_(lst)%3A%0A%20%20%20%20lst.clear()%0A%20%20%20%20print(lst)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%7C%20**_Method_**%20%20%7C%20**_Description_**%20%7C%0A%20%20%20%20%20%20%20%20%7C%20-------------%20%7C%20-------------%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**copy()**%20%20%20%20%7C%20Returns%20a%20copy%20of%20the%20list%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**list()**%20%20%20%20%7C%20Transforms%20into%20a%20list%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**extend%20()**%20%7C%20Extends%20a%20list%20by%20adding%20elements%20at%20its%20end%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**count()**%20%20%20%7C%20Returns%20the%20occurrences%20of%20the%20specified%20value%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**index()**%20%20%20%7C%20Returns%20the%20index%20of%20the%20first%20occurrence%20of%20a%20specified%20value%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**reverse()**%20%7C%20Reverse%20a%20list%20%7C%0A%20%20%20%20%20%20%20%20%7C%20**sort()**%20%20%20%20%7C%20Sort%20a%20list%20%7C%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%23%20Tuples%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20tpl%20%3D%20(1%2C%202%2C%203)%0A%20%20%20%20print(tpl)%0A%20%20%20%20return%20(tpl%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20tpl_1%20%3D%20(1%2C%20'1'%2C%202%2C%20'text')%0A%20%20%20%20print(tpl_1)%0A%20%20%20%20return%20(tpl_1%2C)%0A%0A%0A%40app.cell%0Adef%20_(tpl_1)%3A%0A%20%20%20%20print(len(tpl_1))%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(tpl_1)%3A%0A%20%20%20%20print(tpl_1%5B1%3A%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(tpl_1)%3A%0A%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20tpl_1.append('xyz')%0A%20%20%20%20except%20Exception%20as%20err%3A%0A%20%20%20%20%20%20%20%20print(err)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(tpl_1)%3A%0A%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20tpl_1.insert(1%2C%20'xyz')%0A%20%20%20%20except%20Exception%20as%20err%3A%0A%20%20%20%20%20%20%20%20print(err)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(tpl_1)%3A%0A%20%20%20%20my_lst%20%3D%20list(tpl_1)%0A%20%20%20%20my_lst.append('xyz')%0A%20%20%20%20print(my_lst%2C%20type(my_lst)%2C%20sep%3D'%2C%20')%0A%20%20%20%20return%20(my_lst%2C)%0A%0A%0A%40app.cell%0Adef%20_(my_lst)%3A%0A%20%20%20%20nv_tpl%20%3D%20tuple(my_lst)%20%23%20Convert%20'my_lst'%20into%20a%20tuple%20'nv_tpl'%0A%20%20%20%20print(nv_tpl%2C%20type(nv_tpl)%2C%20sep%20%3D%20'%2C%20')%0A%20%20%20%20return%20(nv_tpl%2C)%0A%0A%0A%40app.cell%0Adef%20_(nv_tpl)%3A%0A%20%20%20%20for%20k_1%20in%20nv_tpl%3A%0A%20%20%20%20%20%20%20%20print(k_1)%0A%20%20%20%20return%20(k_1%2C)%0A%0A%0A%40app.cell%0Adef%20_(nv_tpl%2C%20tpl_1)%3A%0A%20%20%20%20rs_tpl%20%3D%20tpl_1%20%2B%20nv_tpl%0A%20%20%20%20print(rs_tpl)%0A%20%20%20%20return%20(rs_tpl%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%23%20Dictionaries%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20dct%20%3D%20%7B%22key%22%3A%20%22value%22%7D%0A%20%20%20%20dct%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22Term%22%20%3A%20%22GM%22%2C%0A%20%20%20%20%20%20%20%20%22Speciality%22%20%3A%20%22ElnI%22%2C%0A%20%20%20%20%20%20%20%20%22Sem%22%20%3A%20%224%22%0A%20%20%20%20%7D%0A%20%20%20%20print(dct%2C%20type(dct)%2C%20sep%20%3D%20'%2C%20')%0A%20%20%20%20return%20(dct%2C)%0A%0A%0A%40app.cell%0Adef%20_(dct)%3A%0A%20%20%20%20print(dct%5B%22Sem%22%5D)%0A%20%20%20%20sem%20%3D%20dct.get(%22Sem%22)%0A%20%20%20%20print(sem)%0A%20%20%20%20return%20(sem%2C)%0A%0A%0A%40app.cell%0Adef%20_(dct)%3A%0A%20%20%20%20dct%5B%22Term%22%5D%20%3D%20%22GE%22%0A%20%20%20%20print(dct)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(dct)%3A%0A%20%20%20%20%23%20Loop%0A%20%20%20%20for%20el%20in%20dct%3A%0A%20%20%20%20%20%20%20%20print(el%2C%20dct%5Bel%5D%2C%20sep%20%3D%20'%5Ct%7C%5Ct')%0A%20%20%20%20return%20(el%2C)%0A%0A%0A%40app.cell%0Adef%20_(dct)%3A%0A%20%20%20%20for%20k_2%20in%20dct.keys()%3A%0A%20%20%20%20%20%20%20%20print(k_2)%0A%20%20%20%20return%20(k_2%2C)%0A%0A%0A%40app.cell%0Adef%20_(dct)%3A%0A%20%20%20%20for%20v%20in%20dct.values()%3A%0A%20%20%20%20%20%20%20%20print(v)%0A%20%20%20%20return%20(v%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20NumPy%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20*NumPy*%20is%20a%20*Python*%20library%20that%20is%20used%20for%20scientific%20computing%20and%20data%20analysis.%20It%20provides%20support%20for%20large%2C%20multi-dimensional%20arrays%20and%20matrices%20of%20numerical%20data%2C%20and%20a%20large%20library%20of%20mathematical%20functions%20to%20operate%20on%20these%20arrays.%0A%0A%20%20%20%20%20%20%20%20One%20of%20the%20main%20features%20of%20*NumPy*%20is%20its%20%24N%24-dimensional%20array%20object%2C%20which%20is%20used%20to%20store%20and%20manipulate%20large%20arrays%20of%20homogeneous%20data%20(_i.e._%2C%20data%20of%20the%20same%20type%2C%20such%20as%20integers%20or%20floating%20point%20values).%20The%20array%20object%20provides%20efficient%20operations%20for%20performing%20element-wise%20calculations%2C%20indexing%2C%20slicing%2C%20and%20reshaping.%0A%0A%20%20%20%20%20%20%20%20*NumPy*%20also%20includes%20a%20number%20of%20functions%20for%20performing%20statistical%20and%20mathematical%20operations%20on%20arrays%2C%20such%20as%20mean%2C%20standard%20deviation%2C%20and%20dot%20product.%20It%20also%20includes%20functions%20for%20linear%20algebra%2C%20random%20number%20generation%2C%20and%20Fourier%20transforms.%0A%0A%20%20%20%20%20%20%20%20Official%20documentation%20can%20be%20found%20at%20%5Bhttps%3A%2F%2Fnumpy.org%2F%5D(https%3A%2F%2Fnumpy.org%2F)%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20return%20(np%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_NumPy%20vs%20List_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20a_np%20%3D%20np.arange(6)%20%23%20NumPy%0A%20%20%20%20print(%22a_np%20%3D%20%22%2C%20a_np)%0A%20%20%20%20print(type(a_np))%0A%20%20%20%20a_lst%20%3D%20list(range(0%2C6))%20%23%20List%0A%20%20%20%20print(%22a_lst%20%3D%20%22%2C%20a_lst)%0A%20%20%20%20print(type(a_lst))%0A%20%20%20%20%23%20Comparison%0A%20%20%20%20print(%222%20*%20a_np%20%3D%20%22%2C%20a_np%20*%202)%0A%20%20%20%20print(%222%20*%20a_lst%20%3D%20%22%2C%20a_lst%20*%202)%0A%20%20%20%20return%20a_lst%2C%20a_np%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20v_np%20%3D%20np.array(%5B1%2C%202%2C%203%2C%204%2C%205%2C%206%5D)%20%23%20NB%20%3A%20parentheses%20then%20brackets%2C%20i.e%2C%20(%5B%5D)%0A%20%20%20%20print(v_np)%0A%20%20%20%20return%20(v_np%2C)%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20v_np_1%20%3D%20np.array(%5B%5B1%2C%202%2C%203%2C%204%5D%2C%20%5B5%2C%206%2C%207%2C%208%5D%2C%20%5B9%2C%2010%2C%2011%2C%2012%5D%5D)%0A%20%20%20%20print(v_np_1)%0A%20%20%20%20return%20(v_np_1%2C)%0A%0A%0A%40app.cell%0Adef%20_(v_np_1)%3A%0A%20%20%20%20print(type(v_np_1))%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(v_np_1)%3A%0A%20%20%20%20print(v_np_1%5B0%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(v_np_1)%3A%0A%20%20%20%20v_np_1.ndim%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(v_np_1)%3A%0A%20%20%20%20v_np_1.shape%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(v_np_1)%3A%0A%20%20%20%20v_np_1.size%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22If%20we%20need%20to%20create%20a%20matrix%20%24(3%2C%203)%24%2C%20we%20can%20do%20as%20follows%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20u%20%3D%20np.arange(9).reshape(3%2C3)%0A%20%20%20%20print(u)%0A%20%20%20%20return%20(u%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Let%20us%20see%20some%20known%20operations%20to%20do%20on%20matrices%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20M%20%3D%20np.array(%5B%5B1%2C%202%5D%2C%20%5B1%2C%202%5D%5D)%0A%20%20%20%20print(M)%0A%20%20%20%20return%20(M%2C)%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20N%20%3D%20np.array(%5B%5B0%2C%203%5D%2C%20%5B4%2C%205%5D%5D)%0A%20%20%20%20print(N)%0A%20%20%20%20return%20(N%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Addition_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(M%2C%20N%2C%20np)%3A%0A%20%20%20%20print(M%20%2B%20N)%0A%20%20%20%20print(np.add(M%2C%20N))%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Subtraction_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(M%2C%20N%2C%20np)%3A%0A%20%20%20%20print(M-N)%0A%20%20%20%20print(np.subtract(M%2C%20N))%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Element-wise%20Division_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D0%263%5C%5C4%265%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20.%2F%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D1%262%5C%5C1%262%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%5Cquad%20%3D%5Cquad%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D0%3A1%263%3A2%5C%5C4%3A1%265%3A2%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(M%2C%20N%2C%20np)%3A%0A%20%20%20%20print(N%20%2F%20M)%0A%20%20%20%20print(np.divide(N%2C%20M))%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Element-wise%20Product_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20Element-wise%20multiplication%2C%20also%20known%20as%20**Hadamard%20product**%2C%20is%20an%20operation%20that%20multiplies%20each%20element%20of%20one%20matrix%20with%20the%20corresponding%20element%20of%20another%20matrix.%20It%20is%20denoted%20by%20the%20symbol%20%24%5Codot%24%20or%20%60.*%60%20in%20some%20programming%20languages.%0A%0A%20%20%20%20%20%20%20%20For%20example%2C%20consider%20the%20following%20matrices%3A%0A%0A%20%20%20%20%20%20%20%20%24%24A%20%3D%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bccc%7Da_1%2C%26%20a_2%2C%26%20a_3%5Cend%7Barray%7D%5Cright%5D%20%5Cqquad%5Ctext%7Band%7D%5Cqquad%20B%20%3D%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bccc%7Db_1%2C%26%20b_2%2C%26%20b_3%5Cend%7Barray%7D%5Cright%5D%24%24%0A%0A%0A%20%20%20%20%20%20%20%20The%20element-wise%20product%20of%20these%20matrices%20is%3A%0A%0A%20%20%20%20%20%20%20%20%24%24A%20%5Codot%20B%20%3D%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bccc%7Da_1b_1%2C%26%20a_2b_2%2C%26%20a_3b_3%5Cend%7Barray%7D%5Cright%5D%24%24%0A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D1%262%5C%5C1%262%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20.%5Ctimes%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D0%263%5C%5C4%265%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%5Cquad%20%3D%5Cquad%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D0%266%5C%5C4%2610%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%0A%20%20%20%20%20%20%20%20We%20need%20element-wise%20multiplication%20in%20many%20applications.%20For%20example%2C%20in%20image%20processing%2C%20element-wise%20multiplication%20is%20used%20to%20modify%20the%20intensity%20values%20of%20an%20image%20by%20multiplying%20each%20pixel%20value%20with%20a%20scalar%20value.%20In%20machine%20learning%2C%20element-wise%20multiplication%20is%20used%20in%20the%20implementation%20of%20various%20neural%20network%20layers%2C%20such%20as%20convolutional%20layers%20and%20fully%20connected%20layers.%20Element-wise%20multiplication%20is%20also%20used%20in%20many%20other%20mathematical%20and%20scientific%20applications.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(M%2C%20N%2C%20np)%3A%0A%20%20%20%20print(M%20*%20N)%0A%20%20%20%20print(np.multiply(M%2C%20N))%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Dot%20Product_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D1%262%5C%5C1%262%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%5Ctimes%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D0%263%5C%5C4%265%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%5Cquad%20%3D%5Cquad%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D8%2613%5C%5C8%2613%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(M%2C%20N%2C%20np)%3A%0A%20%20%20%20print(M.dot(N))%0A%20%20%20%20print(np.dot(M%2C%20N))%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Kronecker%20Product_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcccc%7D1%262%263%264%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%5Cbigotimes%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bccc%7D1%262%5C%5C3%264%5C%5C5%266%5C%5C7%268%5Cend%7Barray%7D%5Cright%5D%20%5C%3B%3D%5C%3B%20%0A%20%20%20%20%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcccccccccccc%7D%0A%20%20%20%20%20%20%20%201%262%262%264%263%266%264%268%5C%5C3%264%266%268%269%2612%2612%2616%5C%5C5%266%2610%2612%2615%2618%2620%2624%5C%5C7%268%2614%2616%2621%2624%2628%2632%0A%20%20%20%20%20%20%20%20%5Cend%7Barray%7D%5Cright%5D%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20u_1%20%3D%20np.arange(1%2C%205)%0A%20%20%20%20v_1%20%3D%20np.arange(1%2C%209).reshape(4%2C%202)%0A%20%20%20%20(u_1%2C%20v_1)%0A%20%20%20%20return%20u_1%2C%20v_1%0A%0A%0A%40app.cell%0Adef%20_(np%2C%20u_1%2C%20v_1)%3A%0A%20%20%20%20np.kron(u_1%2C%20v_1)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22_Determinant%20of%20a%20matrix_%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(M%2C%20N%2C%20np)%3A%0A%20%20%20%20print(%22Determinant%20of%20M%3A%22)%0A%20%20%20%20print(np.linalg.det(M))%0A%20%20%20%20print(%22Determinant%20of%20N%3A%22)%0A%20%20%20%20print(np.linalg.det(N))%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20Matplotlib%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20*Matplotlib*%20is%20a%20%242%24D%20data%20visualization%20library%20in%20*Python*%20that%20allows%20users%20to%20create%20a%20wide%20range%20of%20static%2C%20animated%2C%20and%20interactive%20visualizations%20in%20*Python*.%20It%20is%20one%20of%20the%20most%20widely%20used%20data%20visualization%20libraries%20in%20the%20*Python*%20data%20science%20ecosystem%20and%20is%20particularly%20useful%20for%20creating%20line%20plots%2C%20scatter%20plots%2C%20bar%20plots%2C%20error%20bars%2C%20histograms%2C%20bar%20charts%2C%20pie%20charts%2C%20box%20plots%2C%20and%20many%20other%20types%20of%20visualizations.%0A%0A%20%20%20%20%20%20%20%20*Matplotlib*%20is%20built%20on%20top%20of%20*NumPy*%20and%20is%20often%20used%20in%20conjunction%20with%20other%20libraries%20in%20the%20PyData%20ecosystem%2C%20such%20as%20*Pandas*%20and%20*Seaborn*%2C%20to%20create%20complex%20visualizations%20of%20data.%20It%20is%20also%20compatible%20with%20a%20number%20of%20different%20backends%2C%20such%20as%20the%20_Jupyter%20notebook_%2C%20_Qt_%2C%20and%20_Tkinter_%2C%20which%20allows%20it%20to%20be%20used%20in%20a%20wide%20range%20of%20environments%20and%20contexts.%0A%0A%20%20%20%20%20%20%20%20The%20full%20documentation%20and%20an%20exhaustive%20list%20of%20samples%20can%20be%20found%20at%20%5Bhttps%3A%2F%2Fmatplotlib.org%2F%5D(https%3A%2F%2Fmatplotlib.org%2F)%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20from%20matplotlib%20import%20pyplot%20as%20plt%0A%20%20%20%20plt.style.use('dark_background')%0A%20%20%20%20plt.rc('figure'%2C%20figsize%3D(6%2C%204))%0A%0A%20%20%20%20from%20matplotlib%20import%20rcParams%0A%20%20%20%20rcParams%5B'font.family'%5D%20%3D%20'Monospace'%0A%20%20%20%20rcParams%5B'font.size'%5D%20%3D%208%0A%20%20%20%20rcParams%5B'axes.unicode_minus'%5D%20%3D%20False%0A%20%20%20%20return%20plt%2C%20rcParams%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22We%20begin%20by%20creating%20a%20sinusoidal%20waveform%20denoted%20by%20%24x%24%2C%20period%20is%20%241%24%20sec.%20The%20offset%20is%20%241%24.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20t%20%3D%20np.arange(0.0%2C%202.0%2C%200.01)%0A%20%20%20%20x_1%20%3D%201%20%2B%20np.sin(2%20*%20np.pi%20*%20t)%0A%20%20%20%20return%20t%2C%20x_1%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22The%20set%20of%20instructions%20that%20allow%20to%20plot%20%5C(x%5C)%20are%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(plt%2C%20t%2C%20x_1)%3A%0A%20%20%20%20plt.plot(t%2C%20x_1)%0A%20%20%20%20plt.title('%24x(t)%20%3D%201%2B%5C%5Csin%5C%5Cleft(2%5C%5Cpi%5C%5Cfrac%7Bt%7D%7B1%7D%5C%5Cright)%24')%0A%20%20%20%20plt.xlabel('%24t%24%20(sec)')%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20t_1%20%3D%20np.arange(0.0%2C%202.0%2C%200.1)%0A%20%20%20%20y_1%20%3D%20np.sin(2%20*%20np.pi%20*%20t_1)%0A%20%20%20%20return%20t_1%2C%20y_1%0A%0A%0A%40app.cell%0Adef%20_(plt%2C%20t_1%2C%20y_1)%3A%0A%20%20%20%20plt.stem(t_1%2C%20y_1)%0A%20%20%20%20plt.xlabel('%24t%24%20(sec)')%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20x_2%20%3D%20np.logspace(-2%2C%203%2C%20100)%0A%20%20%20%20y_2%20%3D%20np.log10(x_2)%0A%20%20%20%20return%20x_2%2C%20y_2%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20np.log10.__doc__%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(plt%2C%20x_2%2C%20y_2)%3A%0A%20%20%20%20plt.plot(x_2%2C%20y_2)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(plt%2C%20x_2%2C%20y_2)%3A%0A%20%20%20%20plt.semilogx(x_2%2C%20y_2)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22**About%20distributions**%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20a_2%20%3D%20np.random.randn(2%20**%2016)%0A%20%20%20%20b_2%20%3D%20np.random.rand(2%20**%2016)%0A%20%20%20%20return%20a_2%2C%20b_2%0A%0A%0A%40app.cell%0Adef%20_(a_2%2C%20b_2%2C%20plt)%3A%0A%20%20%20%20(_%2C%20ax)%20%3D%20plt.subplots(1%2C%202)%0A%20%20%20%20ax%5B0%5D.hist(a_2%2C%20bins%3D16)%0A%20%20%20%20ax%5B1%5D.hist(b_2%2C%20bins%3D16)%0A%20%20%20%20return%20(ax%2C)%0A%0A%0A%40app.cell%0Adef%20_(a_2%2C%20b_2%2C%20plt)%3A%0A%20%20%20%20(_%2C%20ax_1)%20%3D%20plt.subplots(2%2C%202)%0A%20%20%20%20ax_1%5B0%5D%5B0%5D.hist2d(a_2%2C%20a_2%2C%20bins%3D32)%0A%20%20%20%20ax_1%5B0%5D%5B1%5D.hist2d(a_2%2C%20b_2%2C%20bins%3D32)%0A%20%20%20%20ax_1%5B1%5D%5B0%5D.hist2d(b_2%2C%20a_2%2C%20bins%3D32)%0A%20%20%20%20ax_1%5B1%5D%5B1%5D.hist2d(b_2%2C%20b_2%2C%20bins%3D32)%0A%20%20%20%20return%20(ax_1%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20return%20(mo%2C)%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
30fc068812597a0bffb2841c182ed9228da2141c7a3c4fac8414e876cfef5fa6