Re: [sage-support] equation solution in integer

2020-04-19 Thread Pedro A. Garcia
Yes, @vdelecroix, in these cases this might be a very good option. 

sage: list( [x,y] for x in range(1,10) for y in range(1,10) if x+y==15)
[[6, 9], [7, 8], [8, 7], [9, 6]]

For a more general setting, normaliz, 4ti2 and other approaches are better; 
some are available in sage as pointed above.

On Sunday, April 19, 2020 at 10:40:22 AM UTC+2, vdelecroix wrote:
>
> In this particular instance, I would rather write down the loop. 
> It is not hard to make the loop general for any bound on x and 
> y and any sum. 
>
> sum = 15 
> xmin = 1 
> xmax = 9 
> ymin = 1 
> ymax = 9 
> for x in range(max(xmin, sum-ymax), min(xmax, sum-ymin)+1): 
>  print(x, sum-x) 
>
> which does run through 
>
> 6 9 
> 7 8 
> 8 7 
> 9 6 
>
>
> Le 17/04/2020 à 18:55, Bert Henry a écrit : 
> > I have the equation 
> > x + y = 15 
> > an I'm looking for solution only in the range x=1..9 and y=1..9, x and y 
> > both integer 
> > Is there a sage-command to do that? 
> > 
> > Thanks in advance 
> > Bert Henry 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/76e034a0-558a-4cc3-9161-18013af2634f%40googlegroups.com.


Re: [sage-support] equation solution in integer

2020-04-19 Thread Vincent Delecroix

In this particular instance, I would rather write down the loop.
It is not hard to make the loop general for any bound on x and
y and any sum.

sum = 15
xmin = 1
xmax = 9
ymin = 1
ymax = 9
for x in range(max(xmin, sum-ymax), min(xmax, sum-ymin)+1):
print(x, sum-x)

which does run through

6 9
7 8
8 7
9 6


Le 17/04/2020 à 18:55, Bert Henry a écrit :

I have the equation
x + y = 15
an I'm looking for solution only in the range x=1..9 and y=1..9, x and y
both integer
Is there a sage-command to do that?

Thanks in advance
Bert Henry



--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/28ad653e-61af-bd18-73e3-e58df1bf282a%40gmail.com.


[sage-support] equation solution in integer

2020-04-17 Thread Bert Henry
I have the equation
x + y = 15
an I'm looking for solution only in the range x=1..9 and y=1..9, x and y 
both integer
Is there a sage-command to do that?

Thanks in advance
Bert Henry

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/7b07e20b-621d-4afd-8265-3e4388cf8c2a%40googlegroups.com.