[Jprogramming] Crash with p.

2023-02-03 Thread Schmidt-Gröttrup , Markus
A numerical error crashes J

p. _1E10 _1 0 0 1
works

  p. _77 _1 0 0 0 1
works
  p. _78 _1 0 0 0 1
crashes

  p. _14 _1 0 0 0 0 1
works
  p. _15 _1 0 0 0 0 1
crashes

  p. _8 _1 0 0 0 0 0 1
crashes
  p. _7 _1 0 0 0 0 0 1
works

Version used:
J807/j64/windows

Greetings, Markus

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] sqlupdate

2019-11-30 Thread Schmidt-Gröttrup , Markus
Thank you, Chris, worked immediately. 

-Ursprüngliche Nachricht-
Von: Programming  Im Auftrag von 
chris burke
Gesendet: Samstag, 30. November 2019 13:19
An: Programming forum 
Betreff: Re: [Jprogramming] sqlupdate

j805 has an earlier version of the sqlite addon with no sqlupdate function.
For an update you need to construct a SQL expression and run that, e.g.
something like

 sqlcmd__db 'update tab set d="elmo" where rowid=7'

On Sat, Nov 30, 2019 at 3:26 AM Schmidt-Gröttrup, Markus < 
m.schmidt-groett...@hs-osnabrueck.de> wrote:

>   I am wondering what is wrong with the surrounding such that  
> sqlupdate is not available, when other sql-verbs are.
>
>
>   load 'data/sqlite'
>
>  db=. sqlopen_psqlite_ AVDB,'/aufgaben.sqlite3'
>
>  sqlupdate__db
>
> |value error: sqlupdate__db
>
>  sqlinsert__db
>
> 3 : 0
>
> 'tab nms dat'=. y
>
> if. 0 e. $dat do. 0 return. end.
>
> if. 0 e. $nms do. nms=. sqlcols tab end.
> ...
>
>I am running  j805/j64/windows.
>   Thanks for your help.
>
> Markus
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] sqlupdate

2019-11-30 Thread Schmidt-Gröttrup , Markus
  I am wondering what is wrong with the surrounding such that  sqlupdate is not 
available, when other sql-verbs are.


  load 'data/sqlite'

 db=. sqlopen_psqlite_ AVDB,'/aufgaben.sqlite3'

 sqlupdate__db

|value error: sqlupdate__db

 sqlinsert__db

3 : 0

'tab nms dat'=. y

if. 0 e. $dat do. 0 return. end.

if. 0 e. $nms do. nms=. sqlcols tab end.
...

   I am running  j805/j64/windows.
  Thanks for your help.

Markus

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Intersection and Union of (multi)sets

2018-10-30 Thread Schmidt-Gröttrup , Markus
Should be 

