Ask Your Question

Pavel Yartsev's profile - activity

2013-08-04 14:46:20 -0500 answered a question How to get sage to NOT calculate

You can just use strings. Nothing fancy just printing out exactly what you want.

sage: a = 2
sage: b = 3
sage: print str(a)+"+"+str(b)
2013-07-31 07:05:13 -0500 commented answer Find minimum value of polynomial

You have to remember that: f.find_minimum_on_interval(0,1) does NOT include the end points. This call on f(x) = (x-3)*(x+2)^2 will produce these results: (-17.99999991390072, 0.99999997130024143) While over the interval [0,1] the minimum is located at x=1 If you want to include the endpoints you would need to write something like this: min(f(0), f.find_minimum_on_interval(0,1)[0], f(1))

2013-07-27 15:44:49 -0500 commented answer find_root return values

Just in case you are interested; there is a root function which does this already with a lot higher precision and more options. def find_all_roots(func,a,b): assume( x>=a , x<=b) try: roots = [cp for cp in (func==0).roots(x, ring=RR, multiplicities=False)] except: roots = [ ] return roots find_all_roots((x+x^2-10), -10,10) returns: [-3.70156211871642, 2.70156211871642] find_all_roots((x^2+1), -10, 10) returns: [ ] (sry about the bad spacing, not sure how to format the text here yet)

2013-07-27 14:42:51 -0500 commented answer How to get all (numerical) solutions of an equation?

You may also select only the real portion of the answer: by doing something like : [ (real(cp)) for cp in (eq).roots(x, ring=CC, multiplicities=False)] . This will remove the imaginary portion of the answer.

2013-07-27 14:42:20 -0500 received badge  Supporter (source)