Featured Post

Hi everyone! It's been a remarkably long time since I posted on MaplePrimes -- I should probably briefly reintroduce myself to the community here. My name is Erik Postma. I manage the mathematical software group at Maplesoft: the team that writes most of the Maple-language code in the Maple product, also known as the math library. You can find a longer introduction at this link.

One of my tasks at Maplesoft is the following. When a request for tech support comes in, our tech support team can usually answer the request by themselves. But no single person can know everything, and when specialized knowledge of Maple's mathematical library is needed, they ask my team for help. I screen such requests, answer what I can by myself, and send the even more specialized requests to the experts responsible for the appropriate part of the library.

Yesterday I received a request from a user asking how to unwrap angles occurring in an expression. This is the general idea of taking the fact that sin(phi) = 'sin'(phi + 2*Pi), and similarly for the other trig functions; and using it to modify an expression of the form sin(phi) to make it look "nicer" by adding or subtracting a multiple of 2*Pi to the angle. For a constant, real value of phi you would simply make the result be as close to 0 as possible; this is discussed in e.g. this MaplePrimes question, but the expressions that this user was interested in had arguments for the trig functions that involved variables, too.

In such cases, the easiest solution is usually to write a small piece of custom code that the user can use. You might think that we should just add all these bits and pieces to the Maple product, so that everyone can use them -- but there are several reasons why that's not usually a good idea:

  • Such code is often too specialized for general use.
  • Sometimes it is reliable enough to use if we can communicate a particular caveat to the user -- "this will not work if condition XYZ occurs" -- but if it's part of the Maple library, an unsuspecting user might try it under condition XYZ and maybe get a wrong answer.
  • This type of code code generally doesn't undergo the careful interface design, the testing process, and the documentation effort that we apply to the code that we ship as part of the product; to bring it up to the standards required for shipping it as part of Maple might increase the time spent from, say, 15 minutes, to several days.

That said, I thought this case was interesting enough to post on MaplePrimes, so that the community can take a look - maybe there is something here that can help you with your own code.

So here is the concrete question from the user. They have expressions coming from an inverse Laplace transform, such as:

F := -0.3000*(-1 + exp(-s))*s/(0.0500*s^2 + 0.1*s + 125);
f := invlaplace(F, s, t)*u(t);
# result: (.1680672269e-1*exp(1.-1.*t)*Heaviside(t-1.)*(7.141428429*sin(49.98999900*t-
#         49.98999900)-357.*cos(49.98999900*t-49.98999900))+.1680672269e-1*(-7.141428429*sin
#         (49.98999900*t)+357.*cos(49.98999900*t))*exp(-1.*t))*u(t)

I interpreted their request for unwrapping these angles as replacing the expressions of the form sin(c1 * t + c0) with versions where the constant term was unwrapped. Thinking a bit about how to be safe if unexpected expressions show up, I came up with the following solution:

unwrap_trig_functions := module()
local ModuleApply := proc(expr :: algebraic, $)
  return evalindets(expr, ':-trig', process_trig);
end proc;

local process_trig := proc(expr :: trig, $)
  local terms := convert(op(expr), ':-list', ':-`+`');
  local const, nonconst;
  const, nonconst := selectremove(type, terms, ':-complexcons');
  const := add(const);
  local result := add(nonconst) + (
    if is(const = 0) then
      const := evalf(const);
      if type(const, ':-float') then
        frem(const, 2.*Pi);
        frem(Re(const), 2.*Pi) + I*Im(const);
      end if;
    end if);
  return op(0, expr)(result);
end proc;
end module;

# To use this, with f defined as above:
f2 := unwrap_trig_functions(f);
# result: (.1680672269e-1*exp(1.-1.*t)*Heaviside(t-1.)*(7.141428429*sin(49.98999900*t+
#         .27548346)-357.*cos(49.98999900*t+.27548346))+.1680672269e-1*(-7.141428429*sin(
#         49.98999900*t)+357.*cos(49.98999900*t))*exp(-1.*t))*u(t)

Exercise for the reader, in case you expect to encounter very large constant terms: replace the calls to frem above with the code that Alec Mihailovs wrote in the question linked above!

Featured Post