IS=:+./&.([:q:^:_1 p:) NB. Intersection

UN=:*./&.([:q:^:_1 p:) NB. union

Markus S.-G.

-Ursprüngliche Nachricht-
Von: Programming  Im Auftrag von Don 
Guinn
Gesendet: Dienstag, 30. Oktober 2018 15:46
An: Programming forum 
Betreff: Re: [Jprogramming] Intersection and Union of (multi)sets

Looks better.

UN=:+./&.([:q:^:_1 p:)

IS=:*./&.([:q:^:_1 p:)

1 2 3 3 3 UN 3 3 3 3 3 4 5 6

3 3 3

1 2 3 3 3 IS 3 3 3 3 3 4 5 6

1 2 3 3 3 3 3 4 5 6

On Tue, Oct 30, 2018 at 7:56 AM Don Guinn  wrote:

> You're right. The trick is to make them prime numbers. But it's not pretty.
>
> IS=:(_1 p:[:q:+.&([:*/[:p:]))/
>
> UN=:(_1 p:[:q:*.&([:*/[:p:]))/
>
> 1 2 3 3 3 UN 3 3 3 3 3 4 5 6
>
> 1 2 3 3 3 3 3 4 5 6
>
> 1 2 3 3 3 IS 3 3 3 3 3 4 5 6
> 3 3 3
>
> On Tue, Oct 30, 2018 at 4:58 AM 'Bo Jacoby' via Programming < 
> programm...@jsoftware.com> wrote:
>
>>
>> IS=.+.&.(*/)
>>
>> UN=.*.&.(*/)
>>
>>
>> This still works for multisets of prime numbers.
>> Den tirsdag den 30. oktober 2018 11.55.04 CET skrev 'Bo Jacoby' 
>> via Programming :
>>
>>
>>IS=.[:q:+.&(*/)
>>
>>  UN=.[:q:*.&(*/)
>>  2 3 3 5 IS 3 5 5 5
>> 3 5
>>  2 3 3 5 UN 3 5 5 5
>> 2 3 3 5 5 5
>> This works for multisets of PRIME numbers only.
>>
>>
>> Den tirsdag den 30. oktober 2018 10.46.17 CET skrev R.E. Boss <
>> r.e.b...@outlook.com>:
>>
>>  IMO we should interpret the intersection and the union of two 
>> (multi)sets (sets X with X 

Re: [Jprogramming] Fractional parts

2017-08-09 Thread Schmidt-Gröttrup , Markus
Skip, have you considered to use extended precision?
In your example only small fraction are used, and the methods discussed would 
apply as well without precision problems. 

v=:2%(3r19-%x:1 2 3 245 246 247 248)

I haven’t read the whole thread, so sorry if this contribution doesn’t fit. 

Markus

-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von Martin Kreuzer
Gesendet: Mittwoch, 9. August 2017 16:35
An: programm...@jsoftware.com
Betreff: Re: [Jprogramming] Fractional parts

 From what I've gathered so far is, that people seem to not mind that much, 
when extracting the fractional part from a (negative) float, they use

(1&|) _8.11
0.89

or


Re: [Jprogramming] cleanest diamond

2017-06-27 Thread Schmidt-Gröttrup , Markus
A morphological closure is the reasonable treating. 

With these definitions: 
im1 =:  _48+ (, ;._2) a. i. 0 : 0
00
00
00
00
001000
011100
011100
10
000111
000011
001000
01
10
000101
001101
0100011100
00110101011100
01
00001110010110
0001110110
000101
0111011000
0101010100
101100
0001101110
0001101100
101000
00
00
00
)
   ushift =: 0 ,~ }.
   dshift =: 0 , }:
   lshift =: 0 ,"1~ }."1
   rshift =: 0 ,"1 }:"1
   ulshift =: ushift@lshift
   urshift =: ushift@rshift
   dlshift =: dshift@lshift
   drshift =: dshift@rshift
   clos22 =: (]*.rshift)@:(]*.dshift)@:(]+.lshift)@:(]+.ushift)
   closc4 =: 
(]*.urshift)@:(]*.drshift)@:(]*.rshift)@:(]*.dshift)@:(]+.dlshift)@:(]+.ulshift)@:(]+.lshift)@:(]+.ushift)
   show =: (-.&' ')"1 @: ":

closures with a 2*2 square or a circle with diameter 4 are shown with:  

   show im1 + clos22 im1
00
00
00
00
002000
022200
022200
20
000222
000122
002000
021000
20
000212
002212
0211122200
11221212122200
02
00112221121220
0002221220
0002121000
0222122000
0212121200
0001212200
0002212220
0002212200
212000
00
00
00
   show im1 + closc4 im1
00
00
00
00
002000
022200
022200
20
000222
000122
002000
021100
20
000212
0022121000
0211122200
11221212122200
02
00112221121220
0002221220
0002121100
1222122000
0212121211
0011212210
0002212220
0002212200
212000
00
00
00

Best regards, 

Markus


