Re: [Jprogramming] Limit from the right

2013-03-05 Thread Aai
[.] Whereas... u limit v u (2 : '({~1 i.~[:(}.=}:)<.&.(1e10&*)) u y v 0.5^i.1076') v ... and, of course ;) u=. (4 %~ ]) * 3 o. (2 %~ o.1) * 1 - ] v=. + Y=. 0 u lim v Y 0.1591549430837225 u limit v Y |stack error: v | ({~1 i.~[:(}.=}:)<.&.(100&*))u y v 0.

Re: [Jprogramming] Limit from the right

2013-03-04 Thread Jose Mario Quintana
A numerical approach to finding limits is indeed tricky. I was coding a tacit version of Arie's conjunction... (9!:11) 16 NB. Setting the print precision ( lim=. (@:(&(".@:('(0.5^i.1076)'"_ ({~ (1 i.~ (}. = }:) @: (<.&.(1e11&*)))@:) ) (@: (&(".@:('(0.5^i.1076)'"_ (({~ (1 i.~ (}. = }

Re: [Jprogramming] Limit from the right

2013-03-02 Thread km
Raul, I have modified your adverb lim as follows: limr =: 1 : 0 lastgood =. ] {~ 0 i:~ 0 = y - y + ] u y + lastgood (1e_6*1>.|y)*0.5^i.1000 ) % limr 0 5.35754303593134e306 NB. _ >. limr 0 1 NB. 1 <. limr 0 0 NB. 0 %@^. limr 1 4.5035996273705e15 NB. _ %@^. limr 0 _

Re: [Jprogramming] Limit from the right

2013-03-02 Thread km
NB. work on limit from right of a function lim =: 1 : 'u 1e_11 * 1 + <. 1e11 * y' NB. Arne Groeneveld gave me this idea. NB. This version evaluates u at a value greater than y, never at y itself. NB. It attempts to approximate the limit from the right of u at y . % l

Re: [Jprogramming] Limit from the right

2013-03-02 Thread Aai
Different for me: 0=0.5^1022+i.5 0 0 0 0 0 and 0=0.5^1071+i.5 0 0 0 0 1 I noticed the following 0.5^1075 0 0.5^1074 4.94066e_324 and decided to use i.1076. On 02-03-13 16:58, km wrote: Arne, have you considered 0=0.5^1022+i.5 0 1 1 1 1 --Kip Sent from my iPad On

Re: [Jprogramming] Limit from the right

2013-03-02 Thread km
Arne, have you considered 0=0.5^1022+i.5 0 1 1 1 1 --Kip Sent from my iPad On Mar 1, 2013, at 6:45 AM, Aai wrote: > Here's a conjunction with the choice of left/right approach. > > It's like Raul's approach except it uses a bit more values and it compares > successive values up to a l

Re: [Jprogramming] Limit from the right

2013-03-02 Thread Aai
According to my description I have to formulate limit as follows: limit=: 2 :'({~1 i.~[:(}.=}:)<.&.(1e11&*)) u y v 0.5^i.1076' otherwise the values are cut off at 11 decimals. BTW 11 is a value obtained by experimenting with ((4%~])* 3 o. 1r2p1 * 1-]) as input. On 01-03-13 20:20, km wrote:

Re: [Jprogramming] Limit from the right

2013-03-01 Thread km
Thank you, Raul, especially for the "short form". I'll try at least the Wiki article. --Kip Sent from my iPad On Mar 1, 2013, at 7:50 AM, Raul Miller wrote: > For readers following along: > > IEEE 754 is a decent search term. > > Or, at least, it is for me - Google apparently customizes s

Re: [Jprogramming] Limit from the right

2013-03-01 Thread km
That's pretty good! Thank you, Arne. --Kip Sent from my iPad On Mar 1, 2013, at 6:45 AM, Aai wrote: > Here's a conjunction with the choice of left/right approach. > > It's like Raul's approach except it uses a bit more values and it compares > successive values up to a limited number of de

Re: [Jprogramming] Limit from the right

2013-03-01 Thread Jose Mario Quintana
I think the machine epsilon concept http://en.wikipedia.org/wiki/Machine_epsilon#Formal_definition ) is related to this thread discussion... (%&2^:(1 (~:!.0) 1 + %&2)^:_)1 NB. 2^_52 as expected 2.22044605e_16 On Fri, Mar 1, 2013 at 8:50 AM, Raul Miller wrote: > For readers following along: >