We had the exciting opportunity to interview Dr Trefor Bazett, a math professor at the University of Victoria who also regularly posts videos to his YouTube channel explaining a wide variety of math concepts, from cool math facts to full university courses. You may also recognize him from the recent webinar he did on effective interactive learning! If you’re a teacher, and particularly if you’re trying to find ways to keep your students engaged when teaching math online, read on for some great advice and perspective from someone who’s already built a significant online following. If you’re not a teacher, read on anyways! We may not all be teachers, but we’ve all been (or are!) students. And as students, we probably all have some opinions on how things should be taught! Read on for a new perspective, and maybe even some new ways to approach your learning in the future.

A picture of Dr Trefor Bazett with his hand outstretched towards the camera. He is wearing a shirt with the symbol for pi with a rainbow pride flag in the background.

What are some unique challenges presented by teaching math online, and how do you overcome them?

Teaching online I work a lot harder to keep students truly engaged. I’m a big believer in active learning, which means that students are actively taking part in their learning through solving problems, asking questions, and making connections themselves. This might seem a bit strange coming from a YouTuber since watching a video is one of the most passive ways to learn! When it is an in-person class, the social pressures of that environment make it easier to create a supportive learning environment that fosters active engagement. When I teach online, I try to scaffold interactive activities and learning opportunities around my videos, but for me at least it is challenging! I find it easier in many ways to think of the passive components of my teaching like creating a video that introduces a topic but designing learning activities around those videos where students are engaged and feel like they are part of a supportive community is crucial. 

Do you think the experience of teaching online has led to any positive trends in education that will live on once students are back in the classroom?

Absolutely. Whether we wanted to or not, teachers now have experience and skills integrating technology into their learning because so many of us had to figure out how to teach online. The big question is how do we leverage these new technological tools and experiences and resources we have created for when we return to the physical classroom? Can we reincorporate in a new way, for instance, the videos we created for the pandemic? We have so many amazing tech tools – and of course I have to shout out Maple Learn as one of those! – that made it possible for students to engage in interactive learning in the online space, but now we can think about all the ways to leverage these tools in face-to-face learning whether as part of a classroom demo, in-class student activities, or outside-of-class activities.

How do you think the influx of math educators on social media, such as yourself, has changed and will change the shape of math education?

I’m so proud of the math education community on YouTube and other platforms, the quality and diversity of math education online is truly incredible. Having universal access to free high quality education materials can really help level the playing field. But there is still a crucial role to the classroom as well, whether it is in person or online. Just watching YouTube videos on a math channel isn’t going to be enough for most people. You need to be actively practicing math in a supportive environment, receiving feedback on your progress, and getting help when you need it. I feel there is a lot of opportunities for teachers to leverage online materials for instance by linking students to excellent expository content while in class teachers are focusing on designing engaging active learning activities.

What made you decide to create a YouTube channel? Do you have any tips for others wanting to do the same?

My first online course was designed asynchronously and so I needed a place to host the videos for that course. Why not YouTube? I only had twenty students in the course, and never imagined anyone else would actually watch them, let along millions of them! But when I noticed my first math video that got picked up by the YouTube search algorithm and I kept getting comment after comment thanking me I realized there really was a big appetite for quality math education content on YouTube.

My biggest tip is just to get started! Your first video isn’t (probably!) going to be the one that gets picked up by the YouTube algorithm, but it is the one that starts you on that path and builds up your skills at telling math stories, speaking to the camera, using the technology, and so forth.  Don’t worry about that first video being completely perfect or mimicking the “style” of other YouTubers, use it as a chance to build from. If you want to know more about my process for making videos, I share a lot of my process here.

What do you think is the best way for students to approach homework problems?

Homework is often perceived, rather understandably, as a burdensome chore you frustratingly have to do. If that is the perception, then it is also understandable that students would take behaviours that might help them get points on the homework but aren’t very effective for learning. However, if you think about homework as both an opportunity to learn and an opportunity to get feedback on how effective your learning is, now you can engage in much more effective behaviours.

My suggestion is to always genuinely try the problem on your own first. If I’m completely stuck, I really like to write down everything I do know about the problem such as the definitions of the math words involved in the problem. This makes it so much easier to see all the pieces and figure out how to assemble them a bit like a jig-saw puzzle.

I’m a big believer in self-regulated learning, where you are identifying precisely what you know and what you don’t know, and then adapting you learning to zero in on the parts that are challenging. Technology tools like Maple Learn that provide step-by-step solutions to many types of math manipulations can help with this self-regulation, for instance by verifying that you correctly did some cumbersome algebra or precisely where the mistake is at.

