WOLFRAM

Wolfram Language

Education & Academic

New Interactive Course Teaches Useful Tips from an Expert Programmer

Wolfram Language has a wealth of built-in functions that require little or no programming, but there are special cases that require additional skill and knowledge to get the code to do things that go beyond those built-in capabilities. Wolfram U is pleased to announce a new free interactive course by veteran Wolfram programmer and instructor Dave Withoff that offers a collection of useful tips and instruction for intermediate-level programmers. This course will expand your understanding of Wolfram Language and help you to write more complex programs for custom results.

Let me start by saying that for beginners to the language, the free interactive course An Elementary Introduction to the Wolfram Language continues to be the best way to start learning how to write programs with Wolfram Language. A Guide to Programming with Wolfram Language is intended as a follow-on course for users who are ready to delve deeper into the language.

If you’re already familiar with the language and prepared to dive in to more advanced topics, you can explore the interactive course by clicking the following image before reading the rest of the blog post.

Motivation from History

To introduce Wolfram Language and modern computational thinking to the world, Stephen Wolfram published An Elementary Introduction to the Wolfram Language in 2015. Functionality gains for the Wolfram Cloud soon made it possible to turn the book into a full interactive online course that includes videos, exercises and a scratch notebook in an easy-to-use interface, available to anyone with an internet connection. Indeed, lessons from the introductory course have been viewed over a million times on computers, tablets and smartphones around the globe since its launch.

The new intermediate-level programming course grew out of user interest for more advanced lessons and a desire to address questions from experienced users related to topics such as assignments and evaluation rules, patterns, program interfaces and plotting. Dave Withoff has been using Wolfram Language since the release of Mathematica 1.2 in 1989. Dave was a developer of packages and internal code for early versions of Mathematica and is an experienced instructor in the world of academia and with Wolfram U. He has used his expertise with the language to create the new course lessons, sharing tips and techniques he has developed over the years.

Overview

Students should have some knowledge of Wolfram Language programming before they begin the course, which includes intermediate-level topics, such as the structure of expressions, variable localization and other details about the basic design of the system. Later sections include lessons on speed and memory efficiency, construction of interactive user interfaces, data visualization and debugging.

Here is a quick look at some of the lessons included in the course (shown in the table of contents in the left-hand column):

Even though the content goes beyond the introductory level, it should not take very long to complete this course. You should be able to finish the 22 short videos and eight quizzes in about four hours. The course tracks your progress automatically and generates your personalized certificate of course completion when you finish.

The next few sections of the blog post describe the different interactive course components in detail.

Lessons

The body of the course is a set of 22 lessons, starting with “Multiparadigm Programming.” This introductory lesson uses hands-on examples to illustrate different programming styles, followed by dedicated lessons on functional and rule-based programming that demonstrate different ways of writing programs in Wolfram Language.

Course sections include "Basic Language Structure," "Values and Variables," "Common Special Expressions," "Program Interfaces," "Plotting," "Analyzing and Optimizing Programs" and "Selected Applications." Each section has two or three lessons and an auto-graded quiz to test your understanding.

The videos range from 6 to 15 minutes in length, and each video is accompanied by a lesson notebook displayed on the right-hand side of the screen. There is an embedded scratch notebook where you can copy and paste Wolfram Language input directly from the lesson so you can try the examples for yourself.

Exercises

Each lesson comes with a set of exercises to practice the concepts. A detailed solution is provided for every exercise because the course is designed for independent study. The following shows an example from the lesson on knowledge representation, from the "Program Interfaces" section:

The notebooks with the exercises are interactive, so students can try variations of each problem in the Wolfram Cloud. In particular, they are encouraged to change the variables in examples and investigate the documentation and options available for built-in functions.

Quizzes

At the end of each section is a short, multiple-choice quiz with 10 problems. The quiz problems are at roughly the same level as those shown in the lessons, and a student who reviews the section thoroughly should have no difficulty in doing well on the quiz.

Students will receive instant feedback about their answers to the quiz questions, and they are encouraged to try hand and computer calculations to solve them.

Certifications Available

Students are encouraged to watch all the lessons and attempt the quizzes in the recommended sequence because course topics may rely on earlier concepts and techniques. When you complete the course, you can download a personalized certificate of completion. You will earn a course certificate after watching all the lessons and passing all the quizzes. Your progress is tracked automatically for you within the course using your Wolfram ID, making it easy to just pick up where you left off if you exit and return to the course later. A course certificate adds value to your professional resume, school and job applications or social media profile. This course provides useful preparation for the Wolfram Language Level I certification exam, and students are encouraged to take the exam and earn a proficiency certification.

Feedback from Daily Study Group Participants

Wolfram U offered a sneak peek of the course lessons and quizzes to Daily Study Group participants this spring, and we received some valuable feedback. Here is what participants said:

“This course improves efficiency by enabling me to keypunch less and giving me the knowledge to reduce computer run time.” “[Exercises] are always helpful and fun.” “Multiple Choice questions are adequate to test one’s knowledge. The best exercises were those when we were asked to program a solution for a problem with a specific outcome. It shows the versatility of Wolfram Language.” “I refer to the various notebooks included in the course to serve as examples and demonstrations of concepts applicable to the task on which I am working. Those dealing with symbolic computation are most helpful.” “The programming guide was very helpful, provided insights into the language.”

A Building Block for Success

I think you’ll find this new interactive course to be an enjoyable learning experience on your journey to become a more advanced and skilled user of Wolfram Language, just like our Daily Study Group cohort did. I hope you’ll reach out to let us know about the ways you find the course helpful and to share stories about your results. As always, we welcome any comments or suggestions for future courses and certifications.

Acknowledgments

I’m grateful to Andre Kuzniarek at Wolfram for suggesting the course concept; to the author, Dave Withoff, for answering the call to create this collection of programming topics; and to the Wolfram U staff who contributed to making it a reality. I would specifically like to acknowledge Cassidy Hinkle, Laura Crawford and Mariah Laugesen of the Wolfram U team.

Want more help? Register for one of Wolfram U’s Daily Study Groups.
Education & Academic

Learn Algebra from the Ground Up with Wolfram Language

Algebra is an essential course for understanding nearly all mathematics at the high-school level and beyond. Whether you plan to calculate profits at a business, balance a chemical equation, write efficient computer code or even just figure out which weights to put on the bar at the gym, algebra is completely indispensable. It’s no wonder that elementary algebra is a required field of study regardless of your eventual career or academic goals.
Announcements & Events

Trees Continue to Grow 🌱🌳

Last year we released Version 13.0 of the Wolfram Language. Here are the updates in trees since then, including the latest features in 13.1.

 

Trees Continue to Grow 🌱🌳

In Version 12.3 we introduced Tree as a new fundamental construct in the Wolfram Language. In Version 13.0 we added a variety of styling options for trees, and in Version 13.1 we’re adding more styling as well as a variety of new fundamental features.

An important update to the fundamental Tree construct in Version 13.1 is the ability to name branches at each node, by giving them in an association:

&#10005

All tree functions now include support for associations:

&#10005

In many uses of trees the labels of nodes are crucial. But particularly in more abstract applications one often wants to deal with unlabeled trees. In Version 13.1 the function UnlabeledTree (roughly analogously to UndirectedGraph) takes a labeled tree, and basically removes all visible labels. Here is a standard labeled tree

&#10005

and here’s the unlabeled analog:

&#10005

In Version 12.3 we introduced ExpressionTree for deriving trees from general symbolic expressions. Our plan is to have a wide range of “special trees” appropriate for representing different specific kinds of symbolic expressions. We’re beginning this process in Version 13.1 by, for example, having the concept of “Dataset trees”. Here’s ExpressionTree converting a dataset to a tree:

&#10005

And now here’s TreeExpression “inverting” that, and producing a dataset:

&#10005

(Remember the convention that *Tree functions return a tree; while Tree* functions take a tree and return something else.)

Here’s a “graph rendering” of a more complicated dataset tree:

&#10005

The new function TreeLeafCount lets you count the total number of leaf nodes on a tree (basically the analog of LeafCount for a general symbolic expression):

&#10005

Another new function in Version 13.1 that’s often useful in getting a sense of the structure of a tree without inspecting every node is RootTree. Here’s a random tree:

&#10005

RootTree can get a subtree that’s “close to the root”:

&#10005

It can also get a subtree that’s “far from the leaves”, in this case going down to elements that are at level –2 in the tree:

&#10005

In some ways the styling of trees is like the styling of graphs—though there are some significant differences as a result of the hierarchical nature of trees. By default, options inserted into a particular tree element affect only that tree element:

&#10005

But you can give rules that specify how elements in the subtree below that element are affected:

&#10005

In Version 13.1 there is now detailed control available for styling both nodes and edges in the tree. Here’s an example that gives styling for parent edges of nodes:

&#10005

Options like TreeElementStyle determine styling from the positions of elements. TreeElementStyleFunction, on the other hand, determines styling by applying a function to the data at each node:

&#10005

This uses both data and position information for each node:

&#10005

In analogy with VertexShapeFunction for graphs, TreeElementShapeFunction provides a general mechanism to specify how nodes of a tree should be rendered. This named setting for TreeElementShapeFunction makes every node be displayed as a circle:

&#10005
Announcements & Events

New in 13.1: Visual Effects and Beautification

Last year we released Version 13.0 of the Wolfram Language. Here are the updates in visual effects and beautification since then, including the latest features in 13.1.

 