-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von Marshall Lochbaum
Gesendet: Dienstag, 27. Juni 2017 10:20
An: programm...@jsoftware.com
Betreff: Re: [Jprogramming] cleanest diamond

A common strategy that may work for you is just to ignore the spacial data and 
perform some sort of clustering (like k-means, with k=2) on the intensities. 
Then classify pixels according to which cluster they fall in.

An approach that does use this data, and which I expect would be much slower 
but somewhat more accurate, would be to use the realization that a threshold 
that maximizes the number of contiguous 1's minimizes the number of adjacent 
pixels which are separated by the threshold (that is, adjacent 0-1 pairs). To 
minimize this number, we need to collect all pairs of adjacent pixels, then 
turn consider these pairs as intervals and compute for each possible threshold 
the number of these intervals which contain it.

I don't have any particularly clever ways to find pairs of adjacent pixels. For 
the strictest form of adjacency, with no diagonals, the verb ((}. ,.&, }:) , 
(}."1 ,.&, }:"1)) will get them all. Each pair should then be sorted, to put 
them in a standard interval form.

An efficient way to turn a list of intervals into a list of 
number-of-intervals-containing uses an obverse of monad (I.), which I am 
increasingly coming to believe is a major feature missing from J. To
wit:

   x =. 4 7 2 4 1 7 8
   (10$0) (#/.~@])`(~.@])`[}"1 x
0 1 1 0 2 0 0 2 1 0
   I. (10$0) (#/.~@])`(~.@])`[}"1 x
1 2 4 4 7 7 8
   (/:~x) -: I. (10$0) (#/.~@])`(~.@])`[}"1 x
1

The verb ((#/.~@])`(~.@])`[}) with an appropriate left argument is an left 
inverse to I. ignoring trailing zeros, and a right inverse to I.
ignoring ordering. It counts, for each number in (i.n) where n is the length of 
the left argument, 

Re: [Jprogramming] verb to set an element of an array

2017-06-23 Thread Schmidt-Gröttrup , Markus
Try 

put =: 4 : '42 (x)}y'

verb is defined as 3, meaning a monadic verb, but a dyadic verb is needed.

Best regards, 
Markus

-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von Rudolf Sykora
Gesendet: Freitag, 23. Juni 2017 11:24
An: programm...@jsoftware.com
Betreff: [Jprogramming] verb to set an element of an array

Hello,

I want to set x'th element of y to 42.
I tried quite a few variations of

put := verb : '42 x}y'

but I am still getting

1 put 1 2 3
|domain error: put

Can you tell me what is wrong, and tell me how to do it right?

Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] plot in J805

2017-03-31 Thread Schmidt-Gröttrup , Markus
Thanks for your help, Bill. Updated all packages, now plot works. Great!


-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von Schmidt-Gröttrup, Markus
Gesendet: Freitag, 31. März 2017 17:12
An: programm...@jsoftware.com
Betreff: Re: [Jprogramming] plot in J805

ide/qt
manifest:
VERSION=: '1.1.118'

I use qt. 

where would I find pacman  Studio|Demos?

-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von bill lam
Gesendet: Freitag, 31. März 2017 17:05
An: programm...@jsoftware.com
Betreff: Re: [Jprogramming] plot in J805

ide/qt addon.
If you are not using jqt, then on which front-end did you test?  jhs, jconsole ?

Also the version of your addons are not the latest on jal. Please check using 
pacman to see what are the latest version that you can get.

Пт, 31 мар 2017, Schmidt-Gröttrup, Markus написал(а):
> 
> plot/manifest.ijs:
> VERSION=: '1.0.179'
> 
> gl2/manifest.ijs:
> VERSION=: '1.0.91'
> 
> qt ? 
>   
>   
> -Ursprüngliche Nachricht-
> Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im 
> Auftrag von bill lam
> Gesendet: Freitag, 31. März 2017 15:32
> An: Programming forum <programm...@jsoftware.com>
> Betreff: Re: [Jprogramming] plot in J805
> 
> also the version number of gl2 and qt addons. thanks.
> 
> On 31 Mar, 2017 9:15 pm, "Schmidt-Gröttrup, Markus" < 
> m.schmidt-groett...@hs-osnabrueck.de> wrote:
> 
> I recently have updated to J805 (Windows 10) and find the plot package 
> with
> errors:
> 
> |value error: glpaintx
> |value error: glsel
> 
> I assume I have to load an additional package, but did not find which one.
> Thank you for a hint.
> 
> Markus Schmidt-Gröttrup
> 
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm

--
regards,

GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver 
subkeys.pgp.net --armor --export 4434BAB3
--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] plot in J805

2017-03-31 Thread Schmidt-Gröttrup , Markus
ide/qt
manifest:
VERSION=: '1.1.118'

I use qt. 

where would I find pacman  Studio|Demos?

-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von bill lam
Gesendet: Freitag, 31. März 2017 17:05
An: programm...@jsoftware.com
Betreff: Re: [Jprogramming] plot in J805

ide/qt addon.
If you are not using jqt, then on which front-end did you test?  jhs, jconsole ?

Also the version of your addons are not the latest on jal. Please check using 
pacman to see what are the latest version that you can get.

Пт, 31 мар 2017, Schmidt-Gröttrup, Markus написал(а):
> 
> plot/manifest.ijs:
> VERSION=: '1.0.179'
> 
> gl2/manifest.ijs:
> VERSION=: '1.0.91'
> 
> qt ? 
>   
>   
> -Ursprüngliche Nachricht-
> Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im 
> Auftrag von bill lam
> Gesendet: Freitag, 31. März 2017 15:32
> An: Programming forum <programm...@jsoftware.com>
> Betreff: Re: [Jprogramming] plot in J805
> 
> also the version number of gl2 and qt addons. thanks.
> 
> On 31 Mar, 2017 9:15 pm, "Schmidt-Gröttrup, Markus" < 
> m.schmidt-groett...@hs-osnabrueck.de> wrote:
> 
> I recently have updated to J805 (Windows 10) and find the plot package 
> with
> errors:
> 
> |value error: glpaintx
> |value error: glsel
> 
> I assume I have to load an additional package, but did not find which one.
> Thank you for a hint.
> 
> Markus Schmidt-Gröttrup
> 
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm

--
regards,

GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver 
subkeys.pgp.net --armor --export 4434BAB3
--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] plot in J805

2017-03-31 Thread Schmidt-Gröttrup , Markus

plot/manifest.ijs:
VERSION=: '1.0.179'

gl2/manifest.ijs:
VERSION=: '1.0.91'

qt ? 
  
  
-Ursprüngliche Nachricht-
Von: Programming [mailto:programming-boun...@forums.jsoftware.com] Im Auftrag 
von bill lam
Gesendet: Freitag, 31. März 2017 15:32
An: Programming forum <programm...@jsoftware.com>
Betreff: Re: [Jprogramming] plot in J805

also the version number of gl2 and qt addons. thanks.

On 31 Mar, 2017 9:15 pm, "Schmidt-Gröttrup, Markus" < 
m.schmidt-groett...@hs-osnabrueck.de> wrote:

I recently have updated to J805 (Windows 10) and find the plot package with
errors:

|value error: glpaintx
|value error: glsel

I assume I have to load an additional package, but did not find which one.
Thank you for a hint.

Markus Schmidt-Gröttrup

--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] plot in J805

2017-03-31 Thread Schmidt-Gröttrup , Markus
I recently have updated to J805 (Windows 10) and find the plot package with 
errors:

|value error: glpaintx
|value error: glsel

I assume I have to load an additional package, but did not find which one.
Thank you for a hint.

Markus Schmidt-Gröttrup

--
For information about J forums see http://www.jsoftware.com/forums.htm