Dear Saad,

It happens that I want to find more than one root numerically, then I use 
brute force as in code below. It is not possible to 
have any general heuristics for arbitrary function about where its roots 
are, so if one knows more about the function in some special case
 then the interval generation can be adapted to reflect this knowledge.

zeros = []
xmin = -1
xmax = 1
f = sin(1/x)-x
intv = srange(xmin,xmax,(xmax-xmin)/150)
for x1,x2 in zip(intv,intv[1:]):
    try:
        rt = find_root(f,x1,x2 )
        zeros.append(rt)
    except:
        pass

That is all.

mk


On Monday, March 19, 2018 at 9:45:53 PM UTC+1, saad khalid wrote:
>
> So what is likely the difference between how Sage solves this problem and 
> how Mathematica solves this problem that makes Mathematica show more 
> solutions? 
>
> On Friday, March 16, 2018 at 4:31:33 AM UTC-5, Dima Pasechnik wrote:
>>
>> This makes sense. It most probably has a pre-set minimal interval length, 
>> so it stops splitting at certain moment.
>
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to