Re: [R] Finding Infimum in R

2017-04-10 Thread Boris Steipe
Here's my crossword-puzzle for the day: # A sample monotonous discontinuous function with a single root # (vectorized) F <- function(x) { return((as.numeric(x >= 0.112233445566778899) * 2) - 1) } discRoot <- function(xL, xR, F, k = 10) { # Return the interval containing a single root of

Re: [R] Finding Infimum in R

2017-04-10 Thread li li
Yes. If the function f takes the value zero at some discontinuity point, then the code gives the inf of the set I described. Otherwise, it is an approximation since we need to worry about numerical accuracy. 2017-04-10 14:08 GMT-04:00 Bert Gunter : > Well, I haven't checked carefully, but of cou

Re: [R] Finding Infimum in R

2017-04-10 Thread Bert Gunter
Well, I haven't checked carefully, but of course this does not find infs or sups at all, just mins or maxes in the sample, which are not the same. You'll have to do your own full testing and debugging, however. I do not provide such a service. -- Bert [[alternative HTML version deleted

Re: [R] Finding Infimum in R

2017-04-10 Thread Boris Steipe
Analytically speaking. But we are (presumably) looking for a numerical algorithm, and that is constrained by numerical accuracy, and in that realm we have 0.148296 on the left, and 0.703408 on the right. And the left-side representable number is what gets return

Re: [R] Finding Infimum in R

2017-04-10 Thread Peter Dalgaard
Er, 1/3, of course? (assuming that F is f). The infimum of a set is not necessarily a member of the set. -pd > On 10 Apr 2017, at 16:56 , Boris Steipe wrote: > > Well - the _procedure_ will give a result. > > But think of f(x) = {-1; x <= 1/3 and 1; x > 1/3 > > What should inf{x| F(x) >= 0}

Re: [R] Finding Infimum in R

2017-04-10 Thread Boris Steipe
Hannah - sorry if this is oblique. The problem is that the question as given is ill-posed (in the mathematical sense); all the more so since there is no guarantee that the numbers that define your discontinuities can even be exactly represented in a computer. This could both be fixed if you can

Re: [R] Finding Infimum in R

2017-04-10 Thread Bert Gunter
Yup, she can decide. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Apr 10, 2017 at 7:56 AM, Boris Steipe wrote: > Well - the _procedure_ will

Re: [R] Finding Infimum in R

2017-04-10 Thread Boris Steipe
Well - the _procedure_ will give a result. But think of f(x) = {-1; x <= 1/3 and 1; x > 1/3 What should inf{x| F(x) >= 0} be? What should the procedure return? > On Apr 10, 2017, at 10:38 AM, Bert Gunter wrote: > > Given what she said, how does the procedure I suggested fail? > > (Always

Re: [R] Finding Infimum in R

2017-04-10 Thread Bert Gunter
Given what she said, how does the procedure I suggested fail? (Always happy to be corrected). -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Apr

Re: [R] Finding Infimum in R

2017-04-10 Thread Rolf Turner
On 10/04/17 20:57, Boris Steipe wrote: Are you sure this is trivial? I have the impression the combination of an ill-posed problem and digital representation of numbers might just create the illusion that is so. Fortune nomination. cheers, Rolf -- Technical Editor ANZJS Department of Stat

Re: [R] Finding Infimum in R

2017-04-10 Thread Boris Steipe
Are you sure this is trivial? I have the impression the combination of an ill-posed problem and digital representation of numbers might just create the illusion that is so. B. > On Apr 10, 2017, at 12:34 AM, Bert Gunter wrote: > > Then it's trivial. Check values at the discontinuities and

Re: [R] Finding Infimum in R

2017-04-09 Thread Bert Gunter
Then it's trivial. Check values at the discontinuities and find the first where it's <0 at the left discontinuity and >0 at the right, if such exists. Then just use zero finding on that interval (or fit a line if everything's linear). If none exists, then just find the first discontinuity where it'

Re: [R] Finding Infimum in R

2017-04-09 Thread Boris Steipe
Is the function linear between the discontinuities? Can you give an example of how the function is specified? B. > On Apr 9, 2017, at 8:38 PM, li li wrote: > > Hi Burt, >Yes, the function is monotone increasing and points of discontinuity > are all known. > They are all numbers between 0

Re: [R] Finding Infimum in R

2017-04-09 Thread li li
Hi Burt, Yes, the function is monotone increasing and points of discontinuity are all known. They are all numbers between 0 and 1. Thanks very much! Hanna 2017-04-09 16:55 GMT-04:00 Bert Gunter : > Details matter! > > 1. Are the points of discontinuity known? This is critical. > > 2. Can