# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python [Root]
#     language: python
#     name: Python [Root]
# ---

# +
## Administrative things

from IPython.display import Markdown, display
def printmd(string):
    display(Markdown(string))
    
import numpy as np
from pprint import pprint
# -

# Q. How would you represent a Scalar / Vector / Matrix / Tensor quantity in Python?

printmd('In numpy, everything (viz scalar, vector, matrix, tensor) is represented as an **array**. <br/>\
So you can see examples as below:')
print 'Scalar: ',
x = np.array([1])
pprint(x)
print '\nVector: ',
x = np.array([1, 1])
pprint(x)
print '\nMatrix: ',
x = np.array([[1, 1], [1, 1]])
pprint(x)
print '\nTensor: ',
x = np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]])
pprint(x)





StarcoderdataJupyterScriptsDedupFiltered