On Jul 16, 1:33 am, Johannes <dajo.m...@web.de> wrote:
> a very easy example would be this:
>
> sage: p1 = vector([-3,1,1])
> sage: p2 = vector([1,-3,1])
> sage: p = vector([0,-2,1])
>
> #now i'm looking for some x,y such that
> #x * p1 + y * p1 == p
>
> x,y = var('x,y')
> sage: assume(x > 0)
> sage: assume(y > 0)
> sage: solve([x * p1 + y * p2 == p],x,y)
> []
>
> #but: x = 1/4 and y = 3/4 is a solution of this equation.
>
> in the end i need this kind of calculation for every latticepoint on the
> border of a lattice-simplex. like the example above shows how it should
> work for a line, it also should be extendable to n+1 points on each n
> dimensional facet of the simplex, where the points p0,....,pn are given
> as the vertices of the facet.
>
> greatz Johannes

This is a linear algebra problem. You have a vector p that is a linear
combinations of others p1,p2 and you want the coordinates of p in
terms of B. This is only a change of basis problem. Assuming that the
points of B form a basis of the linear span of B you can do:

sage: m = matrix([p1,p2])
sage: m.solve_left(p)
(1/4, 3/4)

The rows of m are the vectors p1 and p2. You want to express p as
combination of these rows.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to