Even if you have solved the problem, you can still learn more from it! You can imagine how the instructor could modify that question on a test and if so how would you respond? You can map out how this problem connects to other problems. You can write down a concept map of the larger picture and where this problem fits in it. I have a whole video with a bunch more strategies for approaching homework problems beyond just getting the answer here.

As a teacher, what is your opinion on providing students with step-by-step solutions?

Step-by-step solutions definitely have a role. To master math, you need to master a lot of little details, and then the deeper connections between ideas can start to form. Step-by-step solutions can really help support students mastering all those little details because they can identify the precise location of their confusion as opposed to just noting they got the wrong answer and not be able to identify where exactly their confusion lies. I think they can also help lower math anxiety as students can be confident they will have the tools to understand the problem.

However, it is important to use step-by-step solutions appropriately so that students use them as a supportive learning tool and not a crutch. Sometimes students try to learn math by mimicking the steps of some process without deeply understanding why or when to apply the steps. There can be a big gap between following a solution by someone else and being able to come up with it yourself. This is where teachers have an important role to play. We need to both be clear in our messaging to students about how to use these supports effectively, as well as to consistently be asking formative questions that encourage students to reflect on the mathematics they are doing and provide opportunities for students to creatively solve problems. 

You spoke a bit in your webinar about the “flipped classroom” model. Do you have any tips for educators who want to move more towards a flipped classroom where in-class time is focused on discussion and exploration?

I really love flipped classroom approaches. The big idea here is that students established foundational content knowledge before class, for instance by watching my pre-class videos, so they are empowered to do more collaborative active learning in class. The social supports of class are thus focused on the higher-level learning objectives. However, as much as I love this approach, it is just one of really an entire spectrum of options that start to shift towards student-centered learning. My main tip is to start small, perhaps just adding in one five-minute collaborative problem to each class before jumping all the way to a flipped classroom pedagogy. For myself, it took a few years where I kept adding more and more active learning elements to my classroom and each time I did that I felt it worked so well I added a bit more. One positive consequence from the pandemic-induced shift to online learning is there is now a tremendous amount of high-quality content available for free, so it is easier today to start embracing a fully flipped classroom than it has ever been.

What are some ways teachers can let students take their learning into their own hands?

This is so important. Sometimes teaching can be too paternalistic, but I think we should trust our students more. Give students the time and space to try tackling interesting problems and it will happen! Our role as teachers is to create a supportive learning environment that is conducive to students learning. A few ingredients I think that can help are firstly to encourage students to collaborate and support each other. Mathematics is an inherently collaborative discipline in practice, but this can also be very helpful for learning. Secondly, we can provide effective scaffolding in problems that provide avenues for students to get started and making progress. Thirdly, tech tools like Maple Learn let us take some of the friction away from things like graphing, cumbersome algebra, and other procedural computations meaning we can instead focus our learning on developing conceptual understanding.

In your opinion, how can we motivate students to learn math?

Authenticity. Motivation is sometimes divided between intrinsic motivations (enjoyment of the subject itself) and extrinsic motivations (for instance wanting to get a good grade), and in general we learn more effectively and more deeply when we are intrinsically motivated. To capture intrinsic motivation, I always try to make my teaching and the problems I ask students to work on to feel authentic. That might mean the problem connects to real world challenges where students can see how the math relates to the world, but it doesn’t have to! A problem that stays in pure math but asks and answers interesting mathematical problems and delights the learner is also great for intrinsic motivation. If students are empowered to tackle authentic problems in a supportive learning environment, that motivation will naturally come.

What’s your favourite number, mathematical expression, or math factoid?

Somewhere on the surface of the earth, there is a spot that has the exact same temperature and pressure as the spot exactly opposite it on the other side of the earth. This is true no matter what possible weather patterns you have going on all around the earth! That this has to always be true is due to the Borsuk-Ulam theorem and if you want to know more about this theorem and its many consequences, I’ve done a whole video on it here.

Any parting thoughts?

At the start of every new school year, I read about dozens of cool ideas and am tempted to think “I want to try that!”. I suggest instead finding one thing to improve on the year before, one thing that you can really invest in that will make a difference for your students. You don’t need to reinvent the wheel every year!

The Haar system

Maple 2015 asked by Gonzalo Ga... 135 September 17

Error, recursive assignment

Maple asked by Davidsenja... 0 Yesterday

How can I link a m file?

Maple asked by mmcdara 2694 September 17

Putting several plots altogether

Maple asked by mohandt 15 September 17