1

I'm trying to find the zeroes of functions within the range [0,1]. My functions are generally looking something like this:

F(t)=2*sin(8*Pi*t)+2*sin(2*Pi*t)-1

The naive method I've tried so far is getting a very crude plot of the function into Pari, plot(t=0,1,F(t)), and from there 'guesstimating' a small range [a1,a2] for where the first zero would be. I've then been using solve(t=a1,a2,F(t)) to find that zero. Then finding a second small range [a2,a3], and repeating, until I find all zeroes.

Obviously not a great method, but it's done the job, and many examples I'd looked at so far only had a couple of zeroes. However, examples I'm looking at now (like the F(t) I've defined above), have many more zeroes, so I'm looking for a quicker method.

I'm aware of solvestep, but I've tried using this and it never returns any solutions. I'm guessing this type of function isn't really suitable for the splitting method it uses (or potentially I'm using it wrong..).

Is there any nice way I can get the zeroes of this function in [0,1] returned without having to go through this long, naive method?

Mystery_Jay
  • 161
  • 5
  • 1
    I'm not sure there is any general purpose method for root solving that works on any function (I won't attempt to answer). However is this just a usage issue? 'solvestep(t=0, 1, 0.1, F(t))' gives me four answers and 'solvestep(t=0, 1, 0.01, F(t))' gives me six answers (seemingly all of them) instantly. Whilst I would agree that having to choose a step parameter means solutions could be missed this is really inherent in the problem - some mathematical analysis of the definition of F is necessary. – Andrew Jul 12 '19 at 15:56
  • @Andrew I must admit, I was unaware that when using ```solvestep(X=a,b,step,expr)```, that the ```step``` parameter could be a non-integer value (I had only ever used it and seen examples when it was an integers and that was fine). That at least gives me something more useful to go on, though - thanks for your help! – Mystery_Jay Jul 16 '19 at 12:00
  • I presume `solvestep` computes the function at intervals of the `step` parameter between `a` and `b` and where there is a change of sign it searches for the zero. Glad to be of help! – Andrew Jul 16 '19 at 19:20

0 Answers0