Make Expression.subs() always return a LinExpr instance
[linpy.git] / examples / bac2014.py
1 #!/usr/bin/env python3
2
3 # This example is inspired from a math question in the French baccalauréat 2014,
4 # consisting in computing the intersection of a plane with a line.
5
6 from linpy import *
7
8 x, y, z = symbols('x y z')
9 plane = Eq(x, y) & Eq(z, 6 - 2*x)
10 line = Eq(x + y - 2*z, 0)
11
12 if __name__ == '__main__':
13 print('plane: ', plane)
14 print('line: ', line)
15 print('intersection:', plane & line)