Re: [sage-support] Two basic questions

2010-09-05 Thread Philipp Schneider
Hi, > Q2. How can I define the set of all primes up to some limit N but > excluding 2 and multiples of some number D? Try this: sage: N=100 sage: D=5 sage: [i for i in primes(3,N+1) if not i.divides(D)] [3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] Gr

Re: [sage-support] Two basic questions

2010-09-05 Thread Philipp Schneider
Hi, > Q1. How can I extract elements from a solution set? > > For example, consider: > > sage: x, y = var('x, y') > sage: solve([x+y==6, x-y==4], x, y) > [[x == 5, y == 1]] Like this: sage: sol = solve([x+y==6, x-y==4], x, y) sage: sol[0] [x == 5, y == 1] sage: sol[0][0] x == 5 sage: sol[0][0].r

[sage-support] Two basic questions

2010-09-05 Thread Nick
Q1. How can I extract elements from a solution set? For example, consider: sage: x, y = var('x, y') sage: solve([x+y==6, x-y==4], x, y) [[x == 5, y == 1]] How can I extract these values for x and y so that I can, for instance, use them as the coefficients for a polynomial f(t)=x+ty so that I hav