Re: [Jprogramming] Geometric algebra

2019-11-25 Thread Arnab Chakraborty
Thank you all so much for all your excellent suggestions. In fact, Bo's idea was what I started with. But two things (not mentioned in my original mail) prevented me from using that approach. First, my vector space has 32 dimensions, and most of my vectors will be sparse. Second, I have a somewhat

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread Don Kelly
you can also look at the base vectors using complex numbers +. +/ 2.3 0j3.9 3.1 5.4 3.9 Don Kelly On 2019-11-25 1:39 p.m., 'Bo Jacoby' via Programming wrote: Enumerate your base vectors 1 0 and 0 1 etc.    (2.3*1 0)+(3.9*0 1)+(3.1*1 0) 5.4 3.9 Thanks. Bo.Den mandag den 25. novem

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread 'Bo Jacoby' via Programming
Enumerate your base vectors 1 0 and 0 1 etc.    (2.3*1 0)+(3.9*0 1)+(3.1*1 0) 5.4 3.9 Thanks.  Bo.Den mandag den 25. november 2019 19.45.04 CET skrev Raul Miller : Or, slightly more efficient (if that matters):   V1=: |:(2 3 4;2.3),(1 2;3.9),: 2 3 4;3.1   V2=: (~.@{.,:+/&.:>/./)V1

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread Raul Miller
Or, slightly more efficient (if that matters): V1=: |:(2 3 4;2.3),(1 2;3.9),: 2 3 4;3.1 V2=: (~.@{.,:+/&.:>/./)V1 V2-:|:(2 3 4;5.4),: 1 2;3.9 (Caution: email clients have become hostile to copy&paste, and may not represent code accurately.) Thanks, -- Raul On Mon, Nov 25, 2019 at 1:1

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread 'Mike Day' via Programming
You've already got a good reply from Raul,  but I'll offer these variants, having spent a little while looking at the problem. The first one possibly overuses what I think of as each (&.>)  and every (&>)   :     f1 =: (({: every) ((~.@[);~each ((+/)/.)) >@({.every) ) It does the key operation

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread Raul Miller
Your approach is exactly what my f does! That said, there's other ways of phrasing this. Also, for this specific calculation, it would be easier to work with a representation of the form V1=: |:|.@> v1 V2=: |:|.@> v2 Then: V2-:(~.@{.,:+&.>//./)V1 1 It may help to use the dissect utilit

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread Arnab Chakraborty
Thanks, Raul. You are always so prompt with your help! I am yet to decipher your solution, but your suggestion regarding 2 column table is bang on point. My own approach was something like this: find nub of the 2nd column, then for each element in the nub collect all occurences of it, and sum over

Re: [Jprogramming] Geometric algebra

2019-11-25 Thread Raul Miller
Yes, definitely. For example, consider: <"1 ({:"1 (+&.>/@:({."1), (<0 1){])/. ])>v1 Or, f=: 13 :'<"1 ({:"1 (+&.>/@:({."1), (<0 1){])/. ])>y' f v1 That said, this example may fall apart for your general case? (I don't know what that is...) Specifically, I don't know why the top level str

[Jprogramming] Geometric algebra

2019-11-25 Thread Arnab Chakraborty
Dear all, I am trying to implement a geometric algebra system in J. I have done much of the stuff, but is getting stuck at one point. Hence this email. Basically, I have a list of boxes like v1=: (<2.3; 2 3 4), (<3.9; 1 2), <3.1; 2 3 4 This represents a (multi)vector whose math representatio