Re: [Jprogramming] Limit from the right

2013-03-01 Thread Raul Miller
For readers following along: IEEE 754 is a decent search term. Or, at least, it is for me - Google apparently customizes search results so I cannot know for sure that they give good, relevant results for everyone searching on that phrase (nor can I be sure whether anyone I care about will get dif

Re: [Jprogramming] Limit from the right

2013-03-01 Thread Aai
Here's a conjunction with the choice of left/right approach. It's like Raul's approach except it uses a bit more values and it compares successive values up to a limited number of decimals. limit=: 2 :'({~1 i.~(}.=}:))<.&.((10^11)&*) u y v 0.5^i.1076' tests: ((4%~])* 3 o. 1r2p1 * 1-]) lim

Re: [Jprogramming] Limit from the right

2013-02-28 Thread km
I remember that comparisons with 0 are exact 0 = N - N + epsilon 0 0 0 0 0 0 0 1 1 which agrees with your first report. No, I am unfamiliar with the IEEE structure, and am surprised by these results. --Kip Sent from my iPad On Feb 28, 2013, at 4:21 PM, Raul Miller wrote: > Are you fa

Re: [Jprogramming] Limit from the right

2013-02-28 Thread Raul Miller
Are you familiar with the structure of IEEE 754 floating point numbers? Consider, for example: epsilon=: 2^_44 N=: 10^i:4 NB. this result reflects IEEE-754's structure *N+epsilon-N 1 1 1 1 1 1 1 0 0 NB. this result reflects J's heuristic to deal with that structure N=N+epsilon

Re: [Jprogramming] Limit from the right

2013-02-28 Thread km
Here is what I did NB. right hand limit of a function lim =: 1 : 0 value =. u y + (2^_44) if. value <: - 2^40 do. __ elseif. value >: 2^40 do. _ elseif. do. value end. ) It does "reasonably well" but can be fooled, for example ] lim 2^40 _ Here it does better *: lim

Re: [Jprogramming] Limit from the right

2013-02-28 Thread Raul Miller
Here's a model implementation: lim=: (1 :0)("0) tests=. u ((1e_6*1>.|y)*0.5^i.1000)+y tests {~{.I.((1 }. 0&~:) * 2 ~:/\ ])(,2:)(*!.0)2 -/\ tests ) My assumptions are: (1) the limit in question is relatively stable (that my choices for epsilon are adequate) (2) that the result of limit sh

Re: [Jprogramming] Limit from the right

2013-02-27 Thread km
Can you write an adverb lim so that sin =: 1&o. (sin % ])lim 0 1 % lim 0 NB. limit is from right _ -@% lim 0 __ Kip Murray Sent from my iPad -- For information about J forums see http:/

Re: [Jprogramming] Limit from the right

2013-02-27 Thread Raul Miller
Numerical is a bit tricky - you need to understand how many bits of accuracy are retained by your calculation which in turn requires you to understand what it is that you are modeling. One approach, though [that often will work - not always, and it's interesting to think about the failure modes] i

Re: [Jprogramming] Limit from the right

2013-02-27 Thread km
Trying yet again so Ceiling displays properly. Sent from my iPad On Feb 27, 2013, at 3:54 PM, km wrote: > This may have been covered in another thread, but I invite you to write an > adverb lim such that > > sin =: 1&o. > (sin%])lim 0 > 1 > >. lim 0 > 1 > > -- that is, the lim

Re: [Jprogramming] Limit from the right

2013-02-27 Thread km
Trying again so Ceiling displays properly. Sent from my iPad On Feb 27, 2013, at 3:54 PM, km wrote: > This may have been covered in another thread, but I invite you to write an > adverb lim such that > >sin =: 1&o. >(sin%])lim 0 > 1 >>. lim 0 > 1 > > -- that is, the limit is the

[Jprogramming] Limit from the right

2013-02-27 Thread km
This may have been covered in another thread, but I invite you to write an adverb lim such that sin =: 1&o. (sin%])lim 0 1 >. lim 0 1 -- that is, the limit is the limit from the right. Kip Murray Sent from my iPad -