WOLFRAM

Wolfram Language

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.
Announcements & Events

New in 13.1: Chemical Representations and Pattern Reactions

Last year we released Version 13.0 of the Wolfram Language. Here are the updates in chemical representations and symbolic pattern reactions since then, including the latest features in 13.1.

 

Representing Amounts of Chemicals

Molecule lets one symbolically represent a molecule. Quantity lets one symbolically represent a quantity with units. In Version 13.1 we now have the new construct ChemicalInstance that’s in effect a merger of these, allowing one to represent a certain quantity of a certain chemical.
Current Events & History

Should I Eat That? Food Safety with Wolfram Language

Foodborne illness, or food poisoning, is something many of us have experienced. According to the World Health Organization, almost 1 in 10 people in the world fall ill each year after eating contaminated food. Luckily, by following recommended food safety practices, we can do our best to avoid getting sick.

September is Food Safety Education Month. To highlight the importance of food safety, we have introduced two new properties in Wolfram Language that can help users make smart choices about food storage:

Current Events & History

Cheers! A Computational Exploration of Alcoholic Beverages with the Wolfram Language

For 10 thousand years, humans have been using fermentation to produce beverages for pleasure, rituals and healing. In ancient Greece, honey was fermented to produce mead. Today, popular sources of beverage fermentation are grains, grapes, berries and rice. The science of fermentation—known as zymology (or zymurgy)—is a fascinating blend of chemistry, biology, history and geography. The Wolfram Language now brings a new dimension to the study of alcoholic beverages through an extensive dataset ready to be explored and analyzed.
Education & Academic

Splitting a Point with Mathematica and MathTensor: A Mathematica Memoir

In the past few years, there have been many significant anniversaries in the Mathematica world. This has made me think about my long personal history working with all things Mathematica. Here I present an account of how I got involved with this world, developed my part of it and continue to use it. I show what I think is a unique application that differs from the other thousands of applications in Mathematica or the Wolfram Language presented on the various Wolfram Research websites, Wolfram Community and elsewhere. Finally, I attempt to describe the physics of what I do. The beginning historical part with much name-dropping can be skipped for those who want to read only about technical or physics issues.
Education & Academic

Fractional Calculus in Wolfram Language 13.1

What is the half-derivative of x?

Fractional calculus studies the extension of derivatives and integrals to such fractional orders, along with methods of solving differential equations involving these fractional-order derivatives and integrals. This branch is becoming more and more popular in fluid dynamics, control theory, signal processing and other areas. Realizing the importance and potential of this topic, we have added support for fractional derivatives and integrals in the recent release of Version 13.1 of the Wolfram Language.
Education & Academic

Discrete-Time Systems to FIR Filter Design: Explore Signal Processing in the New MOOC from Wolfram U

Recognizing the importance of the topics and the powerful capabilities in the Wolfram Language for signal processing, we set out to develop a fully interactive course about signal and system processing to make the subject accessible to a wide audience. After sharing and reviewing the course materials, notes and experiences we’ve collected from university undergraduate-level courses over many years, this resulting Wolfram U course represents the collaborative efforts of two principal authors, Mariusz Jankowski and Leila Fuladi, and a team of knowledgeable staff. It is our great pleasure to introduce to you the new, free, interactive course Signals, Systems and Signal Processing, which we hope will help you understand and master this difficult but tremendously important and exciting subject.