Visual Effects & Beautification

At first it seemed like a minor feature. But once we’d implemented it, we realized it was much more useful than we’d expected. Just as you can style a graphics object with its color (and, as of Version 13.0, its filling pattern), now in Version 13.1 you can style it with its drop shadowing:
&#10005
Drop shadowing turns out to be a nice way to “bring graphics to life”
&#10005
or to emphasize one element over others:
&#10005
It works well in geo graphics as well:
&#10005
DropShadowing allows detailed control over the shadows: what direction they’re in, how blurred they are and what color they are:
&#10005
Drop shadowing is more complicated “under the hood” than one might imagine. And when possible it actually works using hardware GPU pixel shaders—the same technology that we’ve used since Version 12.3 to implement material-based surface textures for 3D graphics. In Version 13.1 we’ve explicitly exposed some well-known underlying types of 3D shading. Here’s a geodesic polyhedron (yes, that’s another new function in Version 13.1), with its surface normals added (using the again new function EstimatedPointNormals):
&#10005
Here’s the most basic form of shading: flat shading of each facet (and the specularity in this case doesn’t “catch” any facets):
&#10005
Here now is Gouraud shading, with a somewhat-faceted glint:
&#10005
And then there’s Phong shading, looking somewhat more natural for a sphere:
&#10005
Ever since Version 1.0, we’ve had an interactive way to rotate—and zoom into—3D graphics. (Yes, the mechanism was a bit primitive 34 years ago, but it rapidly got to more or less its modern form.) But in Version 13.1 we’re adding something new: the ability to “dolly” into a 3D graphic, imitating what would happen if you actually walked into a physical version of the graphic, as opposed to just zooming your camera:
&#10005
And, yes, things can get a bit surreal (or “treky”)—here dollying in and then zooming out:
Announcements & Events

New in 13.1: Beyond Listability: Introducing Threaded

Last year we released Version 13.0 of the Wolfram Language. Here are the updates in listability since then, including the latest features in 13.1.

 

Beyond Listability: Introducing Threaded

From the very beginning of Mathematica and the Wolfram Language we’ve had the concept of listability: if you add two lists, for example, their corresponding elements will be added:
&#10005
It’s a very convenient mechanism, that typically does exactly what you’d want. And for 35 years we haven’t really considered extending it. But if we look at code that gets written, it often happens that there are parts that basically implement something very much like listability, but slightly more general. And in Version 13.1 we have a new symbolic construct, Threaded, that effectively allows you to easily generalize listability. Consider:
&#10005
This uses ordinary listability, effectively computing:
&#10005
But what if you want instead to “go down a level” and thread {x,y} into the lowest parts of the first list? Well, now you can use Threaded to do that:
&#10005
On its own, Threaded is just a symbolic wrapper:
&#10005
But as soon as it appears in a function—like Plus—that has attribute Listable, it specifies that the listability should be applied after what’s specified inside Threaded is “threaded” at the lowest level. Here’s another example. Create a list:
&#10005
How should we then multiply each element by {1,–1}? We could do this with:
&#10005
But now we’ve got Threaded, and so instead we can just say:
&#10005
You can give Threaded as an argument to any listable function, not just Plus and Times:
&#10005
You can use Threaded and ordinary listability together:
&#10005
You can have several Threadeds together as well:
&#10005
Threaded, by the way, gets its name from the function Thread, which explicitly does “threading”, as in:
&#10005
By default, Threaded will always thread into the lowest level of a list:
&#10005
&#10005
Here’s a “real-life” example of using Threaded like this. The data in a 3D color image consists of a rank-3 array of triples of RGB values:
&#10005
This multiplies every RGB triple by {0,1,2}:
&#10005
Most of the time you either want to use ordinary listability that operates at the top level of a list, or you want to use the default form of Threaded, that operates at the lowest level of a list. But Threaded has a more general form, in which you can explicitly say what level you want it to operate at. Here’s the default case:
&#10005
Here’s level 1, which is just like ordinary listability:
&#10005
And here’s threading into level 2:
&#10005
Threaded provides a very convenient way to do all sorts of array-combining operations. There’s additional complexity when the object being “threaded in” itself has multiple levels. The default in this case is to align the lowest level in the thing being threaded in with the lowest level of the thing into which it’s being threaded:
&#10005
Here now is “ordinary listability” behavior:
&#10005
For the arrays we’re looking at here, the default behavior is equivalent to:
&#10005
Sometimes it’s clearer to write this out in a form like
&#10005
which says that the first level of the array inside the Threaded is to be aligned with the second level of the outside array. In general, the default case is equivalent to –1 → –1, specifying that the bottom level of the array inside the Threaded should be aligned with the bottom level of the array outside.
Announcements & Events

New in 13.1: College and Fractional Calculus

