From: Magnus Lie Hetland <magnus@he...>  20040727 15:27:11

Andre Wobst <wobsta@...>: > [snip] > BTW: I didn't wrote a linear equation solver, but what I did was > exactly a "variable class" and the "linear equations behind the > scenes", i.e. building up linear terms. To actually solve the linear > equations I used Numeric in my sample code already. I noticed that when I looked at the code :) I've actually seens some similar code somewhere else before (the code I mentioned earlier)  and I've written similar things too (also related to logic programming and the like). Seems like (possibly) a reasonable approach. > > Certainly. It would also be neat to be able to use parametrized curve= s > > in the same system, as in MetaPost; but I guess it's not quite that > > critical, as you already have support for finding intersections > > in PyX. >=20 > Finding intersections etc. is usually a nonlinear operation. But you > can define points by that ... sure. I guess it will be similar to > MetaPost in that respect (though I'm not quite sure right now). I don't know how MetaPost does it either. I know the curves are nonlinear... I just (na=EFvely ;) thought that, perhaps, through some transformational magic the problem could be solved within the same framework of linear equations. I guess finding out how MetaPost actually does this might be quite useful. [snip] > Say p and p' are (2d) points, and t is a transformation (i.e. a 2x2 > matrix + a 2d vector). Then you can write >=20 > p' =3D t(p) >=20 > Once you say p' and p are lazy vectors (i.e. they contain 2 variables) > as well as t is a lazy transformation (i.e. it contain 6 variables), > than the equation above is nonlinear. There are nonlinear terms in > matrix times vector when they both contain variables. Right  you're basically saying that this isn't linear in the elements of the transform? But if we freeze the transform it is linear in p' and p...? > So I think what one has to do is to postpone this nonlinear equation > until the nonlinear terms are solved by other constraints. I guess, > thats what MetaPost does as well ... as soon as p or t gets defined > somewhere else, the equation above becomes linear. Well, you certainly can't solve an underdetermined set of equations anyway, whether they're linear or not :) I guess the problem will be writing it up as a set of linear equations (i.e. in matrix form). What you're saying is that we can't really do this before either p, p' of t has been determined by other means? This seems quite muddled. I'm not very tempted to read the MetaPost source code to find out how they do it either; I guess maybe I can snoop around and see if I find some other pointers on how to do this sort of thing. Does anyone know of any other systems/sources of information than MetaPost? > > Anyway, writing a system like this based on linear equations is a > > bit more work than a oneway functionbased one. I'll have a look > > but I can't promise anything. >=20 > Sure, nobody does. But we might have a starting point now ... and > maybe somebody is really interested in this. Well, I'd be very interested in having it available :] > Its not top priority for me, but well, on the other hand, I already > like it ... we can get something really funny quite quickly I guess. I guess. The problem is laying the foundation in such a way as not to proclude the kind of future development we might want (e.g. full linear equation solver linked to parametric curves and transforms) without falling into the paralyzing trap of hypergeneralization (which I know all to well  and I've got the scars to prove it ;) I'll think a bit about whether it's possible to a very simple thing here (a "Smallest Thing That Could Possibly Work" kind of thing)  beyond what we already have, of course. > Andr=E9 =20 Magnus Lie Hetland "Canned Bread: The greatest thing since sliced http://hetland.org bread!" [from a can in Spongebob Squarepants] 