Re: solving equation system
- From: "Carl Banks" <pavlovevidence@xxxxxxxxx>
- Date: 17 Jul 2006 18:16:52 -0700
TG wrote:
Sorry for the poor explanation. I'm trying to put it clear now.
i've got A and B. I'm looking for X. I made a mistake in my equation
:-/
It's more like :
A.X - B >= O
Well, maybe it will be much more simple if I explain the underlying
problem :
I have an array of N dimensions (generally 2).
- A first calculation gives me a set of integer coordinates inside this
array, which I will call the point W.
- After several other calculations, I've got a set of coordinates in
this N dimensional space that are floating values, and not bound to the
limits of my original N-array. This is the point L.
What I want to do is to translate the point L along the vector LW in
order to get a point L' which coordinates are inside the original
N-dimensional array. Then it will be easy to get the closest integer
coordinates from L'.
I see. You have a simple linear programming problem. These can be
tricky in general. Because you only have one variable, it's probably
ok to use brute force. Try this:
given X, A, and B:
E = A*X-B
C = numpy.where(E<0,B/A,X)
X = min(C)
This assumes that you've designed the problem such that B/A would be
less than X where A*X-B<0 (if the opposite were true then of course
you'd need max(C)).
Carl Banks
.
- References:
- solving equation system
- From: TG
- Re: solving equation system
- From: Ben C
- Re: solving equation system
- From: TG
- solving equation system
- Prev by Date: Re: run a string as code?
- Next by Date: Re: execute a shell script from a python script
- Previous by thread: Re: solving equation system
- Next by thread: Re: solving equation system
- Index(es):
Relevant Pages
|