Re: Solving vector equations; is this possible?

Ralf Hemmecke <[email protected]> Fri, 01 Jun 2012 10:01:57 +0200
Newsgroups gmane.comp.mathematics.axiom.user
Message-ID <[email protected]>
On 06/01/2012 09:37 AM, Victor Eijkhout wrote:
> Can someone tell me if the following can be solved in Axiom, and hence
> whether I should bother learning the system?
>
> I have two equations in vectors of arbitrary dimension: z = y + ax (a is
> scalar, x,y,z vector) & p^t z = 0
> (p another vector). Vectors x,y,p are known, vector z and scalar a are
> unknown. Assume no two known vectors are orthogonal.
>
> The solution of this isz = y + a x where a = -(p^t y) / (p^t x).
>
> Is this expressible and solvable in Axiom?

If I understood your problem correctly then you can do it as follows.
Of course you can use that in any dimension.

Ralf

(1) -> V := Vector Fraction Integer

    (1)  Vector(Fraction(Integer))
 
Type: Type
(2) -> x: V := [1,2,3]

    (2)  [1,2,3]
                            Type: Vector(Fraction(Integer))
(3) -> y: V := [4,5,6]

    (3)  [4,5,6]
                            Type: Vector(Fraction(Integer))
(4) -> p: V := [7,8,9]

    (4)  [7,8,9]
                            Type: Vector(Fraction(Integer))
(5) -> n := dot(p, y)

    (5)  122
                            Type: Fraction(Integer)
(6) -> d := dot(p, x)

    (6)  50
                            Type: Fraction(Integer)
(7) -> a := -n/d

           61
    (7)  - --
           25
                            Type: Fraction(Integer)
(8) -> z := y+a*x

          39  3   33
    (8)  [--,--,- --]
          25 25   25
                            Type: Vector(Fraction(Integer))