Developments in Code-Building Tools

Wolfram released two new code-building tools in Mathematica v14 to help non-programmers write code. The Geometric Scene Constructor builds plane geometry with a GUI, while the Knowledge Base Explorer queries entities like Pokémon and planets without writing queries by hand.
Chapters
Okay, I think with that we can get started. So today's talk is building on a number of talks and work that has been done over the past three and four years. And it's sort of a subset of things. There's many talks on unrelated topics related to Wolfram Alpha Notebook Edition and sort of the efforts to take Wolfram language and make it more accessible to users, particularly learning users and people who might not have a large experience in computer science or programming and are sort of need some help preparing themselves and learning how to use the syntax and how to, you know, interact with the power that we have at our hands here in Wolfram language. So one of the efforts that started with this, you know, a while ago, and we've presented at past tech conferences a number of times on. So I'm not going to. I'm not going to spend a lot of time talking about Today though, is WolframAlpha Notebook Edition. Right. This takes the power of Wolfram Alpha and the power of Mathematica, brings them together and lets us define functions and plot things and really have access to all of the code that one would want in Mathematica for an early user just using natural language. So we can do things like plot sine of A times X plus B varying A and B. Right. And this fills in translates, fills in the code and all things. Yep, there we go. Gives us a nice thing without us having to ever write a line of code. And one of the things I'll highlight here is that we have our little resource function blob that is showing up and manipulate Plot was one of the first and popular resource functions that my team produced for the purposes of WolframAlpha Notebook Edition, where there's enough going on behind the scenes that to have a single line of code to produce this output, we really do need to have a resource function. It's not something that we can as great as manipulate is for even relatively new users. To make all of this happen in a single manipulate would be a big chunk of code that would be intimidating. So we've hidden things away in resource functions and over the years we've added a number of different. We've added a variety of different categories of these. And new in version 14 of Mathematica and WolframAlpha Notebook Edition, we are adding this interactive tools browser here where we have a number of different things related that are. That are sort of doing similar things. One of the exciting new ones is this ODE viewer for looking at and visualizing solutions to differential equations. So this opens up this Very nice pane and allows you to see, you know, see particular solutions interactively and all again without having to write any code. So I'm not, I'm not. This is not the main focus of the talk today, but mostly to contextualize where we're going, which is we're going to specifically be looking at geometric scenes and a new feature that's that was released over the summer as a resource function and is now included in WolframAlpha Notebook Edition, a data explorer. So I will be popping back over to WolframAlpha Notebook Edition, I think. Well, I'll start here I guess. So I'm going to be going through both of these in more detail, but the main point to show here is that not only have we hooked these up as just resource functions for anybody to be able to use, but we've also hooked these up with linguistics so that again, people who are using WolframAlpha Notebook Edition can continue in that same flow and we give them some examples of how to access these resource functions with the natural language input cells that we have in WolframAlpha Notebook edition here. So, so first we have our geometric scene constructor and then we're going to be looking at our data explorer and I'm going to be walking through these interfaces in much more detail. As you can see, there's a lot going on with them. So that's what we're going to spend the next 20 minutes or so looking at. I know the schedule is quite tight and yesterday I was feeling a little bit of a rush between things, so I'm going to try and end at 8:55, maybe even sooner so we can ask some questions. But yeah, I will be keeping an eye on the chat as we go and I will increase my zoom level. Thank you for that. Hopefully that is better. Sorry for that, but you haven't missed anything important yet. So that's all I had to say about Wolfram Alpha Notebook edition coming in 14, we have this new interactive tools browser and luckily all of these things are packled updatable. So these are sort of continuing to grow. And if you haven't looked at these when 14 comes out, I will encourage you to go check out all of the functions that are here, but not all of them fall under the umbrella of code building tools. So we're going to focus on those today. Geometric scenes have been around for a good while now. There's a talk I think, I think it's later today that I would encourage you to go to if you're interested in learning more about the developments in the synthetic geometry group. But one of the. One of the things that came to light as they were working, as that group was sort of working and developing things, was that the syntax can be a little bit tricky for people to learn. So we wanted a way to be able to enable folks to build a geometric scene without actually initially having to write code and be able to sort of see what is the proper way to specify everything. And where do the different ideas of things like figures and relations between those figures show up in a geometric scene? So I'm going to start with a fairly straightforward scene. We'll look at. I want to circle through and as I'm going through, I'll just point out that we have a number of figures here. We can add new ones and specify these are sort of our geometric primitives, things like points, lines, planar angles, circles, triangles, etc. And depending on which one of these you choose, there are different kinds of specifications that are required for that. So, you know, triangle only requires vertices. A circle through requires a little bit more. A planar angle also requires some points. You can specify an angle if you'd like. So I'm not going to go through exhaustively all of them, but that's sort of where we're at right now. So I'll start with just some points abc and I'll give this a center of O for origin. And if I wanted to, I could specify some greater properties of this. I could specify. Specify that these points are clockwise. And I could also specify a little bit of extra fluff here, some of our styles. I think for now I will try and I'll make this a little fun. I'll make it. Why don't we make it a green circle and we'll see that show up at the end here. But I'm going to close that for now. So then, let's see. I'm gonna. I'm gonna build up a fairly famous theorem. We'll say our vertices are also A, B and C. I don't need to do anything particular with the orientation here, but I do need to add one more thing here and I'm going to. There's a few different ways that we could specify this, but. But I am going to specify that O and B are all on a line together. And for those of you who are in the know, I'm going to actually be able to skip looking at relations here because this is a fairly straightforward scene. But you can see that clicking upon print geometric scene here we get the sort of raw geometric scene object out of this, which is great for being able to look at things, being able to debug. You can see the geometric assertion that we specified that the circle through is clockwise. And we have our three primitives here. A circle through a triangle and a line. And getting rid of that we can also visualize it which just adds the random instance to it. And here we have the built up Thales theorem with. And I think, yeah, I can move this around. So there are some other functionalities built into geometric scene that would allow you to go about sort of drawing conclusions from this. I'm not going to be highlighting those right now. But another way that we could do this would be rather than building a line, I could maybe specify the planar angle ABC again. And I could say this is 90 degrees. Oh no, that's no fun. What happened? Oh shoot. Okay, this is a. I fell prey to my own. This is a known bug and I did a silly thing and it's a thing that we're working on. There's a particular overlap of dynamic interactions that can lead to the crash that we just saw. But that is separate from the interface. So we're going to recover from that. And we had a live stream with Steven somewhat recently and everything went perfectly fine because we were thinking about it and here I am having forgotten about it. So this is just going to take a second to load. And while that's happening, I'm going to. Do a little initialization in the background over here because there we go, we're going to build that up again. We've got a circle through abc. We've got our triangle abc and we're going to look at the same theorem again from a from the sort of opposite perspective where previously we moving that point B we could see that it looks like a right angle. Now we're going to actually force that to be a right angle. And if all goes well, wrong one, if all goes well, we will also see that. Oh, because I didn't give this an O. Okay, so I'll update that. And where is. So that we can have a labeled origin. And we can see yet again if we force this angle to be 90 degrees then the diameter or the chord, we don't know that it's going to be a diameter. But the cord AC is forced to pass through the origin. This is, you know, a famous geometric, one of the early geometric formulations from synthetic geometry. So all of this has been done without actually having to specify any relations if I wanted to. I see a question why does the geometric scene constructor show the points of a line and triangle in curly brackets on the user interface? That's a good question. Basically, we're wanting to hint at the right direction for how you have to specify these things. So in all of these primitives having a list of elements, you do need those to be in a proper list. And it's easier in an input field to keep track of things as a list. So as you saw, it has a little autocomplete built in so that when you. For the elements that need to be in a list, if you enter them without the list element, without the curly brackets around it, it automatically fills those in. That's just a little user convenience built into the interface. Let's say I want to also add a new triangle, and I'm going to call this one whatever xyz, I suppose. And now I can also start building relations between these. So we sort of forced the properties, the geometric properties to show up here without having any relations. But now I'm going to select these two triangles, A, B, C and xyz. You can, you can see, selecting figures. We get all of the points, we get all of the figures, and now we have a smart selection about what kinds of relations your chosen figures could have to each other. And I'm going to force ABC and XYZ to be congruent. And now we get a much more complicated scene going on here. We get our circle through, we get our triangle, we get our planar angle that's properly specified, we get the second triangle, and we have this geometric assertion with congruent added to it. So obviously at this point it's not necessarily doing as much. We just have an extra triangle laid over this. But what this is doing is allowing us to sort of have a textual, visual representation of all of the stuff that's happening here. And then of course, if somebody sees something here and they say, actually, I don't want this to be 90 degrees, I want this to be 45 degrees, we can do that and we get a different kind of result. Interestingly, that looks like it took Thales theorem and did the opposite. I suppose it made this into a right triangle. It just moved A, B and C around a little bit. So I don't know if that's just random instance. Having chosen that looks like it might be a little bit off from the center of the circle there. Oh, but anyways, so this is the, the first attempt that we made at building an interface that allows us to, in a dynamic, interactive way, build up A piece of code that otherwise, you know, the documentation for Geometric Scene is very thorough at this point. There's a lot of examples, there's a lot of things to work through. But for a new user, particularly completely new to Wolfram language, even reading the documentation and absorbing all of the relevant pieces that are needed can be a little bit complicated. So this was our first attempt at that and now I'm going to move on to look at our Wolfram Knowledge Base Explorer. So I'm going to run these because that crash is unfortunately going to make things a little bit slower here. I'd pre preloaded things. So this is working with our entity framework and there's a little bit of pre computation that it does so that the interface can be nice and snappy. But yeah, and I'm actually going to do one more initialization thing that I had run already before and. Yeah, ok, perfect. So this has a very similar look, as you can imagine. There's a similar top to bottom flow. We have three different kinds of outputs at the bottom here that I will get to. But this is broken up into three main sections where we are thinking about selecting particular entities, we're thinking about selecting properties of those entities that we would like. And then sometimes we have qualifiers for those properties. In this case the Pokemon domain doesn't have any qualifiers. So we're just looking at the sorting of the entities and I'm just going to go ahead and there's already some things selected here. There's a particular type, Fire type Pokemon that are yellow and we want to see all of these particular properties for those. And I'm just going to go ahead and show the data set here. So this, similar to the geometric Scene constructor, produces a piece of code. In this case, again, the entities are really fantastic when you're using WolframAlpha or when you're using the equal or Control equal to access them. But for new users, these can be a little bit finicky to wrap their heads around knowing what the particular domain names are and knowing what the properties are and how to put them all together. So we can modify this in just a moment. But this has already put together a fair amount of information based on the knowledge base that we have. In this case we're looking at ninetails, which is yellow, and we have all of these particular properties already populated in our data set here. So Pokemon, obviously I grew up with Pokemon, so I have a sentimental affinity for it, so that's why I started with that. But we have a constantly growing set of supported Domains for this. There's a little bit of work that we have to do behind the scenes to make sure that these are supported fully. So we, we can't just let it loose on every domain, every entity domain out there. But yeah, essentially all of these. And this list is continuing to grow. So it doesn't take a huge amount of work for developers to add these domains to the interface. And let's see, I'm going to run the planet domain so that we can look at it just to be able to, to highlight some of the, the other elements going on here. So let's look at. In this case, we're going to specify planets that are a certain distance, a certain number of astronomical units away from Earth. And I want to look at only ringed planets. Let's look at the, the planets known to ancient people. So I'm, I'm not a domain expert on these areas, so I'm going to shift this a little bit. I'm hoping that this will catch some of the planets that people knew about long ago. And in this case I'm, let's say I'm interested in some physical properties. You can see there are many, many properties that we could pick up. This is why the entity framework gets overwhelming for people because there is so much information available for some of these domains that being able to sort of work through it programmatically or, you know, going entity call by entity call can be, can be a little overwhelming. So in this case, we've, we have the defaults of average radius and mass already selected. I think, I don't want to say mass. I think I want to look at color. If we're looking at things that we specified, that we're looking at the entity class of planets that ancient people knew about, they probably were looking at color. And let's look at the ring, since we're looking at. Oh no, we weren't looking at ringed planets, but yeah, let's, let's look at that and maybe rotation period. That's probably something. Oh no, that's the rotation. I'm thinking about their own orbit, but that's not going to show up here either. Anyways. Okay, maybe known satellites, maybe, maybe somebody. You know, one of the big conclusions in early astronomy was recognizing that there were other satellites orbiting other planets. So maybe we can look at those. And in this case, I'm going to remove the other properties just so we can really hone in on those particular properties. And we want the name, so that's. And maybe discovery date and all of these Things actually I have picked are probably not. Yeah, let me pick something that is going to be okay, I'm going to pick what constellation the planet is in, and that is going to depend on the date. So here we can specify for all of these entities, for all the properties that we're looking at a particular date. I'm going to maybe pick let's, let's say this date in 2000. And yeah, from there I also want to look at them from, in order of distance from Earth. And in this case I'm going to see do we actually have any planets? Okay, so I've picked some. I've picked a set here that we didn't know any. That that is an empty set. So I'm going to remove the distance from Earth and I'm going to try that again. And here we go. So now, now we're just looking at. These are the five apparently planets that were known by ancient folks in our database. And I can now go ahead and look at either the raw entity property association of that, all the information that we were looking at. This is a lot. So that's why we have our data set option here. And this organizes things quite nicely into looking at, you know, all of those properties that we were just looking at. So I think with that, this is, this is sort of a quick tour through these two interfaces. Again, the idea being that we really are working to lower the bar of entry to these really powerful tools that we have in the geometric scene and synthetic geometry tools and the, the whole entity framework that at times I think some people have thought is a little underutilized. There's a lot of really fantastic stuff there. And I know in some of the other talks that I've been to, we've talked about the, you know, using these and getting users into thinking about accessing data and, you know, sort of building those computational thinking skills that I know Stephen is, is very happy to, to talk about. So with that, it's. We're at, we're at five till and I think I will wrap up there. I would encourage you to play around with these yourself. The notebook for. With both of these resource functions is in the talk handout section. And I'm going to take a moment and look at the questions. What's my favorite Pokemon? Very important question. I am a Ghost Pokemon fan, so I won't be more specific than that. I have a question. Are 3D graphics compatible with the scene constructor? So at present, the geometric scene framework is designed specifically for plane geometry. So the sort of traditional you know, high school geometry and only looking at the things that you construct, the sort of constructible geometric figures. So I hope that answers that question. And a good question, are these WolframAlpha pods? I assume based on the timestamp that that's talking about these outputs here for the Wolfram Knowledge Base explorer. And no, These are not WolframAlpha pods. We did follow a similar sort of design philosophy here of organizing things by topic type, but individually These are not WolframAlpha pods. These sorts of things, the data that you get out of these entity value calls is the kind of stuff that would show up in a WolframAlpha podcast. WolframAlpha is obviously much more, well, both sometimes general and sometimes specific. Right. So you can. Building up this kind of query is a little bit difficult in WolframAlpha because we've specified a number of different things and the linguistics for all of that get quite complicated. So this is sort of is taking a step further from Wolfram Alpha where the natural language processing is really great, but it isn't quite as specific as being able to go through and manually choose through all of these different kinds of properties. So thank you for that question. Any other questions, comments? If not, I'm happy to end a few moments early and oh, I see a few other things. Thanks do very. Thank you very much. And is real time. Is real time. Click and drag on the agenda for geometric scenes. I will point that to. I'll point that question to Dan or some of the other folks on the geometry team who will be going to some of the other talks. So I'll point you to that. I imagine right now is not immediately on the agenda. There's a fair amount of kind of fancy math. Stephen mentioned this yesterday at the keynote. There's some fancy math going on to. To translate these abstract representations into these visualizations. And the. There's another question. Is there a way to look and see the behind the scenes of these GUIs? There is. And you are correct to. To identify that these resource functions are pointing themselves to a packlet. We've done that to be able to sort of more quickly roll out features to these. To these functions. I'm happy to answer questions. You can message me, I think through the, through the conference platform and I can talk more about that. But yeah, the code is not entirely hidden away. It just requires a little bit of digging to get to that packlet. There is a fair amount of code going on behind the scenes. So we've shared things and as you can probably tell there's some shared styles between these two interfaces and that in order to avoid having duplicate code bases, we've packetized things so that we can essentially be efficient with our code and be able to make changes globally. So, yeah, thanks everybody for coming. And breeders question. I'm not sure if I saw your question. Oh, any tips for. Thank you. Any tips for someone who would be interested in building their own knowledge base explorer for a different domain? Basically, I'll leave this as my last comment. If there's a domain that you really want, shoot me a message and we will get it done. As it currently stands, I'm not a. I'm not a data person, so I don't know if you can really build your own things into the entity framework. That would be another level of complication I think, if you were adding your external data. But if there's an internal data domain that you'd really like to see here. Yeah, shoot me a message and I will pass that along to the right people and we'll get it added. As I said, it's pretty easy. So these were just sort of a first smattering of the various domains that we have supported. And with that we've reached the top of the air hour. So thank you. Thanks everybody so much and I hope you enjoy the rest of the conference.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






