back to index

fast.ai APL study session 1


Chapters

0:0
19:59 How To Read the Help
22:50 Install Anaconda
26:43 Monetic Form
52:59 Complex Number

Whisper Transcript | Transcript Only Page

00:00:00.000 | - Curious to see how many people join us.
00:00:05.000 | Where are you coming to us from, Wayne?
00:00:09.120 | - I'm in the US in New Jersey.
00:00:12.800 | So if there's any explosions in the background
00:00:15.000 | while I'm talking, it's 'cause it's the Fourth of July.
00:00:17.400 | - Oh yeah, happy Independence Day.
00:00:19.840 | Is that a thing you say?
00:00:20.920 | I don't remember.
00:00:21.760 | Do people say happy Independence Day?
00:00:23.520 | - I don't think I've ever said that to anybody.
00:00:26.840 | I don't know.
00:00:29.400 | It just is Independence Day.
00:00:31.200 | - Yes.
00:00:32.440 | - Yeah, I guess sort of.
00:00:34.200 | - How about you, Alex?
00:00:35.040 | Where are you?
00:00:35.880 | - I'm in the Netherlands.
00:00:38.400 | - All right.
00:00:39.240 | Who else is here?
00:00:42.760 | Hi, Abhishek.
00:00:43.600 | How are you?
00:00:44.920 | - Hey, Jeremy.
00:00:45.880 | I'm good.
00:00:46.720 | - Where are you joining us from?
00:00:49.440 | - I'm joining from India.
00:00:50.920 | It's quite early in the morning.
00:00:53.160 | - Yeah, India's a big place.
00:00:54.720 | Whereabouts in India are you?
00:00:56.680 | - I'm in Lucknow, near Delhi, northern India.
00:01:00.880 | - And what's the time there?
00:01:02.600 | - It's 5.30 a.m.
00:01:04.240 | - Wow, Kiryat, are you in India too?
00:01:06.000 | - Yeah, I'm in India too.
00:01:09.120 | I'm in South of India, actually, in Kerala.
00:01:11.560 | - Oh, Kerala.
00:01:12.480 | Awesome.
00:01:13.440 | Apparently that's really beautiful.
00:01:14.680 | I used to work with somebody from Kerala
00:01:17.080 | who said I should come visit him one day,
00:01:18.600 | but I never managed to.
00:01:20.480 | - Yeah, you definitely don't, yeah.
00:01:22.200 | - I'm sure I'd love it.
00:01:24.880 | - It's like the one country
00:01:27.280 | I've always wanted to visit, but haven't yet.
00:01:30.000 | - Oh, I see.
00:01:33.200 | I think you should come to any conferences
00:01:35.360 | or something like that.
00:01:37.280 | - Yeah.
00:01:38.120 | - So I want you to try aloo parathas in Delhi, Jeremy,
00:01:45.440 | because I know that's the Indian bread you like.
00:01:48.320 | - Yeah.
00:01:49.160 | Yeah, there's a lot of Indian foods I like.
00:01:53.760 | We do get some pretty decent dosa near here,
00:01:56.600 | which is nice.
00:01:57.440 | We didn't used to, but now we do,
00:01:59.000 | but I'm sure it's nowhere near as good
00:02:00.280 | as the dosa that you get in India.
00:02:02.840 | I don't think I've ever had an Indian meal I didn't like.
00:02:08.360 | I see Washem is here as well.
00:02:13.240 | Thanks for all your help recently, Washem.
00:02:15.440 | Although he's muted and de-videoed.
00:02:22.040 | Maybe he's being coy.
00:02:25.240 | Hi, Tudish, how are you?
00:02:30.160 | Also muted and de-videoed.
00:02:35.520 | That's fine.
00:02:40.080 | - Hello, I'm just-
00:02:45.400 | - Oh, here he comes.
00:02:46.240 | - Yeah, just hanging around, but yeah.
00:02:48.800 | It's July 4th, so.
00:02:50.840 | Yeah, how's your July 4th going so far?
00:02:53.960 | - Nothing much right now,
00:02:57.920 | but we're gonna have some food and stuff.
00:02:59.840 | So yeah, we're preparing, so.
00:03:02.560 | - Awesome.
00:03:03.400 | - And I guess we'll see what there's any fireworks
00:03:06.000 | on TV or something like that.
00:03:08.040 | - Yeah.
00:03:08.880 | And we've got some Aussies here as well.
00:03:11.600 | Hi, Radek.
00:03:12.440 | Hi, Serada.
00:03:13.280 | - Hello, hello.
00:03:16.040 | - Hello, hello.
00:03:17.440 | How are you doing, Radek?
00:03:20.360 | - Good, good, so excited for the session.
00:03:25.360 | - All right.
00:03:26.680 | Well, let's get started, shall we?
00:03:29.080 | Has anybody here had any experience with APL or J?
00:03:34.080 | Okay.
00:03:36.840 | Nobody?
00:03:40.520 | - I've played around with it.
00:03:41.480 | - Yeah.
00:03:42.720 | I feel like, where are you coming to us from?
00:03:45.000 | - I'm in Washington, DC.
00:03:48.160 | - And what have you done with it, Felix?
00:03:51.000 | - Mostly toy stuff.
00:03:53.600 | I was doing Advent of Code last year in APL.
00:03:57.400 | - Okay, so you're probably gonna be able
00:03:59.280 | to teach us some stuff.
00:04:01.400 | And who else, somebody else said
00:04:02.600 | they might've done a little bit, I think.
00:04:04.600 | - I've done a little bit less than Felix,
00:04:10.760 | but just played around with it.
00:04:13.720 | Just started trying to go
00:04:14.880 | through a linear algebra course, chapter one in APL.
00:04:18.800 | - Okay, awesome.
00:04:20.800 | Like, is it a linear algebra in APL course,
00:04:23.560 | or you're just like doing a linear algebra course
00:04:26.400 | and using APL?
00:04:27.240 | - It's a textbook that is linear.
00:04:32.760 | It's a linear algebra textbook,
00:04:34.120 | and they chose APL as the--
00:04:36.320 | - Oh, wow, can you share a link to it in the chat?
00:04:38.840 | - Yeah, absolutely.
00:04:42.880 | - You got any Independence Day things happening today, Isaac?
00:04:45.880 | - Just this call.
00:04:49.320 | I'm sure there'll be fireworks going on sometime,
00:04:52.920 | but I don't know that we're gonna go watch them or anything.
00:04:55.520 | - All right, well, I'm glad there's some folks
00:04:57.160 | who hopefully can help us figure things out,
00:05:00.800 | 'cause I've got very little background in this,
00:05:05.320 | other than teaching my kids some math using APL,
00:05:08.360 | and a little bit of playing around with Jay.
00:05:10.840 | I was actually on the ArrayCast podcast this morning,
00:05:15.840 | so lots of APL things happening in my life today.
00:05:21.360 | Applied linear algebra with APL.
00:05:24.080 | All right, I guess I should share my screen
00:05:25.600 | so that people can show what you're sharing.
00:05:28.040 | Share screen, share.
00:05:31.160 | So this is one of the things I like about APL
00:05:35.200 | is that there is a bunch of books and whatever around
00:05:40.640 | that use APL to teach other things.
00:05:42.880 | Well, let us know how it goes.
00:05:48.240 | I've never heard of this one.
00:05:51.360 | - Yeah, it looks good so far.
00:05:54.680 | I just finished chapter one, section two,
00:06:00.560 | so I'm not even completely through chapter one,
00:06:03.120 | but if I'm gonna further along, I'll let you know.
00:06:08.640 | All right, so hopefully everybody's done step one.
00:06:12.200 | If you haven't yet, that is to install dialogue APL.
00:06:16.640 | There is a bunch of different APL interpreters around,
00:06:21.240 | but they're not all the same,
00:06:23.920 | and dialogue seems to be the one
00:06:27.440 | that it's by far the most heavily invested in,
00:06:30.280 | and has a bunch of cool things
00:06:34.680 | that aren't necessarily in the other APLs.
00:06:37.800 | And I do recommend installing it from their website.
00:06:41.800 | You don't have to register or anything.
00:06:44.520 | There is a option to download an unregistered version
00:06:49.520 | and it works perfectly.
00:06:51.040 | So I'm on Windows, but there's also a Mac one,
00:06:58.680 | and then there's both Debian or Ubuntu
00:07:02.320 | and Red Hat, RPM, whatever, options for Linux.
00:07:06.800 | I think some Linux one doesn't come with a GUI.
00:07:10.880 | So I'm not installing this one.
00:07:17.160 | Linux at the moment, so I haven't tried this.
00:07:21.840 | I'll try it later, but there is a GUI
00:07:24.760 | you can download called Ride.
00:07:29.040 | Now that comes with the Mac one,
00:07:31.160 | and Windows comes with its own GUI.
00:07:33.200 | But there's also,
00:07:34.040 | if you go to the latest release here for Ride,
00:07:37.600 | you'll find there's RPM and dev for AMD and ARM platforms.
00:07:41.680 | So I think you have to install dialogue first
00:07:45.000 | and then you install Ride.
00:07:46.280 | Okay, so then to run dialogue,
00:07:55.360 | yeah, you know, on Mac,
00:07:59.720 | command space, type dialogue,
00:08:01.760 | or on Windows, hit the Windows button and type dialogue.
00:08:05.480 | Now, one thing I found a little hard to find,
00:08:12.440 | which is actually pretty obvious now.
00:08:14.840 | I know where it is.
00:08:15.680 | There's an increase in the font size.
00:08:17.360 | You just do it in the toolbar up here, like so.
00:08:21.000 | I can't remember if you have to reboot
00:08:25.200 | after you install dialogue or not,
00:08:26.720 | 'cause it doesn't install a keyboard.
00:08:33.840 | dialogue,
00:08:37.640 | keyboard.
00:08:42.280 | Yeah, APL fonts and keyboards.
00:08:50.000 | So if you scroll down to the bottom here,
00:08:54.280 | it's a little hard to see actually,
00:08:55.640 | but there's actually different tabs here.
00:08:57.640 | So on Windows,
00:09:02.840 | you should find that you can,
00:09:06.800 | so there's a language bar with all the different glyphs,
00:09:09.800 | right?
00:09:10.640 | But you can also hold down control
00:09:12.680 | and press the keyboard button to get a glyph.
00:09:15.720 | So there's control A, control J, control hyphen.
00:09:21.320 | On Mac, you press back tick this button
00:09:26.320 | and then press the letter.
00:09:27.760 | So what I did is there's a few ways you can do this.
00:09:36.040 | On Windows, I can't remember if Mac does this as well.
00:09:41.840 | If you wave your mouse over something in the toolbar,
00:09:47.640 | it tells you what button to press to get it.
00:09:52.640 | And then the other thing I did
00:09:56.200 | was I just Googled for APL keyboard
00:10:01.200 | and I just printed out,
00:10:03.480 | oh, that doesn't work 'cause of my background thing.
00:10:05.360 | Hang on.
00:10:06.200 | Video.
00:10:08.200 | I printed out just a picture of an APL keyboard.
00:10:17.560 | Which honestly, I haven't referred to too much
00:10:19.240 | because the one in the IDE works so right.
00:10:24.240 | - So let's look at Mac OS.
00:10:27.840 | We have that little tool tip thing showing up too.
00:10:31.080 | - Oh, okay.
00:10:32.640 | And I don't know if it's any use or not,
00:10:35.360 | but if you want to, in Windows, you can use back tick instead.
00:10:40.200 | If you go to Unicode input,
00:10:45.840 | you can have it activate a keyboard when you start,
00:10:48.760 | which obviously, you'd pick APL
00:10:50.840 | and then you can turn on,
00:10:52.280 | maybe we have to press Mr. Tick.
00:10:59.480 | Oh, it's weird.
00:11:02.600 | Hang on.
00:11:03.440 | Well, this is working before I was able to turn on back tick,
00:11:11.160 | but for some reason, it's not working.
00:11:13.040 | Nevermind.
00:11:14.760 | Well, you should be able to click configure layout
00:11:16.320 | and turn on a back tick instead,
00:11:17.560 | but using control works fine for me.
00:11:20.960 | Now in Mac and Windows,
00:11:24.880 | the back tick or control keys
00:11:27.280 | will just automatically work when you go into the app.
00:11:32.280 | If I run something else.
00:11:35.600 | - Jeremy, can you search screen?
00:11:39.960 | - Oh, yeah, yeah.
00:11:41.120 | Sorry.
00:11:44.600 | Search screen.
00:11:45.440 | Okay.
00:11:48.760 | Thanks for reminding me, Serada.
00:11:54.240 | Okay, so that's the control, whatever's.
00:11:58.480 | And then,
00:12:02.760 | if I go into some other dialog box or some other program,
00:12:10.480 | then the control buttons don't work anymore.
00:12:12.720 | So I just get my normal control, I select all.
00:12:15.080 | If you want, in Windows,
00:12:18.640 | if you want to use the dialog keyboard elsewhere,
00:12:22.880 | you can hold down the Windows button and press space,
00:12:25.440 | and it'll pop up a list and keep holding down Windows.
00:12:28.040 | It'll pop up a list of different keyboards,
00:12:29.920 | and you can just choose dialog APL keyboard.
00:12:33.560 | And so now, if I start typing control,
00:12:37.480 | I get the dialog ones here.
00:12:40.520 | So if you're trying to use like,
00:12:41.920 | if you're trying to select something,
00:12:43.080 | and then try to copy it with that control C,
00:12:45.000 | and it doesn't work,
00:12:47.080 | that might be because you actually have
00:12:49.320 | the dialog keyboard running,
00:12:50.560 | so then you'll just have to hold down Windows
00:12:52.120 | and press space to go back to a non-APL keyboard.
00:12:56.960 | For Mac,
00:12:59.720 | just go to this APL fonts and keyboards dialog page,
00:13:06.640 | and click on macOS,
00:13:09.480 | and it'll show you how to enable the keyboard,
00:13:14.400 | and then you can change your keyboard layout
00:13:18.840 | for Mac.
00:13:24.000 | But you don't have to use any of this
00:13:25.920 | just to use Ride or the Windows IDE.
00:13:30.080 | This is just if you want to use them outside.
00:13:32.280 | So has anybody had any issues with installing?
00:13:37.200 | Oh, the other thing to mention is on Linux,
00:13:39.320 | if you go to the forum,
00:13:41.720 | there is a
00:13:54.440 | link here using dialog in Debian.
00:14:06.440 | Which describes how to install it,
00:14:11.800 | 'cause you do have to install at least one extra thing
00:14:14.680 | and possibly two,
00:14:16.320 | and chose how to use the keyboard.
00:14:17.920 | And then I see Adam, who actually works at dialog,
00:14:23.760 | has kindly added a note here about Ride,
00:14:27.880 | which we've already mentioned, so that's good.
00:14:30.880 | And so that includes the back tick thingies.
00:14:32.960 | All right.
00:14:35.160 | Yeah, did anybody have any issues with installing
00:14:37.280 | or any other notes?
00:14:39.600 | Oh, I see Waspium has mentioned try APL.
00:14:47.320 | Okay, yeah.
00:14:48.160 | So I haven't really used this myself,
00:14:50.520 | but I know a lot of people talk about it,
00:14:52.120 | which is, yeah, APL in your browser.
00:14:54.880 | Does this do back tick?
00:14:58.680 | Yes, it does.
00:15:00.520 | It looks like back tick works here.
00:15:04.800 | Cool.
00:15:05.640 | So you can use back tick,
00:15:06.480 | followed by a letter to put it in there.
00:15:08.800 | And they've also got the,
00:15:10.200 | what's this tab?
00:15:20.000 | Seven equals tab.
00:15:21.760 | Seven, seven tab.
00:15:29.160 | Oh, I see there's multiple ways to type this.
00:15:31.120 | So prefix S I think means back tick S.
00:15:35.600 | Okay, so that's how you can read those little thingies,
00:15:37.640 | or you can just click on them.
00:15:39.240 | All right.
00:15:41.960 | Is everybody able to run APL and type stuff?
00:15:45.680 | Okay.
00:15:46.520 | Just gel if you can't.
00:15:50.480 | Otherwise we'll keep moving on.
00:15:52.040 | - I guess with APL, it's not like the conciseness
00:15:58.640 | and expressiveness of it means that it's not like
00:16:00.920 | you're typing at a hundred words per minute anyway, so.
00:16:03.920 | - Right.
00:16:04.760 | Yeah.
00:16:06.280 | Yeah, it's more like typing a math equation
00:16:09.520 | or something I suppose.
00:16:10.920 | Yeah.
00:16:13.640 | Charles says going to an obscure programming language course
00:16:19.120 | at 2 a.m., what am I doing with my life?
00:16:21.080 | We can't help you with that Charles,
00:16:22.280 | 'cause we're also all here.
00:16:23.480 | Some of them are here on Independence Day.
00:16:27.400 | So everybody here will not be able to empathize
00:16:31.640 | with any troubles you're having.
00:16:33.240 | Sorry.
00:16:34.080 | All right, so.
00:16:37.520 | Okay, we're making progress.
00:16:41.440 | So I'm gonna run dialogue.
00:16:43.200 | Increase the font size.
00:16:48.880 | And I don't know if there's a way to turn these off
00:16:52.160 | by default, but you can get a bit more space back
00:16:54.400 | by clicking on these little various Xs around the place.
00:16:58.040 | I do feel like it would be nice to get some more space
00:17:00.120 | by removing the word language bar above the language bar,
00:17:02.840 | I'm not showing that much, not much doing much for us,
00:17:05.160 | but so be it.
00:17:06.440 | All right, so I'll show you,
00:17:07.640 | I'm not an expert in this IDE,
00:17:10.680 | but it kind of behaves like a normal REPL.
00:17:15.000 | So I can type numbers, I can type expressions.
00:17:19.800 | So yeah, the answer from dialogue APO appears on the left
00:17:25.280 | and my input appears indented.
00:17:27.840 | Something took me a while to realize
00:17:32.040 | that you can click on an earlier one
00:17:33.560 | with your mouse or go up to it,
00:17:36.440 | and then, you know, edit it.
00:17:40.080 | And if I press enter, it actually,
00:17:42.200 | this one goes back to what it used to say,
00:17:43.960 | and then this, and it'll put my new thing on a new line,
00:17:46.200 | which is actually really, really helpful.
00:17:48.280 | So I think that's my number one tip that I've found so far.
00:17:57.680 | - You can also bind scrolling through history to a hotkey.
00:18:02.680 | - Yes, you can.
00:18:06.200 | And I thought it might've even have come with one.
00:18:09.880 | I can't find anything that it's working for.
00:18:13.800 | Dialogue, APO, keyboard history.
00:18:27.520 | No, all right, how do you,
00:18:31.480 | all right, how do you do that?
00:18:32.920 | Configure?
00:18:33.760 | - Preferences.
00:18:34.960 | - Yeah, okay, called configure in my one.
00:18:37.240 | Probably keyboard shortcuts.
00:18:39.000 | - Yes, and it is called backward or undo, I believe.
00:18:44.000 | - Backward or undo, control, shift.
00:18:48.920 | - DK.
00:18:49.880 | - Back, control, shift, backspace.
00:18:53.200 | Control, shift, backspace, there we go.
00:18:56.880 | Nice, okay.
00:18:59.480 | That's great.
00:19:03.400 | All right, so the next thing I wanted to do
00:19:10.640 | was get a Jupyter kernel working.
00:19:12.840 | 'Cause I'll tell you my plan,
00:19:17.720 | and I'll tell you why it's my plan.
00:19:22.720 | Most array programming tutorials, books I've seen
00:19:27.720 | kind of like look at one concept at a time
00:19:31.360 | and go pretty deep on it,
00:19:32.640 | which is not the first AI way to teach things.
00:19:37.160 | And I think it's particularly not the right way
00:19:38.880 | to teach APO.
00:19:40.560 | And the reason for that is that when I look up stuff
00:19:43.720 | in the help, so in dialogue for Windows,
00:19:48.000 | I can wave over one of these and go down
00:19:50.120 | and I can click on more.
00:19:52.480 | And it doesn't always come to the front,
00:19:56.160 | but here we go, I get the help.
00:19:58.800 | Now, let me explain how to read the help.
00:20:01.520 | The help tells you, it shows me up here what the glyph is.
00:20:06.520 | And every glyph has a name.
00:20:09.040 | So that small circle is called Jot.
00:20:11.440 | And we'll talk about this soon in more detail,
00:20:16.280 | but generally speaking, each glyph does two things.
00:20:21.560 | Called monadic and dyadic.
00:20:23.200 | And each of those things has its own name.
00:20:29.080 | So Jot can do either beside or bind.
00:20:32.760 | Okay, so we can click on beside.
00:20:34.360 | All right, now you can see the problem here
00:20:38.320 | is that the examples all use glyphs that we don't know.
00:20:43.480 | And so it's like looking up in a dictionary
00:20:47.000 | to learn how to read Chinese when you don't know Chinese.
00:20:50.880 | So my plan is to first learn every single glyph,
00:20:55.320 | like in as simple a way as possible
00:20:57.800 | so that then we can read the documentation.
00:21:01.440 | So I think this is something that I haven't seen done before
00:21:07.080 | and I'm quite enthused about learning all the glyphs.
00:21:09.880 | So I've been teaching math to my daughter
00:21:14.720 | and her best friend, Claire and Gabe,
00:21:16.600 | and that's the very idea I told them.
00:21:19.120 | We're gonna try and learn all the glyphs
00:21:20.360 | and they're just very excited about the idea of like,
00:21:23.280 | all of these weird symbols becoming things
00:21:26.000 | that we understand and there won't be weird symbols anymore.
00:21:29.160 | So for me, most of these are still weird symbols,
00:21:32.320 | to be clear.
00:21:33.160 | But yeah, I don't know.
00:21:37.080 | Like a lot of them probably won't take long to learn,
00:21:39.000 | like obviously these plus minus times divide
00:21:42.840 | and these equals, you know?
00:21:45.720 | So quite a few of them.
00:21:47.000 | So we'll start with the ones that we can recognize.
00:21:49.560 | So yeah, one reason I wanna get Jupyter going
00:21:53.680 | is I wanna be able to start writing
00:21:56.080 | blog posts about APL.
00:21:57.840 | So let's try installing that together.
00:22:01.960 | I don't know if anybody's already done it,
00:22:03.280 | but I'm gonna go Jupyter APL kernel.
00:22:06.960 | - I played around APL a little bit
00:22:11.840 | a couple of years ago before I took a break
00:22:14.000 | and I found that getting the Jupyter kernel
00:22:16.880 | for APL working just kind of worked.
00:22:19.800 | So hopefully that's still the case,
00:22:21.720 | but it was really easy to get it going.
00:22:24.320 | - All right.
00:22:25.160 | So I've already got Jupyter installed on Windows.
00:22:33.320 | You can use condor or pip to install it.
00:22:36.360 | Probably condor might be a better option.
00:22:43.600 | And so now, let's see if this is the right button.
00:22:48.600 | Install dialogue, I've done that.
00:22:50.960 | Install anaconda, I've done that.
00:22:52.920 | Oh, that's right.
00:22:53.760 | They haven't actually got a pip or condor installer
00:22:55.760 | for this, which obviously they ought to fix.
00:22:58.400 | So we should fix for them.
00:23:00.400 | Download this.
00:23:01.480 | Fine.
00:23:04.480 | Save.
00:23:08.160 | Okay.
00:23:13.440 | And just recently I found my downloads in Chrome
00:23:18.440 | have started taking a ridiculously long time,
00:23:27.200 | but it looks like it's finally done.
00:23:29.520 | Okay, so let's unzip that.
00:23:31.560 | Okay.
00:23:39.360 | And then it's set to run install.bat.
00:23:41.440 | Run anyway.
00:23:46.440 | Okay, looks like something happened.
00:23:53.880 | Okay, let's see if what we wanted to happen happens.
00:24:00.360 | So I run Jupyter.
00:24:01.520 | Okay.
00:24:09.720 | And new, oh, dialogue.
00:24:13.200 | Go, baby, go.
00:24:16.640 | So now I'm gonna use windows.
00:24:20.400 | Oh, allow it to communicate.
00:24:23.200 | That's fine.
00:24:24.040 | Okay.
00:24:27.520 | So I'm probably gonna have to hit windows space
00:24:29.920 | to choose the dialogue keyboard.
00:24:31.560 | And okay, cool.
00:24:34.800 | So one, one plus one.
00:24:39.560 | All right.
00:24:40.400 | You're right, Isaac.
00:24:42.680 | That was pretty easy.
00:24:43.840 | So if somebody on Mac, do you have a,
00:24:57.520 | is there like integrated help in ride
00:25:03.320 | that gets you access to something like this?
00:25:08.000 | - No, it opens up a website, basically.
00:25:11.520 | - Okay, well, that's fine.
00:25:12.440 | I was gonna say everything that's in there
00:25:14.000 | is also in the website.
00:25:15.720 | Let's try searching for that exact thing.
00:25:19.200 | And of course, I just tried to hit control T
00:25:21.920 | to open up a tab, but that doesn't work
00:25:24.360 | 'cause I'm in the dialogue API or keyboard.
00:25:26.680 | Dialogue, language, elements.
00:25:32.160 | Here we go.
00:25:34.000 | Okay, I opened with navigation.
00:25:39.000 | I guess I don't really need the navigation.
00:25:48.760 | All right.
00:25:49.600 | So I feel like they're,
00:25:54.640 | at least these are not in a bad order to learn about them.
00:25:59.920 | So let's start with plus.
00:26:02.720 | And let's start by learning to read these things.
00:26:07.720 | Okay.
00:26:11.200 | So up in the top right here, we've got the glyph.
00:26:14.040 | And generally speaking, for functions,
00:26:18.640 | they're gonna show us the two things that they can do.
00:26:21.720 | They're called monadic and dyadic.
00:26:25.520 | Actually, let's start with minus
00:26:26.640 | 'cause it's a little easier.
00:26:28.040 | Monadic and dyadic.
00:26:31.840 | Monadic means that you're gonna put something
00:26:35.200 | only on the right-hand side.
00:26:37.480 | Like for example, negate three.
00:26:43.480 | That is the monadic form.
00:26:45.280 | If you've heard the word monad before and stuff
00:26:47.360 | like Haskell, this is not that.
00:26:49.560 | This simply means a function that takes one argument.
00:26:53.000 | And in APL, you don't write functions like that.
00:26:59.960 | Instead, you write your argument after
00:27:04.080 | if you have one argument.
00:27:06.520 | And if there are two arguments,
00:27:08.640 | you can have a second argument before.
00:27:11.240 | So it looks more like math than normal computing.
00:27:15.160 | So monadic means one argument.
00:27:17.000 | You'll see here that the negate function
00:27:25.120 | when applied to three returns like upper hyphen three.
00:27:30.120 | This upper hyphen is control two.
00:27:34.440 | I gotta say control, but for Mac users,
00:27:38.240 | that means back tick, control two.
00:27:40.880 | And this is how you write a minus sign in APL,
00:27:45.880 | meaning the constant number negative two.
00:27:50.240 | So these are two different things, right?
00:27:52.880 | This is a function that negates its argument.
00:27:55.560 | This is part of a numeric literal constant,
00:27:59.240 | which is the negative number.
00:28:01.200 | Now it so happens that the negated function,
00:28:05.480 | negate function applied to three
00:28:07.240 | and the number negative three are the same thing,
00:28:10.800 | but they're different, conceptually different.
00:28:14.240 | This is a single number.
00:28:16.120 | This is a function.
00:28:20.720 | Okay, so monadic, monadic means it takes one argument
00:28:25.200 | and the argument goes on the right.
00:28:27.240 | Does that make sense so far?
00:28:30.760 | Please tell me if it doesn't.
00:28:33.640 | Otherwise, we're gonna keep looking at the help
00:28:39.000 | 'cause I wanna show you how I look at the help.
00:28:41.040 | Basically, the help focuses on examples.
00:28:44.520 | And the idea is that you can kind of figure things out
00:28:47.640 | by looking at the examples.
00:28:49.280 | So if you copy the indented bit of the example
00:28:53.080 | and paste it, you should get the same result.
00:28:58.080 | Now this looks pretty similar to the example we just gave,
00:29:04.160 | but you'll see that they've got multiple numbers
00:29:06.840 | on the right.
00:29:07.680 | They've got 3.2, negative seven and zero.
00:29:11.600 | This is how you create
00:29:17.480 | a one-dimensional array
00:29:20.560 | or in kind of PyTorch speak, a rank one tensor
00:29:25.480 | or in math speak, a vector.
00:29:27.080 | You just chuck spaces between them, between numbers.
00:29:34.240 | So there's some controversy about whether this is accurate,
00:29:40.480 | but I'm just gonna use the word array for everything.
00:29:45.800 | So this is, I gotta call this, for example,
00:29:47.920 | the number three, which we call a scalar.
00:29:50.320 | I gotta call a rank zero array.
00:29:52.920 | Here's a rank one array.
00:29:56.480 | So when I say array, I'm gonna include scalars, okay.
00:30:02.000 | - So in the minus 3.2 against seven zero.
00:30:10.040 | - Yes.
00:30:12.120 | - What is this?
00:30:14.600 | - Okay, so that is a list or this is an array
00:30:18.280 | containing the numbers 3.2, negative seven and zero.
00:30:22.640 | And this is the function that you're applying to it.
00:30:26.440 | And so this is the result.
00:30:30.360 | Okay, so the result is it's like NumPy.
00:30:35.840 | It's applying the function to every element of the array.
00:30:38.960 | So the negative function, negate function by the 3.2
00:30:42.280 | is negative 3.2 applied to negative seven is seven
00:30:46.720 | and applied to zero is zero.
00:30:48.360 | - So it is a negative function, it's not the minus.
00:30:53.360 | - Correct, this is the minus that's part of a literal number.
00:30:58.360 | This is the negate function.
00:31:00.280 | - All right, but when you were typing this,
00:31:05.480 | did you do control two or did you do minus?
00:31:08.880 | - No, this is minus, this is minus.
00:31:11.680 | - So minus on the keyboard is the dash.
00:31:15.920 | - Yes.
00:31:17.760 | - The control two is for the special negative number symbol.
00:31:22.760 | - Jeremy, I posted a command in the chat,
00:31:30.880 | which will turn boxes on
00:31:33.200 | and it'll draw boxes around your list.
00:31:36.040 | So you can see kind of the structure
00:31:40.560 | of what you've put in there.
00:31:42.240 | - All right, let's do it.
00:31:43.440 | Copy.
00:31:48.880 | Do you know a way to do this automatically, by the way,
00:31:54.320 | when you start APO?
00:31:55.840 | 'Cause it feels like what I always want.
00:31:58.000 | - I do not.
00:32:00.360 | - There we go.
00:32:01.560 | Okay, now I can't quite remember
00:32:03.040 | how to read these weird arrow things,
00:32:04.640 | but I guess we'll figure it out as we go.
00:32:05.880 | But this is basically saying this is,
00:32:07.560 | I think this arrow is saying that there is a dimension here.
00:32:11.840 | So this is a one dimensional array.
00:32:16.040 | And I don't know what the squiggle means.
00:32:18.640 | - Jeremy, I tried this box thing.
00:32:20.880 | So you go to the session, next to session,
00:32:23.200 | there's a one and two, they have a boxes there.
00:32:25.600 | No, not this one, under the, yeah.
00:32:27.680 | This one is also turned on the box.
00:32:29.480 | - Okay, and does that do the max thingy or?
00:32:31.680 | - What that mean?
00:32:34.440 | - There's a style equals max.
00:32:37.080 | So like, I don't know.
00:32:40.840 | - You can set style of the men
00:32:44.960 | and it will draw fewer things.
00:32:47.240 | - Okay.
00:32:48.080 | - If you just are dealing with larger arrays.
00:32:50.760 | - Okay.
00:32:51.600 | So I don't know if this one is the men or the max,
00:32:53.600 | but that's really useful, Sarada.
00:32:55.120 | Thank you, well spotted.
00:32:56.520 | - They're just a box for everything.
00:32:59.160 | - Yeah, so about the squiggle,
00:33:02.760 | I think there is a difference between a list
00:33:07.720 | and a two dimensional array
00:33:12.200 | that's three columns in one row.
00:33:14.800 | - Yes, absolutely.
00:33:16.220 | When you say a list,
00:33:18.360 | I think you made a rank one array or a vector.
00:33:20.680 | - Yes.
00:33:21.520 | - Yeah, yeah.
00:33:23.480 | Okay, we'll come back to that.
00:33:26.520 | - So if you do nested lists,
00:33:30.000 | you can kind of see what the boxes are really about.
00:33:33.120 | - Yeah, well, let's leave that for now.
00:33:36.980 | Great.
00:33:40.320 | So I think we've got enough now
00:33:41.600 | to understand the first piece of documentation.
00:33:44.920 | So that's good.
00:33:45.760 | So let's,
00:33:48.900 | pop this in a separate window.
00:33:58.960 | All right, so,
00:34:00.520 | type numbers.
00:34:05.960 | And so we should show that one.
00:34:15.880 | And then we've got rank one arrays.
00:34:25.520 | Rank one arrays.
00:34:28.160 | Okay, and then we've got
00:34:40.000 | monadic minus.
00:34:47.360 | And I guess we could link that to the documentation.
00:34:54.840 | Okay, so now if I click on the gate,
00:34:59.840 | we're gonna get more information about monadic minus.
00:35:05.960 | All right, and so notice that hyphen in APL
00:35:10.680 | is pronounced minus sign or bar.
00:35:13.720 | I'm not used to saying things with two names.
00:35:15.640 | They normally just have one.
00:35:17.720 | And it can mean two things.
00:35:18.920 | And the monadic version is called negate.
00:35:20.720 | So when people talk about like read out APL expressions,
00:35:25.240 | they will often refer to the names of them.
00:35:27.760 | So they'll say negate.
00:35:29.040 | Now, this one's interesting.
00:35:35.600 | Copy.
00:35:38.120 | Let's pop it actually in here.
00:35:45.240 | Paste.
00:35:50.840 | Now, notice here, this does not mean minus four to zero.
00:35:55.840 | This means minus of that.
00:36:03.200 | I know there's no space after the minus,
00:36:06.440 | but space doesn't have meaning after a function.
00:36:10.400 | So that's why two is being negated
00:36:14.880 | and negative three is being negated
00:36:16.240 | because the minus refers to the whole thing.
00:36:19.480 | And it would be more obvious if there was a space here.
00:36:24.480 | Now, if we had written negative four,
00:36:31.680 | that would be something else entirely.
00:36:32.920 | That would be the number negative four,
00:36:34.400 | then the number two, then the number zero.
00:36:36.440 | But minus is a function
00:36:40.280 | and it applies to its whole right-hand side.
00:36:43.160 | And its whole right-hand side is a rank one array.
00:36:46.560 | And that's why we get two goes to negative two,
00:36:49.160 | negative three goes to three and so forth.
00:36:51.760 | Does that make sense?
00:36:52.760 | Okay, so Isaac's just added in the chat something useful,
00:37:05.040 | which is that there is also a bookmark
00:37:10.320 | that you can drag to your bookmarks bar,
00:37:13.760 | which I've actually already done.
00:37:17.360 | And somebody, by the way, maybe as we do these things,
00:37:19.800 | could add these to the forum thread, to the forum wiki.
00:37:23.360 | So if I click APL here.
00:37:26.280 | Yeah, so now we've got all these things.
00:37:37.720 | Oh, now it's back to gonna work.
00:37:39.320 | Let's try that.
00:37:41.760 | Nice.
00:37:44.520 | Okay, this is better.
00:37:45.360 | I'm gonna turn off my keyboard.
00:37:48.800 | Okay, I'm glad we tried that.
00:37:51.560 | So now backtick works.
00:37:52.720 | And this is written in JavaScript,
00:37:54.040 | so this will be cross platform.
00:37:55.600 | All right.
00:38:02.040 | So maybe we should show these examples.
00:38:11.120 | Okay, minus applied to four, minus applied to negative four.
00:38:16.120 | The kind of the APL way and the AERA programming way
00:38:31.440 | of like showing things in general,
00:38:35.000 | which I quite like, does involve a lot of examples.
00:38:41.000 | Which does like require the reader to like look at the example
00:38:46.000 | and figure out what's going on.
00:38:51.400 | And this is what I've been doing in teaching the kids
00:38:53.320 | some math and APL, is we look at the examples,
00:38:57.040 | we paste them into dialogue, and then we say like,
00:38:59.160 | oh, who can guess what's happening here?
00:39:01.880 | And it's actually quite a good, it's quite a good exercise,
00:39:06.040 | but it requires a little more work perhaps
00:39:08.840 | than people are used to.
00:39:11.320 | Okay, we got decimals, rank one arrays, one attic minus.
00:39:19.400 | So maybe that should be a heading three
00:39:24.840 | and then we'll create a heading two,
00:39:26.280 | which is this is minus, oopsie daisy.
00:39:28.800 | Oh, backticks, how do I do a real backtick?
00:39:31.000 | Crap.
00:39:33.320 | Anybody know how to type a backtick?
00:39:37.960 | (laughs)
00:39:40.040 | - You could temporarily close the JavaScript bar, I guess.
00:39:47.240 | - I could, yeah.
00:39:49.560 | We could always ask Adam if he knows.
00:40:01.360 | I was hoping the backtick, backtick would,
00:40:08.520 | give us what we needed.
00:40:10.320 | Is there a backtick in here?
00:40:12.240 | I don't think so.
00:40:13.920 | - Do you have a numpad?
00:40:15.680 | Is it alt?
00:40:16.640 | - I do not.
00:40:17.480 | - 26 or 126.
00:40:19.080 | - I do not.
00:40:20.480 | Do you know that off the top of your head?
00:40:21.760 | That's a bit crazy.
00:40:23.160 | - No, I googled it.
00:40:24.000 | - Alt backtick seems to work.
00:40:27.440 | - Huh?
00:40:28.600 | - Alt backtick.
00:40:29.800 | - Alt backtick.
00:40:31.640 | Nope.
00:40:32.800 | - Nope.
00:40:33.640 | - Oh, what just happened?
00:40:38.640 | Whoa, that's a weird thing.
00:40:43.360 | Somehow I just pressed a button to put up a terminal.
00:40:47.880 | - I was able to do option backtick on,
00:40:52.280 | - On Mac.
00:40:53.120 | - Hold option and backtick on Mac.
00:40:55.360 | - Yeah.
00:40:56.200 | - And that gave me a backtick with an underline
00:40:58.640 | and if I entered, turned into a regular backtick.
00:41:01.600 | - Huh.
00:41:03.440 | - Okay.
00:41:04.280 | All right.
00:41:13.960 | I'll let them later.
00:41:16.160 | Okay, so this was called,
00:41:29.880 | minus sign or bar.
00:41:34.880 | And this was called negate.
00:41:47.720 | Okay, so now I can do dyadic.
00:41:59.040 | So dyadic means it has two arguments.
00:42:01.920 | This is called minus or subtract.
00:42:06.200 | Okay, so normally two arguments in a function
00:42:16.840 | looks like this unless you do what we call infix notation,
00:42:22.160 | in which case it looks like this.
00:42:25.440 | APL is always infix notation.
00:42:30.440 | So to dyadic means it has two arguments.
00:42:37.400 | One argument goes on the left,
00:42:38.920 | one argument goes on the right.
00:42:40.520 | Okay.
00:42:43.160 | Any questions about dyadic versus monadic?
00:42:53.680 | So just like in NumPy, you've probably noticed
00:42:58.680 | that you can apply a function to an array
00:43:09.640 | and the function is applied to each element of the array.
00:43:12.600 | Negative of four, negative of two, negative of zero,
00:43:16.680 | negative of minus three, negative of minus five.
00:43:19.440 | So we can do the same thing when it's got two arguments.
00:43:22.760 | We can have one on the right
00:43:24.080 | and then a different argument on the left.
00:43:27.600 | Does that make sense?
00:43:33.440 | So that's element wise, just like NumPy.
00:43:36.120 | Three minus four, two minus five, one minus one.
00:43:51.440 | this also works is you can have a rank one array
00:43:56.440 | minus a scalar and just like NumPy, it'll broadcast this.
00:44:01.840 | So this is three minus one, two minus one
00:44:04.440 | and one minus one and vice versa.
00:44:09.440 | One minus three, one minus two, one minus one.
00:44:19.260 | - Is there much of a culture of using brackets in this world?
00:44:24.260 | - I wouldn't say there's a culture of using parentheses,
00:44:34.320 | but I would say there are times you have to use parentheses.
00:44:37.540 | I would say, I can't imagine anybody would use parentheses
00:44:42.660 | around this, just like in Python, if you were writing,
00:44:46.940 | oopsie dozy, if you were writing 1.5 times 6.2,
00:44:51.940 | we know perfectly well that dot binds tighter than times.
00:44:56.300 | So in Python, nobody would write this, right?
00:45:00.540 | Well, somebody who didn't know that dot binds tighter
00:45:04.420 | than asterix would say like, well, this is much clearer,
00:45:08.660 | but like, yeah, you know, only the first three times
00:45:12.500 | after that, you know perfectly well that this means 1.5 times
00:45:16.420 | 6.2 rather than 1.5 times 6.2.
00:45:19.780 | So a razor everywhere in APL,
00:45:25.620 | so the idea of parenthesizing this in such an expression
00:45:28.520 | would be weird and I've never seen that done.
00:45:31.560 | And I guess in general,
00:45:36.420 | because the kind of parsing and precedence rules in APL,
00:45:42.660 | as you'll discover, are so simple and clear,
00:45:46.460 | parentheses generally only seem to be used in real code
00:45:52.820 | when they're actually necessary rather than just for clarity.
00:45:56.160 | I would say in something like C++,
00:46:00.060 | we see parentheses used for clarity a lot more
00:46:02.660 | because for example, in C++ or even in Python,
00:46:05.620 | the precedence rules are very complicated
00:46:08.060 | and few people remember them
00:46:10.660 | and they're easy to misremember.
00:46:13.880 | All right, so I feel like we've probably done
00:46:19.620 | our first lift, so that's cool.
00:46:23.060 | So our second lift we can do will be plus
00:46:27.340 | and dyadic plus is the easy one.
00:46:34.780 | So maybe I'll just do some copying and pasting
00:46:40.500 | in fact, that's a good way to get a back tick
00:46:43.380 | as I put it in my paste buffer.
00:46:45.120 | Ha ha, all right.
00:46:50.760 | So this one is called conjugate
00:47:00.600 | and then the other one will be called plus
00:47:07.940 | and the overall thing is called plus sign, that's easy,
00:47:12.500 | plus sign and monadic is called conjugate, conjugate
00:47:17.500 | and this is called, oh, got it the wrong way.
00:47:30.940 | I know that's fine, I just have to write dyadic, dyadic.
00:47:37.840 | Maybe I'll make a copy of this underneath the next time.
00:47:41.520 | Okay, so we can basically do the same thing as last time,
00:47:46.520 | paste those here and we will replace dash with plus
00:47:55.240 | and three plus two is five,
00:48:01.120 | rank one array plus rank one array,
00:48:05.380 | rank one array plus a scalar which is a rank zero array
00:48:08.160 | kind of, they all work.
00:48:09.360 | So hopefully that one is straightforward.
00:48:13.300 | Now, conjugate.
00:48:20.340 | So it's pretty normal in APL to provide a rank one array
00:48:34.680 | to an example, because that way you kind of get
00:48:37.200 | to show three examples in one go, right?
00:48:40.400 | So it's important to just look at them one at a time.
00:48:43.000 | That may be, you know, to start with,
00:48:50.460 | we can like do that, but like we shouldn't need
00:48:56.600 | to do this for too long because hopefully we've got the idea
00:48:59.920 | that to read this, it means plus 1.2 plus zero J4
00:49:04.920 | plus minus five J minus six,
00:49:11.560 | which means I think we need to talk about complex numbers,
00:49:14.600 | which is cool because we get to talk about some math.
00:49:25.360 | All right, so is anybody on the call?
00:49:30.360 | And please don't be shy of saying yes,
00:49:43.640 | because we're trying to learn math.
00:49:44.640 | Is anybody on the call don't know at all
00:49:47.000 | what a complex number is?
00:49:48.360 | - Yep. - Yep.
00:49:51.000 | Okay, great.
00:49:52.200 | So have you ever come across the idea
00:49:57.200 | that the square root of minus one is something called I?
00:50:02.360 | - No, I know that I is a thing, but--
00:50:10.600 | - Okay, then is what I is.
00:50:13.840 | So basically the idea is that we can,
00:50:22.080 | we can square things, which means multiply by itself.
00:50:25.680 | So three times three equals nine.
00:50:37.280 | And so what do we have to square?
00:50:39.400 | That means three squared equals nine.
00:50:41.520 | We'll get ahead of ourselves a little bit and no,
00:50:45.360 | let's not, let's just do that.
00:50:49.220 | So to write squared, we can also say to the power of two.
00:50:54.220 | Be very careful, this means power of in APL, not times.
00:51:00.520 | So there's three squared, okay.
00:51:02.720 | And there's four squared.
00:51:04.800 | And so we can do the opposite and say,
00:51:09.800 | what would you have to square to make 16?
00:51:15.040 | And the answer could be either four,
00:51:19.080 | 'cause four times four is 16.
00:51:21.160 | Or it could also be negative four,
00:51:23.680 | 'cause negative four, negative four squared is also 16.
00:51:28.680 | You happy so far?
00:51:31.740 | So then the question is, okay.
00:51:34.600 | Okay, so the question of like, what do you have to square
00:51:37.120 | to get to this number is the square root.
00:51:41.320 | So the square root of 16, and we always take the positive,
00:51:43.600 | the square root of 16 is four.
00:51:47.880 | So then the question is, what's the square root of minus one?
00:51:51.040 | And the answer is, oh, it's the number that you would have
00:51:52.800 | to multiply by itself to get minus one.
00:51:54.760 | Which of course doesn't exist as a real number.
00:51:58.400 | Because minus one times minus one is positive one.
00:52:03.020 | So we just make it up.
00:52:04.840 | We make up a number and we say, okay,
00:52:06.840 | I'm gonna invent a number, I'm gonna call it I.
00:52:09.480 | And I is the number that if you square it,
00:52:11.240 | you get negative one.
00:52:12.380 | And I can't show you I, pineapples,
00:52:17.680 | but I also can't show you negative three pineapples,
00:52:20.720 | you know, they're both like invented ideas.
00:52:24.220 | I mean, I can't even show you the number two.
00:52:27.000 | I can show you the digit two, I can show you two things,
00:52:29.360 | but the idea of the number two is a mathematical concept.
00:52:32.420 | So numbers don't necessarily exist.
00:52:37.260 | And so a lot of mathematicians say I is considered,
00:52:43.280 | is called an imaginary number,
00:52:45.020 | but it's not any more imaginary than any other number
00:52:48.320 | 'cause all numbers are imaginary.
00:52:49.880 | Okay, so you can then create something called
00:52:57.320 | a complex number, which is an imaginary number
00:53:03.120 | plus a real number added together.
00:53:04.960 | A real number being anything that doesn't have I in it.
00:53:08.160 | So for example, here's a real number.
00:53:10.060 | Okay, and here's an imaginary number.
00:53:14.880 | And so that means that this here is a complex number
00:53:17.560 | and there's no way to like reduce that further.
00:53:21.100 | We're done.
00:53:21.940 | Okay, that is the number three plus I.
00:53:25.720 | You can do things with I, you can multiply it by four
00:53:31.480 | and then four times I is four I, that's a number.
00:53:36.480 | You can square it and of course you'd get minus one,
00:53:41.040 | I squared is minus one, you can multiply I by four
00:53:46.040 | and then add three and that gives you the number
00:53:50.320 | three plus four I.
00:53:51.360 | So here is the real part and here's the imaginary part.
00:53:55.680 | And the whole thing is called a complex number.
00:53:58.360 | And you can't like, this is not an equation.
00:54:01.320 | I can't do anything to this.
00:54:02.720 | This is the number.
00:54:03.560 | It's called the number is three plus four I.
00:54:06.620 | In APL, we can write complex numbers
00:54:11.620 | in a slightly more concise way.
00:54:14.320 | And we write them using a J.
00:54:16.040 | On the left-hand side is the real part.
00:54:18.080 | On the right-hand side is the imaginary part.
00:54:20.360 | So this is zero plus four I, also known as four I.
00:54:25.060 | This is negative five plus minus six I,
00:54:32.080 | also known as negative five minus six I.
00:54:37.080 | Does that make sense?
00:54:40.520 | - So complex numbers always involve I.
00:54:44.000 | There aren't any other letters.
00:54:46.520 | - Yep, there's no need for anymore.
00:54:49.200 | We just need the one extra letter,
00:54:51.360 | which is this ability to kind of say like,
00:54:53.080 | oh, there's a second bunch of things in the world.
00:54:56.280 | And the key reason that complex numbers
00:55:00.480 | are really interesting and important
00:55:02.520 | is because you take the number line that we all learned,
00:55:05.720 | like my daughter learned the lumber line in prep, right?
00:55:08.440 | You can move forward along the number line
00:55:11.000 | to get bigger numbers and backward to get smaller numbers.
00:55:14.240 | And after you go forward,
00:55:15.320 | you can then like undo that with negative
00:55:17.120 | to go back to where you started.
00:55:18.680 | When you use a complex numbers,
00:55:22.480 | you move from a number line to a number plane.
00:55:30.040 | And the Y-axis represents how many I's do you have?
00:55:33.400 | And the X-axis represents what the real number is.
00:55:37.460 | And so then you can graph it on a Cartesian plane.
00:55:41.820 | Like so.
00:55:48.600 | So you've got the numbers.
00:55:53.000 | - Jeremy, I think you're not sharing the screen.
00:55:56.880 | - Okay, I never share my screen.
00:55:58.800 | That's just how I am until you're surrounded, tell me to.
00:56:03.560 | Okay, so yeah.
00:56:05.440 | So you've got the numbers on this axis
00:56:07.600 | and the negative ones on this axis.
00:56:09.280 | Yeah, here we go.
00:56:15.080 | So here's our number line.
00:56:16.480 | Here's our number plane.
00:56:19.960 | And so here's three plus four, right?
00:56:22.520 | And so,
00:56:24.360 | in real number only math,
00:56:29.360 | you can multiply by a negative number
00:56:32.800 | and it flips it to the other side.
00:56:35.140 | In complex math, you can multiply by I
00:56:44.000 | and it rotates it by 90 degrees.
00:56:47.240 | I gotta skip the door just a moment.
00:56:52.320 | I didn't realize math, I got home, okay.
00:56:55.320 | So, yeah, they're used for a lot of things,
00:57:10.120 | which kind of expand the world of math to two dimensions.
00:57:20.440 | And they let us work with tuples of two things at a time.
00:57:25.440 | So, yeah, they come up a lot in real life.
00:57:32.320 | And in fact, in physics,
00:57:35.660 | it turns out that our actual real physical world
00:57:38.860 | operates according to the laws of complex numbers,
00:57:43.040 | not real numbers.
00:57:43.960 | So they're very real.
00:57:46.680 | Okay, so--
00:57:49.660 | - It feels like, oh, sorry--
00:57:51.480 | - No, no, no, please I'd like to chat.
00:57:54.160 | So interrupt any time, go ahead.
00:57:56.320 | - Sure, it kind of feels like a complex number.
00:57:58.680 | It's like a shorthand for representing like a 2D
00:58:02.360 | or a rank two array as just--
00:58:04.920 | - It's not a rank two array,
00:58:05.840 | a rank one array of two items.
00:58:08.200 | - Yeah. - Rank, yes.
00:58:10.120 | - Yeah, because you're like using the plane
00:58:13.120 | and the unit circle and stuff,
00:58:15.640 | it feels like you're trying to represent
00:58:18.080 | like that second element of that array
00:58:20.240 | is written in terms of its relation
00:58:22.400 | to the first element or something like that.
00:58:25.320 | - Yeah, yeah, I mean, it's, yeah.
00:58:30.080 | Yeah, I think like getting an intuition
00:58:35.680 | for complex numbers is very interesting.
00:58:38.460 | And maybe we'll add like a,
00:58:40.320 | we should add a forum thread about complex numbers
00:58:43.360 | and put some videos there
00:58:44.560 | 'cause there's a lot of nice videos
00:58:46.020 | about kind of the intuition around this.
00:58:48.040 | So I just wanted to come to a question
00:58:52.880 | that Charles asked on the chat,
00:58:54.240 | which I think is an interesting and good one,
00:58:55.800 | which is, can you explain what your motivations are
00:58:59.880 | for investing your time in this?
00:59:01.440 | What kind of real world applications are there?
00:59:05.280 | Where this being array programming and APL, I guess.
00:59:08.720 | So there's a number of,
00:59:16.700 | of reasons, not all of which are related
00:59:20.380 | to the second part of Charles's question,
00:59:22.900 | which is what are the real world applications of this?
00:59:26.260 | There certainly are some, at least indirectly,
00:59:31.340 | but I'd also say, yeah, it's not my only reason
00:59:35.260 | for being interested is not just real world applications,
00:59:37.740 | but I think first and foremost for me,
00:59:43.740 | math is quite beautiful.
00:59:46.420 | I think it's like a field that can contain a lot of beauty
00:59:51.420 | in a very deep aesthetic way,
00:59:56.900 | but I'd also say it's an area that frustrates me.
01:00:02.140 | Math frustrates me because I find it very kind of inconsistent,
01:00:10.500 | and the notation is often very hard to look up,
01:00:13.780 | and it's also hard for me to understand
01:00:16.460 | what things mean in a very abstract way
01:00:21.500 | when I can't experiment with them.
01:00:24.900 | So one thing for me is it helps me understand math.
01:00:29.700 | It also helps me teach math.
01:00:32.780 | So I'm teaching my daughter math,
01:00:36.140 | and there are things which I was finding difficult
01:00:38.660 | to teach her until I started teaching her with APL
01:00:43.660 | and NumPy.
01:00:46.940 | In particular, sequences in series was the first one
01:00:49.940 | where I just had no luck teaching her
01:00:53.380 | and her friend Gabe sequences in series.
01:00:57.060 | I did a whole hour on it, then we made no progress at all,
01:01:00.780 | and then when we did it via learning first
01:01:04.780 | some NumPy and some APL and then coming back a week later
01:01:07.540 | and then it was easy to explain.
01:01:10.420 | So yeah, so one is, you know, I think a way into math,
01:01:17.500 | one is a way into teaching math.
01:01:21.020 | Another is I think there's such beauty
01:01:26.020 | and power in notation.
01:01:28.100 | In our last study group we talked about the power
01:01:32.100 | of the notation that is regular expressions, for example.
01:01:35.180 | Now APL is a much deeper notation than regular expressions,
01:01:40.180 | but like notation, a powerful notation is a key thing used
01:01:45.820 | to further human intellectual development, you know?
01:01:49.420 | And you'll see this repeatedly, particularly in mathematics,
01:01:52.660 | but also in other areas like physics,
01:01:54.540 | things that like just take hundreds of years
01:01:59.180 | for very smart people to advance,
01:02:00.860 | then somebody finds a notation for that thing
01:02:02.980 | and it powers ahead, so things like algebra,
01:02:06.900 | for example, dramatically, you know,
01:02:09.620 | impacted our ability to develop math.
01:02:12.260 | The notation of numerals that includes the digit zero
01:02:18.380 | also dramatically improved our ability
01:02:20.860 | as a species to develop mathematics.
01:02:23.500 | But you know, other areas like juggling, you know,
01:02:28.380 | there was a development of a notation for juggling
01:02:30.620 | a few years ago and suddenly there was huge developments
01:02:34.500 | in what people were doing 'cause they were able
01:02:36.780 | to manipulate the notation and say like,
01:02:39.540 | oh, what if we move this over here?
01:02:41.100 | Or you know, you start to create ways to manipulate
01:02:44.620 | the symbols in the notation to develop new ideas.
01:02:48.500 | So you know, APL is a very powerful notation,
01:02:53.340 | not just for math, but for a range of things
01:02:56.100 | that can be represented using the similar kind of concepts
01:02:58.900 | that we use in math.
01:03:00.540 | For example, one guy has built a GPU compiler using APL
01:03:05.100 | and they did their PhD essentially in like APL
01:03:08.980 | as a notation for building compilers.
01:03:10.820 | So that would be another one.
01:03:14.740 | At a more pragmatic level, so I learned a little bit of J
01:03:19.380 | before I did any APL, but J is much the same thing.
01:03:23.420 | Yeah, I definitely felt like learning J did more
01:03:26.940 | for my programming skills than any other language
01:03:30.420 | I've learned because APL as a notation was developed
01:03:35.420 | in the late 1950s and so it's been continually developed
01:03:41.340 | in the decades since and really quite a kind
01:03:47.180 | of independent branch to all the other computer languages.
01:03:52.100 | So APL, JK, the array languages have their own little world.
01:03:56.020 | And so if you've not worked with languages from that branch,
01:04:01.020 | you miss out on that entire development of thinking.
01:04:08.180 | Now we'll say nowadays, numpy and derivatives of that
01:04:14.780 | have borrowed a lot of ideas from APL,
01:04:23.700 | but in a very kind of impure way.
01:04:25.380 | So I would say also like for somebody doing deep learning
01:04:31.060 | and that kind of programming,
01:04:32.900 | scientific programming in Python,
01:04:35.380 | yeah, I think you'll discover better ways of thinking
01:04:42.180 | about these kind of loopless programming,
01:04:45.060 | particularly if you then look at things
01:04:46.180 | like Einstein notation or INOPS or stuff like that.
01:04:53.580 | Does anybody else have any other kind of reasons
01:04:55.220 | that were interested in this or questions about that
01:04:59.020 | or anything else?
01:05:02.300 | - I guess for me, it's just a different way of thinking.
01:05:08.700 | I mean, I'm hoping that as the,
01:05:12.700 | I mean, it's always a case you get a big speed up
01:05:17.780 | if you can remove a loop and vectorize things
01:05:22.060 | and you don't really have a choice
01:05:24.780 | but to do that in APL for the most part.
01:05:27.700 | So kind of get a lot better at doing that.
01:05:31.460 | - Yeah, yeah.
01:05:33.820 | I think also like it's an interesting path
01:05:36.060 | into other areas of math, particularly J.
01:05:41.060 | J comes with various labs.
01:05:44.340 | Which you can run on J.
01:05:49.340 | So J is like an APL derivative written
01:05:59.460 | by the original author of APL.
01:06:01.100 | And yeah, it comes with all these labs,
01:06:07.380 | which are really interestingly kind of thoughtfully
01:06:13.700 | put together and basically take you through
01:06:16.300 | some pretty interesting mind bending ideas for mathematics.
01:06:25.900 | So maybe at some point we'll yeah,
01:06:28.340 | morph over to J and try out some labs.
01:06:30.660 | All right.
01:06:40.020 | So to wrap up today's thing,
01:06:45.020 | let's try to finish plus.
01:06:48.020 | So yeah, so dyadic plus,
01:06:50.460 | move it up twice there.
01:06:57.420 | We've already done, not sharing the screen of course.
01:07:03.980 | I'm not sharing my screen 'cause I never remember.
01:07:07.860 | Okay, thanks Alex.
01:07:09.700 | Okay, so monadic plus is conjugate.
01:07:14.700 | So let's learn about that.
01:07:19.260 | So when I click on the specific
01:07:32.260 | monadic or dyadic version, right?
01:07:34.100 | I'll get, so for example here, conjugate.
01:07:37.980 | It'll show me how it's used.
01:07:41.700 | And basically it shows that we start with a number y,
01:07:46.300 | we apply plus to it and the return value of it
01:07:50.380 | is something called r for result or return value.
01:07:54.060 | And then in the description,
01:07:55.260 | it's gonna tell me what each of these things are.
01:07:57.820 | So it says here, if y is complex,
01:08:00.860 | then r the result is y with the imaginary part
01:08:05.060 | of all elements negated.
01:08:08.380 | If it's real or non-numeric, it's unchanged.
01:08:13.380 | So we should be able to view that here.
01:08:16.580 | So here, this is real.
01:08:18.100 | So the return value should be unchanged, it is.
01:08:20.980 | Okay, this is imaginary, this is complex.
01:08:24.660 | The imaginary part is four.
01:08:26.820 | So here is the imaginary part negated.
01:08:29.100 | Okay, and here is another complex number
01:08:34.740 | and this is the imaginary part and here that is negated.
01:08:38.940 | So if you think about it on the number plane,
01:08:41.100 | conjugate flips just like negative does,
01:08:45.020 | but negative flips on the real plane,
01:08:47.100 | conjugate flips on the imaginary, sorry,
01:08:52.100 | negative flips on the real line,
01:08:56.260 | conjugate flips on the imaginary line.
01:08:58.300 | Great.
01:09:04.780 | Well, I think we're done here.
01:09:09.780 | Does anybody have any questions, issues, anything else?
01:09:17.380 | Anything you wanna make sure we cover next time?
01:09:22.460 | Appreciate you guys joining.
01:09:28.140 | This is gonna be fun.
01:09:32.460 | What do we got, 21 participants, that's good.
01:09:34.580 | Yeah.
01:09:35.940 | - Yeah, I think this is gonna be a lot of fun
01:09:38.180 | as we keep going.
01:09:39.660 | - Awesome.
01:09:40.780 | Yeah, so I think, you know, like we actually got through
01:09:44.700 | more than I expected, to be honest.
01:09:46.940 | And I do think we might be able to zip through the glyphs
01:09:51.940 | pretty quickly on the whole.
01:09:55.020 | I'm gonna assume that people like generally
01:09:59.700 | have some reasonable Python background, by the way.
01:10:03.620 | And so sometimes we'll be relying on analogies to Python.
01:10:08.620 | And that should make things a bit faster as well.
01:10:14.700 | All right, I'm gonna, yeah, I'll pop the videos up on YouTube.
01:10:19.700 | I will create a playlist for them.
01:10:22.060 | And let's use the forum, yeah,
01:10:28.820 | for like, add anything you like, you know,
01:10:33.180 | feel free to create new topics about stuff
01:10:38.180 | related to array programming that aren't necessarily
01:10:41.140 | directly related to anything we've talked about, whatever.
01:10:44.980 | This is all very informal.
01:10:46.260 | All right, bye all, thanks.
01:10:50.420 | - All righty, thank you everybody.
01:10:51.900 | - Thank you Jeremy, thank you everyone.