Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Jimmy Gauvin
The construction of the sphere implies it cannot be convex but you will have to find a topologist to prove it to you. The sphere is the collection of points whose distance to the origin is equal to the radius of the sphere. The ball or volume is comprised of the points whose distance to the origi

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Jimmy Gauvin
No zeroes for sec or csc, from the definition: csc A = 1 / (sin A) sec A = 1 / (cos A) cot A = 1 / (tan A) sin and cos vary from 1 to -1 passing by zero so there is no way of getting a zero from 1/sin or 1/cos tan on the other hand varies from plus infinity to minus infinity so you obtain zeroes

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread bill lam
Has the n-sphere become concave in higher dimension? Вт, 15 авг 2017, Jimmy Gauvin написал(а): > Funny how the n-Sphere volume dwindles for the higher dimensions. > Not quite intuitive but the factorial always "win" even with bigger radii. > > The hypercubes do not share this characteristic (V= e

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Linda Alvord
Thanks Raul. It shows that I haven't used J for any trig in aboug 20 years. Here is almost what I want. Hoever the cot looks good. Shouldn't there be some 0's in the sec and csc? *(%"0)3 2 1 (o."0 1) t 1 1 1 1 0 _1 _1 _1 _1 1 1 1 0 _1 _1 _1 _1 1 1 1 1 1 _1 _1 _1 _1 _1 _1 _1 _1 1 1 1

Re: [Jprogramming] "diagonals"

2017-08-15 Thread Louis de Forcrand
Yes; I began writing the message but had to leave unexpectedly. Let me explain what I want for a rank 2 array: Given the index vector I of an element of the array and its shape, I want all the elements in lines which are horizontal, vertical, or diagonal, and which pass through I. In addition, ele

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Vijay Lulla
Maybe https://www.youtube.com/watch?v=uU_Q2a0S0zI&index=9&list=PL2FF649D0C4407B30 especially at 28 minute marker in the video discusses this very issue. I recommend the rest of the videos in the list too. Thanks, Vijay. On Tue, Aug 15, 2017 at 4:52 PM, Don Guinn wrote: > Just had to try it. > >

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Don Guinn
Just had to try it. plot 1 sphvol i:30 Don't know if it even makes any sense, but the plot is curious. On Tue, Aug 15, 2017 at 2:27 PM, Jimmy Gauvin wrote: > Funny how the n-Sphere volume dwindles for the higher dimensions. > Not quite intuitive but the factorial always "win" even with bigge

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Jimmy Gauvin
Funny how the n-Sphere volume dwindles for the higher dimensions. Not quite intuitive but the factorial always "win" even with bigger radii. The hypercubes do not share this characteristic (V= edge ^ n) On Tue, Aug 15, 2017 at 3:33 PM, Ben Gorte - CITG wrote: > A little surprise (to me) was >

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Raul Miller
It loses accuracy somewhere between n=150 and n=200. Keep in mind though that the dimensions of these "volumes" are not comparable. Each "n-volume" of dimension n-1 is "paper thin (or thinner)" than the "n-volume" of dimension n. That said, I have not sat down and verified the results by hand, I

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Jan-Pieter Jacobs
Nice sentence. Is it accurate for higher dimensions too? To me it seems a bit counterintuitive that after n=6, the n-volume rapidly declines until almost zero. For instance: load 'plot' plot 1 sphvol i. 100 Best regards, Jan-Pieter On 15 Aug 2017 7:55 p.m., "Raul Miller" wrote: >sphvol=:

Re: [Jprogramming] "diagonals"

2017-08-15 Thread Raul Miller
I am having problems understanding what you are asking for. I'll try creating some examples which represent my understanding of what you seem to be asking for, and maybe that can help you tell me where I've gone off track: "Given an array index vector i," For example: i=: i.4 5 "how would yo

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Ben Gorte - CITG
A little surprise (to me) was plot 1 sphvol i.30 (for example) Can you predict it? greetings, Ben From: Programming [programming-boun...@forums.jsoftware.com] on behalf of Raul Miller [rauldmil...@gmail.com] Sent: Tuesday, August 15, 2017 19:55 To: P

Re: [Jprogramming] Quora problem

2017-08-15 Thread Raul Miller
In this case? I'd probably use ;: but for the general case it's probably safer to use <"1 (if I understand your intent properly). Thanks, -- Raul On Tue, Aug 15, 2017 at 2:40 PM, Skip Cave wrote: > How could you box each string? > > Skip Cave > Cave Consulting LLC > > On Tue, Aug 15, 2017 at

[Jprogramming] "diagonals"

2017-08-15 Thread Louis de Forcrand
Hi, Given an array index vector i, how would you go about finding efficiently all indices (or elements at them) of an array for which the index in each dimension is either the same as that in i, or is offset by +/- n, where n is the same for all dimensions, and keep them grouped by “direction”? I

Re: [Jprogramming] Quora problem

2017-08-15 Thread Skip Cave
How could you box each string? Skip Cave Cave Consulting LLC On Tue, Aug 15, 2017 at 12:07 PM, Raul Miller wrote: > I'd meet that specification like this: > > require'stats' > perms=: A.&i.~ ! > > gen=:4 :0 > x{~,/(perms y){"1/y comb #x > ) > > But note that the result format is different. >

[Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Raul Miller
sphvol=: (1p1&^%!)@-:@] * ^ 1 sphvol 3 4.18879 1 sphvol i.7 1 2 3.14159 4.18879 4.9348 5.26379 5.16771 Left argument is the radius of the "n-sphere". Right argument is the number of dimensions. I put "n-volume" in quotes, because if the dimension is 2 (for example), the "n-volume" is wh

Re: [Jprogramming] Quora problem

2017-08-15 Thread 'Pascal Jasmin' via Programming
Raul's solution was much faster than my original, though my argument to perm was not a constant,  so one alternative # 10 #."1 /:~  ,/ (perm@#@{. {"_ 1 ]) 3 >:@:comb 9504 From: Jimmy Gauvin To: programm...@jsoftware.com Sent: Tuesday, August 15, 2017 1:47 PM Subject: Re: [Jprogramming]

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Raul Miller
Or you could do: cot=: %@(tan=: 3&o.) sec=: %@(cos=: 2&o.) csc=: %@(sin=: 1&o.) Thanks, -- Raul On Tue, Aug 15, 2017 at 1:11 PM, Jimmy Gauvin wrote: > Hi, > > problem is with 4 5 6 which denote the following: > >coh=: 4&o.NB. sqrt (1+(y^2)) >sinh=: 5&o. NB. hyperbolic s

Re: [Jprogramming] Quora problem

2017-08-15 Thread Jimmy Gauvin
Completely agree with Skip as I'm also at the beginning of the learning curve. One of the idioms that really amazed me is the way Raul does the selection of the combinations with the permutations using the table verb: (perms 3) {"1 /1+3 comb 9 I was working along similar lines with this sele

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Jimmy Gauvin
Sorry for the mangled output, this should be better: cot *A* = 1 / (tan *A*) sec *A* = 1 / (cos *A*) csc *A* = 1 / (sin *A*) @Don The inverses are the arc functions and have different definitiions On Tue, Aug 15, 2017 at 1:12 PM, Don Guinn wrote: > Negative left number gives inverses. > >

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Don Guinn
Negative left number gives inverses. 1 o.1 0.841471 _1 o.1 1.5708 _1 o. 1 o. 1 1 On Tue, Aug 15, 2017 at 11:01 AM, Raul Miller wrote: > Which rows are cotangent, secant and cosecant? > > (I see sine, cosine, tangent, square root, hyperbolic sine and > hyperbolic cosine.) > > Thanks, >

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Jimmy Gauvin
Hi, problem is with 4 5 6 which denote the following: coh=: 4&o.NB. sqrt (1+(y^2)) sinh=: 5&o. NB. hyperbolic sine of y cosh=: 6&o. NB. hyperbolic cosine of y see: http://code.jsoftware.com/wiki/Vocabulary/odot#dyadic There dosen't seem to be specific numbers for co

Re: [Jprogramming] Quora problem

2017-08-15 Thread Raul Miller
I'd meet that specification like this: require'stats' perms=: A.&i.~ ! gen=:4 :0 x{~,/(perms y){"1/y comb #x ) But note that the result format is different. Thanks, -- Raul On Tue, Aug 15, 2017 at 12:58 PM, Skip Cave wrote: > I believe that the general case would be: > Design a J verb tha

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Raul Miller
Which rows are cotangent, secant and cosecant? (I see sine, cosine, tangent, square root, hyperbolic sine and hyperbolic cosine.) Thanks, -- Raul On Tue, Aug 15, 2017 at 12:41 PM, Linda Alvord wrote: > > > Sent from AOL Mobile Mail > > > From: Linda Alvord > Date: Tuesday, August 15, 2017 >

Re: [Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread 'Mike Day' via Programming
Linda, according to the vocab, 1 2 3 4 5 6 o. are respectively sin cos tan (>:&.*:) sinh cosh OK? Mike On 15/08/2017 17:41, Linda Alvord wrote: Sent from AOL Mobile Mail From: Linda Alvord Date: Tuesday, August 15, 2017 Subject: FW: why are there no negative signs for cot,sec and csc?

Re: [Jprogramming] Quora problem

2017-08-15 Thread Skip Cave
I believe that the general case would be: Design a J verb that will generate all possible unique strings of a specific fixed length using only specified set of symbols, where each generated string has no repeated symbols. x gen y Where x specifies a set of symbols (characters, numbers), and y

[Jprogramming] Fwd: FW: why are there no negative signs for cot, sec and csc?

2017-08-15 Thread Linda Alvord
Sent from AOL Mobile Mail From: Linda Alvord Date: Tuesday, August 15, 2017 Subject: FW: why are there no negative signs for cot,sec and csc? Cc: lindaalvord      From: Linda Alvord [mailto:lindaalv...@verizon.net] Sent: Tuesday, August 15, 2017 11:22 AM To: 'programm...@jsoftware.com'

Re: [Jprogramming] Quora problem

2017-08-15 Thread Don Guinn
For really big problems you could go to a larger base than 10 like hexadecimal. Or even bigger using more letters. On Tue, Aug 15, 2017 at 10:10 AM, Raul Miller wrote: > To compare them for equality you need to sort them. > > However, the task was to generate the integers. > > (If the example li

Re: [Jprogramming] Quora problem

2017-08-15 Thread Raul Miller
To compare them for equality you need to sort them. However, the task was to generate the integers. (If the example list of numbers was a part of the specification then we probably should not be considering seven digit integers as relevant.) Thanks, -- Raul On Tue, Aug 15, 2017 at 10:37 AM, A

Re: [Jprogramming] Quora problem

2017-08-15 Thread 'Mike Day' via Programming
I agree Groeneveld's solution is elegant and it's certainly more efficient for larger problems, My approach was the result of a couple of minutes thought; it turned out to be quite adequate for Skip's original requirement. Consider the count of such n-digit numbers, nq =: ! * !&9 nq 1 2 3

Re: [Jprogramming] Quora problem

2017-08-15 Thread Arie Groeneveld
To compare both you need to do the following: 10 ts 'R=./:~,10#.(perms 7){"1/1+7 comb 9' 0.0288779 2.4132e7 10 ts 'G=.,10 #. ((],"1 0 -."1)^:6 ,.)1+i.9' 0.0258377 2.30737e7 R-:G 1 Looks like a draw. Op 15-08-17 om 16:16 schreef Raul Miller: I cannot comment on elegance, but I can dis

Re: [Jprogramming] Quora problem

2017-08-15 Thread Raul Miller
I cannot comment on elegance, but I can disagree about the efficiency issue: timespacex ',10#.(perms 7){"1/1+7 comb 9' 0.015591 2.15104e7 timespacex '10 #. (,/@:(],"1 0 -."1)^:6 ,.)1+i.9' 0.036695 3.7755e7 Thanks, -- Raul On Tue, Aug 15, 2017 at 9:53 AM, R.E. Boss wrote: > I suggest y

Re: [Jprogramming] Quora problem

2017-08-15 Thread R.E. Boss
I suggest you use larger numbers for your performance tests. (10#.(#~(-:~.)"1) >: 9#.inv i. 9^6)-: 10 #.(,/@:(],"1 0 -."1)^:5 ,.)>:i.9 1 ts'10#.(#~(-:~.)"1) >: 9#.inv i. 9^6' 0.39192919 1.7905766e8 ts'10 #.(,/@:(],"1 0 -."1)^:5 ,.)>:i.9' 0.010126433 9442816 The Groeneveld solution is mor