Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6035 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2011-10-30 09:21 +0000 |
| Last post | 2011-10-30 09:21 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: FindInstance with all positive numbers Bob Hanlon <hanlonr357@gmail.com> - 2011-10-30 09:21 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2011-10-30 09:21 +0000 |
| Subject | Re: FindInstance with all positive numbers |
| Message-ID | <j8j4v5$eud$1@smc.vnet.net> |
eqn = a + b + c + d == 15;
var = Variables[eqn[[1]]];
cond = And @@ Thread[var > 0];
FindInstance[eqn && cond, var]
{{a -> 15/8, b -> 15/2, c -> 15/4, d -> 15/8}}
Bob Hanlon
On Sat, Oct 29, 2011 at 7:13 AM, 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.
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web