30 September 2022 Sympy Array - Jupyter Notebook
30 September 2022 Sympy Array - Jupyter Notebook
30 September 2022 Sympy Array - Jupyter Notebook
help()
In [*]:
help()
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.9/tutorial/. (http
s://docs.python.org/3.9/tutorial/.)
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
help>
In [4]:
#to imoport write import module name or import module name as your name
#eg: import numpy as n
#eg. from math import factorial
Input In [4]
eg: import numpy as n
^
SyntaxError: invalid syntax
In [6]:
import numpy
numpy.zeros(2) #answer has a dot 0. bcoz of the way it was written
Out[6]:
array([0., 0.])
In [7]:
import numpy
numpy.ones(3)
Out[7]:
In [10]:
import numpy as n
n.ones(3)
Out[10]:
In [21]:
import numpy as n
n.zeros(3)
Out[21]:
In [1]:
import numpy as n
n.ones((3,3))
Out[1]:
In [28]:
n.zeros(3)
Out[28]:
In [29]:
In [5]:
import numpy as n
n.ones((3,2,3))
Out[5]:
In [32]:
In [35]:
import sympy
a=sympy.Rational(5,8)
print("value of a is:", a)
b=sympy.Integer(3.579)
print("value of b is:", b)
In [8]:
x=sympy.Symbol('x')
y=sympy.Symbol('y')
z=(x+y)+(x-y)
print("value of z is :", z)
value of z is : 2*x
In [1]:
x,y=sympy.Symbol('x,y')
z=(x+y)+(x-y)
print("value of z is :", z)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 x,y=sympy.Symbol('x,y')
2 z=(x+y)+(x-y)
3 print("value of z is :", z)
In [2]:
double=lambda x:x/2
print (double(5))
2.5
In [3]:
t= lambda x:x*x
print (t(3))
In [11]:
print('{1},{0},{2}'.format("Thoma",2,"ter") )
2,Thoma,ter
In [8]:
print('{0}:{2}:{1}'.format("Maria","Kerala",562001))
Maria:562001:Kerala
In [ ]: