Developing in Sage for high school education

Skip to first unread message

Tanmay Kulkarni

Jun 11, 2022, 3:20:22 AM6/11/22
to sage-edu
Hello all,

My name is Tanmay Kulkarni and I am a rising sophomore. I have also been taking several extracurricular math classes with Squares & Cubes on things like number theory, group theory, discrete math, and linear algebra. In these classes we have utilized Sage to explore mathematical patterns. For instance, in my discrete math class, I used Sage's graph functionality to take a stab at graph isomorphism, which eventually lead to a magazine article on using random walks on graphs to solve graph connectivity.

During these various explorations, I realized that Sage was a very powerful tool to explain and provide intuition for complex mathematical concepts, however, (a) it is mainly used by those working in higher math, and (b) there is a high barrier of entry to implement concepts (even ones in lower math) in Sage.

Thus, I wanted to contribute to Sage and implement specific concepts which I felt high school students like myself would find interesting, and use them for educational purposes (e.g. at my school). Two basic ideas I thought of were:
  1. Random walks. I think mathematics is often far more engaging with a visual component (for instance, teaching graphing skills and different types of equations through a Desmos art project), and I think when talking about probabilities and randomness, an excellent visual representation of stochastic processes is random walks, which are currently not implemented in Sage. The other advantage of this is that random walks are often present in other places such as physics (in Brownian motion). This could expand into
  2. Venn diagrams. Venn diagrams are incredibly important; however, I could not find any Sage implementations of Venn diagrams beyond simply plotting intersecting circles. Having a more solid implementation could provide a strong, visual intuition for a variety of concepts, like basic set theory, logical operators, probability, and even open the door for Edwards-Venn diagrams! Such an implementation would utilize Sage's 2D graphics (specifically the circle and text functions) as well as the detailed Set implementation.

Several people who I contacted referred me to this group, and thus I am wondering if anybody would be generous enough to (a) provide thoughts on the feasibility and usefulness of such an endeavor, (b) provide some direction or guidance as to where to begin, and (c) offer potential avenues where this could be used.

Until then, I will be beginning to work on any very simple bug fix I can find to familiarize myself with developing in Sage.

Thank you so much!

Tanmay Kulkarni

Gregory Bard

Jun 17, 2022, 2:46:50 PM6/17/22
to sage-edu
Hi there! I'm sorry for the delayed response.

I also love Venn Diagrams and discrete mathematics. I had been working on a textbook for discrete mathematics, Discrete Structures in Math---A Problem Solving Approach, for several years, but I had to pause it because of the urgent need to update Sage for Undergraduates. Though my discrete mathematics coverage has nothing to do with Sage, I think you might find that motivated high-school students are fully able to do most of the problems. (See Ch 1 and Ch 2 here: .) At some point in the future, I do plan on finishing that book, but the drafts are rather clean. By the way, I think Venn Diagrams are best done with paper-and-pencil... but you could teach some very elementary SQL alongside the set theory, to combine computer science and mathematics.

If you've been studying group theory and discrete mathematics, I think you'll find the 2nd edition of Sage for Undergraduates very easy to read. It should be released in August. In Chapter 1, which introduces Sage to the beginner, I deliberately quarantined the calculus until near the end to provide for the possibility of use in high schools. Prof Beezer's book on linear algebra ( is also easy to read.

In Ch 5 of Sage for Undergraduates, I teach the reader to program in Python by using Newton's Method (, which requires calculus, as the running example. This could have easily have been instead the secant method (, which despite its name has nothing to do with trigonometry. This could give a high-school student exposure to the concept of an iterative algorithm, root finding, and successive approximations. It also lends itself well to graphical explanations, and even animation.

If you like random walks, then you might want to do something with the binomial model of stock prices and pricing stock options. You could combine a bit of finance, a bit of computing, and a bit of mathematics that way. You don't need to know very much at all about stocks to study this topic. There's already an interface where you can get stock data from inside of Sage.

For younger students, I think it would be very good for their critical thinking and even their reading ability, as well as their math, to solve mathematical word problems and puzzles that result in systems of linear equations. The student must analyze the word problem, and come up with a system of equations. Let the computer solve the equations, but then let the student interpret (and verify) the result. Some superb but challenging examples can be found in Problem Solving through Recreational Mathematics, by Bonnie Averbach and Orin Chein, re-published by Dover Publications but originally from 1980. Some easier examples can be found in The Complete Idiot's Guide to Algebra Word Problems Paperback, by Izolda Fotiyeva, published by Alpha Books in 2010. Actually, for 2 variables and 2 equations, I'd say that the student should solve it by hand, and for 4 equations and 4 variables (or larger) let Sage do it. The case of 3 and 3 to be left to those instructors who are more familiar with this age group.

The artificial intelligence method called "model checking," or sometimes "entailment," would combine a bit of combinatorics and a lot of logic. I always wanted to code up something in Sage for problems of roughly 24 or fewer variables. In contrast, a 4-variable Venn Diagram is already hard to draw ( In any case, model checking---when done rigorously---uses "certainly false," "certainly true" and "not certain," a way of looking at the world that I have found useful in ordinary life, in stark contrast to boolean logic with only "true" and "false." As algorithms in artificial intelligence go, it's one of the easiest.

As you can see, it took a lot of research to dig up all these resources for you, so I hope you will forgive the delay in responding.

Enjoy your summer!
---Gregory V. Bard

Tanmay Kulkarni

Jun 19, 2022, 2:52:01 PM6/19/22
to sage-edu
Hello Mr. Bard,

Thank you so much for all of these resources - I especially like the idea about the 4-variable Venn diagram (as there is a lot of gateways to other topics in math and CS that start from Venn diagrams that I think high schoolers would find interesting and moderately challenging as well)!
I will definitely look at Discrete Structures in Math as well as Sage for Undergraduates.

I really appreciate the detail and explanation for each of these links - I will have to take some time to examine all of them!

Reply all
Reply to author
0 new messages