#!/usr/bin/env python3 # https://www.youtube.com/watch?v=L68VR5VuwnI&t=1h6m15s # https://guide.handmadehero.org/code/day376/#3975 from sympy import * vec = lambda v: [Symbol(f'{v}_{i}') for i in range(1, 3+1)] dot = lambda a, b: sum(a_i * b_i for a_i, b_i in zip(a, b)) a = vec('a') b = vec('b') c = vec('c') eqs = [ Eq(dot(a, c), 0), Eq(dot(b, c), 0), Eq(dot(c, c), dot(a, a) * dot(b, b) - dot(a, b) * dot(a, b)), ] sols = solve(eqs, *c, dict=True) for sol in sols: pprint(sol)