Skip to content

Latest commit

 

History

History
535 lines (217 loc) · 4.19 KB

File metadata and controls

535 lines (217 loc) · 4.19 KB
from sympy import *
from sympy.plotting import plot
import matplotlib.pyplot as plt
init_printing(use_unicode= True)
from sympy.vector import *

v,p,q = symbols("v p q")
#1
N = CoordSys3D('N')
p = N.i + N.j
q = 6*N.i + 2*N.j
v = q-p
v

$$(5)\mathbf{\hat{i}{N}} + \mathbf{\hat{j}{N}}$$

v.magnitude()

$$\sqrt{26}$$

v.normalize()

$$(\frac{5 \sqrt{26}}{26})\mathbf{\hat{i}{N}} + (\frac{\sqrt{26}}{26})\mathbf{\hat{j}{N}}$$

#2
p = N.i + N.j +N.k
q = 2*N.i + 2*N.j
v = q-p
v

$$\mathbf{\hat{i}{N}} + \mathbf{\hat{j}{N}} - \mathbf{\hat{k}_{N}}$$

v.magnitude()

$$\sqrt{3}$$

v.normalize()

$$(\frac{\sqrt{3}}{3})\mathbf{\hat{i}{N}} + (\frac{\sqrt{3}}{3})\mathbf{\hat{j}{N}} + (- \frac{\sqrt{3}}{3})\mathbf{\hat{k}_{N}}$$

#3
p = -3*N.i + 4*N.j -.5*N.k
q = 5.5*N.i + 1.2*N.k
v = q-p
v

$$(8.5)\mathbf{\hat{i}{N}} + (-4)\mathbf{\hat{j}{N}} + (1.7)\mathbf{\hat{k}_{N}}$$

v.magnitude()

$$9.5467271878901$$

v.normalize()

$$(0.890357484058216)\mathbf{\hat{i}{N}} + (-0.418991757203867)\mathbf{\hat{j}{N}} + (0.178071496811643)\mathbf{\hat{k}_{N}}$$

#4
p = 1*N.i + 4*N.j +2*N.k
q = -1*N.i -4*N.j -2*N.k
v = q-p
v

$$(-2)\mathbf{\hat{i}{N}} + (-8)\mathbf{\hat{j}{N}} + (-4)\mathbf{\hat{k}_{N}}$$

v.magnitude()

$$2 \sqrt{21}$$

v.normalize()

$$(- \frac{\sqrt{21}}{21})\mathbf{\hat{i}{N}} + (- \frac{4 \sqrt{21}}{21})\mathbf{\hat{j}{N}} + (- \frac{2 \sqrt{21}}{21})\mathbf{\hat{k}_{N}}$$

#5
p = 0*N.i
q = 2*N.i +1*N.j -2*N.k
v = q-p
v

$$(2)\mathbf{\hat{i}{N}} + \mathbf{\hat{j}{N}} + (-2)\mathbf{\hat{k}_{N}}$$

v.magnitude()

$$3$$

v.normalize()

$$(\frac{2}{3})\mathbf{\hat{i}{N}} + (\frac{1}{3})\mathbf{\hat{j}{N}} + (- \frac{2}{3})\mathbf{\hat{k}_{N}}$$

#6
v = 4*N.i
p = 2*N.j+ 13*N.k
q = p+v
q

$$(4)\mathbf{\hat{i}{N}} + (2)\mathbf{\hat{j}{N}} + (13)\mathbf{\hat{k}_{N}}$$

q.magnitude()

$$4.03112887414927$$

#7
v = (1/2)*N.i + 3*N.j -(1/4)*N.k
p = (7/2)*N.i+(-3)*N.j+ (3/4)*N.k
q = p+v
q

$$(4.0)\mathbf{\hat{i}{N}} + (0.5)\mathbf{\hat{k}{N}}$$

q.magnitude()

$$4.03112887414927$$

#8
v = 13.1*N.i + .8*N.j -2*N.k
p = 0*N.i
q = p+v
q

$$(13.1)\mathbf{\hat{i}{N}} + (0.8)\mathbf{\hat{j}{N}} + (-2)\mathbf{\hat{k}_{N}}$$

q.magnitude()

$$13.2759180473518$$

#9
v = 6*N.i + 1*N.j -4*N.k
p = -6*N.i-1*N.j-4*N.k
q = p+v
q

$$(-8)\mathbf{\hat{k}_{N}}$$

q.magnitude()

$$8$$

#10
v = - 3*N.j +3*N.k
p = 3*N.j- 3*N.k
q = p+v
q

$$\mathbf{\hat{0}}$$

q.magnitude()

$$0$$

a = 3*N.i + 2*N.j
b = -4*N.i+6*N.j
c = 5*N.i-N.j +8*N.k
d = 4*N.k
#11
2*a

$$(6)\mathbf{\hat{i}{N}} + (4)\mathbf{\hat{j}{N}}$$

a/2

$$(\frac{3}{2})\mathbf{\hat{i}{N}} + \mathbf{\hat{j}{N}}$$

-a

$$(-3)\mathbf{\hat{i}{N}} + (-2)\mathbf{\hat{j}{N}}$$

#12
(a+b)+c

$$(4)\mathbf{\hat{i}{N}} + (7)\mathbf{\hat{j}{N}} + (8)\mathbf{\hat{k}_{N}}$$

a+(b+c)

$$(4)\mathbf{\hat{i}{N}} + (7)\mathbf{\hat{j}{N}} + (8)\mathbf{\hat{k}_{N}}$$

#13
b+c

$$\mathbf{\hat{i}{N}} + (5)\mathbf{\hat{j}{N}} + (8)\mathbf{\hat{k}_{N}}$$

c+b

$$\mathbf{\hat{i}{N}} + (5)\mathbf{\hat{j}{N}} + (8)\mathbf{\hat{k}_{N}}$$

#14
3*c - 6*d

$$(15)\mathbf{\hat{i}{N}} + (-3)\mathbf{\hat{j}{N}}$$

3*(c- 2*d)

$$(15)\mathbf{\hat{i}{N}} + (-3)\mathbf{\hat{j}{N}}$$

7*(c-b)

$$(63)\mathbf{\hat{i}{N}} + (-49)\mathbf{\hat{j}{N}} + (56)\mathbf{\hat{k}_{N}}$$

7*c -7*b

$$(63)\mathbf{\hat{i}{N}} + (-49)\mathbf{\hat{j}{N}} + (56)\mathbf{\hat{k}_{N}}$$

4*a +3*b

$$(26)\mathbf{\hat{j}_{N}}$$

-4*a -3*b

$$(-26)\mathbf{\hat{j}_{N}}$$

(a+b).magnitude()

$$\sqrt{65}$$