예제 #1
0
def main():
    Eprint()

    X = (x, y, z) = symbols('x y z', real=True)
    (o3d, ex, ey, ez) = Ga.build('e_x e_y e_z', g=[1, 1, 1], coords=(x, y, z))

    A = x * (ey ^ ez) + y * (ez ^ ex) + z * (ex ^ ey)
    print 'A =', A
    print 'grad^A =', (o3d.grad ^ A).simplify()
    print

    f = o3d.mv(1 / sqrt(x**2 + y**2 + z**2))
    print 'f =', f
    print 'grad*f =', (o3d.grad * f).simplify()
    print

    B = f * A
    print 'B =', B
    print

    Curl_B = o3d.grad ^ B

    print 'grad^B =', Curl_B.simplify()

    return
예제 #2
0
def main():
    Get_Program(True)
    #ga_print_on()
    Eprint()
    basic_multivector_operations()
    check_generalized_BAC_CAB_formulas()
    derivatives_in_rectangular_coordinates()
    derivatives_in_spherical_coordinates()
    rounding_numerical_components()
    noneuclidian_distance_calculation()
    conformal_representations_of_circles_lines_spheres_and_planes()
    properties_of_geometric_objects()
    extracting_vectors_from_conformal_2_blade()
    reciprocal_frame_test()

    #ga_print_off()
    return
예제 #3
0
def main():
    Eprint()
    (o3d, ex, ey, ez) = Ga.build('e*x|y|z', g=[1, 1, 1])

    u = o3d.mv('u', 'vector')
    v = o3d.mv('v', 'vector')
    w = o3d.mv('w', 'vector')
    print u
    print v

    uv = u ^ v
    print uv
    print uv.is_blade()

    exp_uv = uv.exp()
    print 'exp(uv) =', exp_uv

    return
예제 #4
0
def main():
    Get_Program()
    Eprint()
    Mv_setup_options()
    return
예제 #5
0
def main():
    Eprint()
    (o3d, ex, ey, ez) = Ga.build('e*x|y|z', g=[1, 1, 1])

    (r, th, phi, alpha, beta, gamma) = symbols('r theta phi alpha beta gamma',
                                               real=True)
    (x_a, y_a, z_a, x_b, y_b, z_b, ab_mag,
     th_ab) = symbols('x_a y_a z_a x_b y_b z_b ab_mag theta_ab', real=True)

    I = ex ^ ey ^ ez

    a = o3d.mv('a', 'vector')
    b = o3d.mv('b', 'vector')
    c = o3d.mv('c', 'vector')
    ab = a - b

    print('a =', a)
    print('b =', b)
    print('c =', c)
    print('ab =', ab)

    ab_norm = ab / ab_mag

    print('ab/|ab| =', ab_norm)

    R_ab = cos(th_ab / 2) + I * ab_norm * cos(th_ab / 2)
    R_ab_rev = R_ab.rev()
    print('R_ab =', R_ab)
    print('R_ab_rev =', R_ab_rev)

    e__ab_x = R_ab * ex * R_ab_rev
    e__ab_y = R_ab * ey * R_ab_rev
    e__ab_z = R_ab * ez * R_ab_rev

    print('e_ab_x =', e__ab_x)
    print('e_ab_y =', e__ab_y)
    print('e_ab_z =', e__ab_z)

    R_phi = cos(phi / 2) - (ex ^ ey) * sin(phi / 2)
    R_phi_rev = R_phi.rev()

    print(R_phi)
    print(R_phi_rev)

    e_phi = (R_phi * ey * R_phi.rev())

    print(e_phi)

    R_th = cos(th / 2) + I * e_phi * sin(th / 2)
    R_th_rev = R_th.rev()
    print(R_th)
    print(R_th_rev)

    e_r = (R_th * R_phi * ex * R_phi_rev * R_th_rev).trigsimp()

    e_th = (R_th * R_phi * ez * R_phi_rev * R_th_rev).trigsimp()

    e_phi = e_phi.trigsimp()

    print('e_r =', e_r)
    print('e_th =', e_th)
    print('e_phi =', e_phi)

    return
예제 #6
0
    Bh = B / NB
    ap = ebar - ((ebar ^ Bh) * Bh)
    a1 = ap + (ap * Bh)
    a2 = ap - (ap * Bh)
    #print '#a1 = ',a1
    #print '#a2 = ',a2
    return [a1, a2]


def norm(X):
    Y = sqrt((X * X).scalar())
    return Y


Get_Program(True)
Eprint()

g = '1 0 0 0, \
   0 1 0 0, \
   0 0 0 2, \
   0 0 2 0'

c2d = Ga('e_1 e_2 n \\bar{n}', g=g)
(e1, e2, n, nbar) = c2d.mv()

global n, nbar, I


def F(x):
    global n, nbar
    Fx = ((x * x) * n + 2 * x - nbar) / 2
예제 #7
0
def main():
    Get_Program()
    Eprint()
    coefs_test()
    return