|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Non-negative results when solving a set of equationsDear Octave experts,
I have a set of equations (Ax = b) that I can solve with A\b. However, due to physical reasons, the result can not contain negative values (they should be zero in that case). I went through the manual and did a search, but found nothing that could help me. Maybe you know some function (or mathematical trick/solution) that would help me? Thanks! |
|
|
Re: Non-negative results when solving a set of equationsOn Tue, Jun 3, 2008 at 5:59 PM, Terje Hansen <T.A.r.hansen@...> wrote:
> > Dear Octave experts, > > I have a set of equations (Ax = b) that I can solve with A\b. > However, due to physical reasons, the result can not contain negative values > (they should be zero in that case). I went through the manual and did a > search, but found nothing that could help me. A bad search, then :) If you are not satisfied with simply setting the negative components of the solution to zero, look for function lsqnonneg. > Maybe you know some function (or mathematical trick/solution) that would > help me? > > Thanks! > -- -- RNDr. Jaroslav Hajek computing expert Aeronautical Research and Test Institute (VZLU) Prague, Czech Republic url: www.highegg.matfyz.cz _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Non-negative results when solving a set of equations>> I have a set of equations (Ax = b) that I can solve with A\b.
>> However, due to physical reasons, the result can not contain negative values >> (they should be zero in that case). I went through the manual and did a >> search, but found nothing that could help me. That depends on what you want. If you want to "solve" the equations, there is nothing to do, because you hav a single solution, provided that A is non-singular. If you want simply to set negative values to zero, you do: x=A\b; x(x<0)=0; >If you are not satisfied with simply setting the negative components of >the solution to zero, look for function lsqnonneg. Interesting. Is there a free implementation for Octave? -- Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111) ISTI - Area della ricerca CNR Fax: +39 050 315 2040 via G. Moruzzi 1, I-56124 Pisa Email: Potorti@... (entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/ _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Non-negative results when solving a set of equationsOn Thu, Jun 5, 2008 at 8:43 AM, Francesco Potorti` <Potorti@...> wrote:
>>> I have a set of equations (Ax = b) that I can solve with A\b. >>> However, due to physical reasons, the result can not contain negative values >>> (they should be zero in that case). I went through the manual and did a >>> search, but found nothing that could help me. > > That depends on what you want. If you want to "solve" the equations, > there is nothing to do, because you hav a single solution, provided that > A is non-singular. > > If you want simply to set negative values to zero, you do: > x=A\b; x(x<0)=0; > >>If you are not satisfied with simply setting the negative components of >>the solution to zero, look for function lsqnonneg. > > Interesting. Is there a free implementation for Octave? > lsqnonneg is already part of Octave. If it is not in 3.0.1 (I'm not sure now), it will be in 3.0.2. Can't comment further, I haven't seen the code and I have never used it. > -- > Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111) > ISTI - Area della ricerca CNR Fax: +39 050 315 2040 > via G. Moruzzi 1, I-56124 Pisa Email: Potorti@... > (entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/ > -- RNDr. Jaroslav Hajek computing expert Aeronautical Research and Test Institute (VZLU) Prague, Czech Republic url: www.highegg.matfyz.cz _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Non-negative results when solving a set of equationsOn 5-Jun-2008, Jaroslav Hajek wrote:
| lsqnonneg is already part of Octave. If it is not in 3.0.1 (I'm not | sure now), it will be in 3.0.2. It is in the main development branch, which will become the next stable release (3.1 or 3.2 depending on what we decide to do about version numbers). I don't plan to include it in any 3.0.x release. | Can't comment further, I haven't seen the code and I have never used | it. Ditto. jwe _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Non-negative results when solving a set of equationsOn Thu, Jun 5, 2008 at 2:02 PM, John W. Eaton <jwe@...> wrote:
> On 5-Jun-2008, Jaroslav Hajek wrote: > > | lsqnonneg is already part of Octave. If it is not in 3.0.1 (I'm not > | sure now), it will be in 3.0.2. > > It is in the main development branch, which will become the next > stable release (3.1 or 3.2 depending on what we decide to do about > version numbers). I don't plan to include it in any 3.0.x release. > Yes, that's what I meant, sorry. I dunno where I got the zeros from :) The minor versions are mostly bug fixes. > | Can't comment further, I haven't seen the code and I have never used > | it. > > Ditto. > > jwe > -- RNDr. Jaroslav Hajek computing expert Aeronautical Research and Test Institute (VZLU) Prague, Czech Republic url: www.highegg.matfyz.cz _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Non-negative results when solving a set of equationsOn 5 Jun 2008, at 08:43, Francesco Potorti` wrote: >>> I have a set of equations (Ax = b) that I can solve with A\b. >>> However, due to physical reasons, the result can not contain >>> negative values >>> (they should be zero in that case). I went through the manual and >>> did a >>> search, but found nothing that could help me. > > That depends on what you want. If you want to "solve" the equations, > there is nothing to do, because you hav a single solution, provided > that > A is non-singular. > > If you want simply to set negative values to zero, you do: > x=A\b; x(x<0)=0; > The solutions have a physical meaning. If one or more are zero, then these are not present physically in the system, and they have to be excluded. However, in that case the other values could change also, since one or more components are not present. >> If you are not satisfied with simply setting the negative >> components of >> the solution to zero, look for function lsqnonneg. > I will look for this. Thanks! _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
| Free embeddable forum powered by Nabble | Forum Help |