Last year we released Version 13.0 of the Wolfram Language. Here are the updates in college and fractional calculus since then, including the latest features in 13.1.

 

College Calculus

Transforming college calculus was one of the early achievements of Mathematica. But even now we’re continuing to add functionality to make college calculus ever easier and smoother to do—and more immediately connectable to applications. We’ve always had the function D for taking derivatives at a point. Now in Version 13.1 we’re adding ImplicitD for finding implicit derivatives.

So, for example, it can find the derivative of xy with respect to x, with y determined implicit by the constraint x2 + y2 = 1:

&#10005

Leave out the first argument and you’ll get the standard college calculus “find the slope of the tangent line to a curve”:

&#10005

So far all of this is a fairly straightforward repackaging of our longstanding calculus functionality. And indeed these kinds of implicit derivatives have been available for a long time in Wolfram|Alpha. But for Mathematica and the Wolfram Language we want everything to be as general as possible—and to support the kinds of things that show up in differential geometry, and in things like asymptotics and validation of implicit solutions to differential equations. So in addition to ordinary college-level calculus, ImplicitD can do things like finding a second implicit derivative on a curve defined by the intersection of two surfaces:

&#10005

In Mathematica and the Wolfram Language Integrate is a function that just gets you answers. (In Wolfram|Alpha you can ask for a step-by-step solution too.) But particularly for educational purposes—and sometimes also when pushing boundaries of what’s possible—it can be useful to do integrals in steps. And so in Version 13.1 we’ve added the function IntegrateChangeVariables for changing variables in integrals.

An immediate issue is that when you specify an integral with Integrate[...], Integrate will just go ahead and do the integral:

&#10005

But for IntegrateChangeVariables you need an “undone” integral. And you can get this using Inactive, as in:

&#10005

And given this inactive form, we can use IntegrateChangeVariables to do a “trig substitution”:

&#10005

The result is again an inactive form, now stating the integral differently. Activate goes ahead and actually does the integral:

&#10005

IntegrateChangeVariables can deal with multiple integrals as well—and with named coordinate systems. Here it’s transforming a double integral to polar coordinates:

&#10005

Although the basic “structural” transformation of variables in integrals is quite straightforward, the whole story of IntegrateChangeVariables is considerably more complicated. “College-level” changes of variables are usually carefully arranged to come out easily. But in the more general case, IntegrateChangeVariables ends up having to do nontrivial transformations of geometric regions, difficult simplifications of integrands subject to certain constraints, and so on.

In addition to changing variables in integrals, Version 13.1 also introduces DSolveChangeVariables for changing variables in differential equations. Here it’s transforming the Laplace equation to polar coordinates:

&#10005

Sometimes a change of variables can just be a convenience. But sometimes (think General Relativity) it can lead one to a whole different view of a system. Here, for example, an exponential transformation converts the usual Cauchy–Euler equation to a form with constant coefficients:

&#10005

Fractional Calculus

The first derivative of x2 is 2x; the second derivative is 2. But what is the derivative? It’s a question that was asked (for example by Leibniz) even in the first years of calculus. And by the 1800s Riemann and Liouville had given an answer—which in Version 13.1 can now be computed by the new FractionalD:

&#10005

And, yes, do another derivative and you get back the 1st derivative:

&#10005

In the more general case we have:

&#10005

And this works even for negative derivatives, so that, for example, the (–1)st derivative is an ordinary integral:

&#10005

It can be at least as difficult to compute a fractional derivative as an integral. But FractionalD can still often do it

&#10005

though the result can quickly become quite complicated:

&#10005

Why is FractionalD a separate function, rather than just being part of a generalization of D? We discussed this for quite a while. And the reason we introduced the explicit FractionalD is that there isn’t a unique definition of fractional derivatives. In fact, in Version 13.1 we also support the Caputo fractional derivative (or differintegral) CaputoD.

For the derivative of x2, the answer is still the same:

&#10005

But as soon as a function isn’t zero at x = 0 the answer can be different:

&#10005

CaputoD is a particularly convenient definition of fractional differentiation when one’s dealing with Laplace transforms and differential equations. And in Version 13.1 we can now only compute CaputoD but also do integral transforms and solve equations that involve it.

Here’s a -order differential equation

&#10005

and a -order one

&#10005

as well as a πth-order one:

&#10005

Note the appearance of MittagLefflerE. This function (which we introduced in Version 9.0) plays the same kind of role for fractional derivatives that Exp plays for ordinary derivatives.

Announcements & Events

Winners of the 2022 One-Liner and Get Visual Competitions

For 11 years, it has been tradition for the Wolfram Technology Conference to push our users to go above and beyond in Wolfram Language with our annual One-Liner Competition. In the competition, users are given a limit of 140 characters to create the most incredible output, which is then judged blindly based on brevity, aesthetics and original use of Wolfram Language.