Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6021

Re: FindInstance with all positive numbers

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: FindInstance with all positive numbers
Date 2011-10-30 09:24 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j8j54t$f27$1@smc.vnet.net> (permalink)
References <201110291113.HAA05435@smc.vnet.net>

Show all headers | View raw


variables = Table[Unique[\[Alpha]], {i, 10}];
variables /.
  FindInstance[Total@variables == 5 && And @@ Thread[variables > 0],
   variables]

{{5/512, 5/2, 5/4, 5/8, 5/16, 5/32, 5/64, 5/128, 5/256, 5/512}}

or

variables = Array[Unique[\[Alpha]] &, {10}];
variables /.
  FindInstance[Total@variables == 5 && And @@ Thread[variables > 0],
   variables]

{{5/512, 5/2, 5/4, 5/8, 5/16, 5/32, 5/64, 5/128, 5/256, 5/512}}

Bobby

On Sat, 29 Oct 2011 06:13:34 -0500, Arthur Grabovsky <shukrri@gmail.com>  
wrote:

> Hi,
>
> To ensure FindInstance[] returns all positive numbers I would do:
>
> FindInstance[a+b=5&&a>0&&b>0,{a,b}];
>
> However I need to do the same but without having to list all individual  
> variables. The reason is that I will be iterating through lists with a  
> large, variable number of elements so writing out a>0&&b>0 all the way  
> until z>0 is impractical.
>
> Thanks.
>


-- 
DrMajorBob@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: FindInstance with all positive numbers DrMajorBob <btreat1@austin.rr.com> - 2011-10-30 09:24 +0000

csiph-web