The Epic Continues…
Final week it was 34 years because the unique launch of Mathematica and what’s now the Wolfram Language. And thru all these years we’ve energetically continued constructing additional and additional, including ever extra capabilities, and steadily extending the area of the computational paradigm.
In recent times we’ve established one thing of a rhythm, delivering the fruits of our improvement efforts roughly twice a yr. We launched Model 13.0 on December 13, 2021. And now, roughly six months later, we’re releasing Model 13.1. As regular, regardless that it’s a “.1” launch, it’s obtained plenty of new (and up to date) performance, a few of which we’ve labored on for a few years however lastly now dropped at fruition.
For me it’s at all times thrilling to see what we handle to ship in every new model. And in Model 13.1 we have now 90 fully new features—in addition to 203 current features with substantial updates. And past what seems in particular features, there’s additionally main new performance in Model 13.1 in areas like person interfaces and the compiler.
The Wolfram Language because it exists immediately encompasses an unlimited vary of performance. However its nice energy comes not simply from what it incorporates, but in addition from how coherently every part in it matches collectively. And for almost 36 years I’ve taken it as a private accountability to make sure that that coherence is maintained. It’s taken each nice focus and plenty of deep mental work. However as I expertise them each day in my use of the Wolfram Language, I’m pleased with the outcomes.
And for the previous 4 years I’ve been sharing the “behind the scenes” of the way it’s achieved—by livestreaming our Wolfram Language design evaluation conferences. It’s an unprecedented stage of openness—and engagement with the group. In designing Model 13.1 we’ve completed 90 livestreams—lasting greater than 96 hours. And in opening up our course of we’re offering visibility not solely into what was constructed for Model 13.1, but in addition of why it was constructed, and the way choices about it had been made.
However, OK, so what lastly is in Model 13.1? Let’s speak about some highlights….
Past Listability: Introducing Threaded
From the very starting of Mathematica and the Wolfram Language we’ve had the idea of listability: in case you add two lists, for instance, their corresponding components shall be added:
![]() |
It’s a really handy mechanism, that usually does precisely what you’d need. And for 35 years we haven’t actually thought of extending it. But when we have a look at code that will get written, it usually occurs that there are components that mainly implement one thing very very like listability, however barely extra normal. And in Model 13.1 we have now a brand new symbolic assemble, Threaded, that successfully permits you to simply generalize listability.
Think about:
![]() |
This makes use of abnormal listability, successfully computing:
![]() |
However what in order for you as an alternative to “go down a stage” and thread {x,y} into the bottom components of the primary record? Properly, now you should use Threaded to try this:
![]() |
By itself, Threaded is only a symbolic wrapper:
![]() |
However as quickly because it seems in a perform—like Plus—that has attribute Listable, it specifies that the listability must be utilized after what’s specified inside Threaded is “threaded” on the lowest stage.
Right here’s one other instance. Create an inventory:
![]() |
How ought to we then multiply every component by {1,–1}? We may do that with:
![]() |
However now we’ve obtained Threaded, and so as an alternative we will simply say:
![]() |
You can provide Threaded as an argument to any listable perform, not simply Plus and Occasions:
![]() |
You should utilize Threaded and abnormal listability collectively:
![]() |
You possibly can have a number of Threadeds collectively as nicely:
![]() |
Threaded, by the way in which, will get its title from the perform Thread, which explicitly does “threading”, as in:
![]() |
By default, Threaded will at all times thread into the bottom stage of an inventory:
![]() |
![]() |
Right here’s a “real-life” instance of utilizing Threaded like this. The info in a 3D colour picture consists of a rank-3 array of triples of RGB values:
![]() |
This multiplies each RGB triple by {0,1,2}:
![]() |
More often than not you both need to use abnormal listability that operates on the prime stage of an inventory, otherwise you need to use the default type of Threaded, that operates on the lowest stage of an inventory. However Threaded has a extra normal kind, in which you’ll be able to explicitly say what stage you need it to function at.
Right here’s the default case:
![]() |
Right here’s stage 1, which is rather like abnormal listability:
![]() |
And right here’s threading into stage 2:
![]() |
Threaded gives a really handy strategy to do all types of array-combining operations. There’s further complexity when the item being “threaded in” itself has a number of ranges. The default on this case is to align the bottom stage within the factor being threaded in with the bottom stage of the factor into which it’s being threaded:
![]() |
Right here now could be “abnormal listability” conduct:
![]() |
For the arrays we’re right here, the default conduct is equal to:
![]() |
Typically it’s clearer to jot down this out in a kind like
![]() |
which says that the primary stage of the array contained in the Threaded is to be aligned with the second stage of the skin array. Typically, the default case is equal to –1 → –1, specifying that the underside stage of the array contained in the Threaded must be aligned with the underside stage of the array exterior.
But Extra Language Comfort Features
In each model of the Wolfram Language we attempt to add new features that may make normal packages simpler to jot down and simpler to learn. In Model 13.1 crucial such perform is Threaded. However there are fairly just a few others as nicely.
First in our assortment for Model 13.1 is DeleteElements, which deletes specified components from an inventory. It’s like Complement, besides that it doesn’t reorder the record (analogous to the way in which DeleteDuplicates removes duplicate components, with out reordering in the way in which that Union does):
![]() |
DeleteElements additionally permits extra detailed management of what number of copies of a component might be deleted. Right here it’s as much as 2 b’s and three c’s:
![]() |
Speaking of DeleteDuplicates, one other new perform in Model 13.1 is DeleteAdjacentDuplicates:
![]() |
We’ve had Union, Intersection and Complement since Model 1.0. In Model 13.1 we’re including SymmetricDifference: discover components that (within the 2-argument case) are in a single record or the opposite, however not each. For instance, what nations are within the G20 or the EU, however not each?
![]() |
Let’s say you’ve got a number of lists, and also you need to know what components are distinctive to only one in all these lists, and don’t happen in a number of lists. The brand new UniqueElements tells one.
For instance, this tells us which letters uniquely happen in numerous alphabets:
![]() |
We’ve had Map and Apply, with brief types /@ and @@, ever since Model 1.0. In Model 4.0 we added @@@ to characterize Apply[f,expr,1]. However we by no means added a separate perform to correspond to @@@. And through the years, there’ve been fairly just a few events the place I’ve mainly wished, for instance, to do one thing like “Fold[@@@, ...]”. Clearly Fold[Apply[#1,#2,1]&,...] would work. Nevertheless it feels as if there’s a “lacking” named perform. Properly, in Model 13.1, we added it: MapApply is equal to @@@:
![]() |
One other small comfort added in Model 13.1 is SameAs—basically an operator type of SameQ. Why is such a assemble wanted? Properly, there are at all times tradeoffs in language design. And again in Model 1.0 we determined to make SameQ work with any variety of arguments (so you’ll be able to check whether or not a complete sequence of issues are the identical). However which means that for consistency SameQ[expr] should at all times return True—so it’s not accessible as an operator of SameQ. And that’s why now in Model 13.1 we’re including SameAs, that joins the household of operator-form features like EqualTo and GreaterThan:
![]() |
Procedural programming—usually with “variables hanging out”—isn’t the popular type for many Wolfram Language code. However generally it’s probably the most handy strategy to do issues. And in Model 13.1 we’ve add a small piece of streamlining by introducing the perform Till. Ever since Model 1.0 we’ve had Whereas[test,body] which repeatedly evaluates physique whereas check is True. But when check isn’t True even at first, Whereas gained’t ever consider physique. Till[test,body] does issues the opposite approach round: it evaluates physique till check turns into True. So if check isn’t True at first, Till will nonetheless consider physique as soon as, in impact solely wanting on the check after it’s evaluated the physique.
Final however not least within the record of recent core language features in Model 13.1 is ReplaceAt. Substitute makes an attempt to use a alternative rule to an entire expression—or a complete stage in an expression. ReplaceAll (/.) does the identical factor for all subparts of an expression. However very often one needs extra management over the place replacements are completed. And that’s what ReplaceAt gives:
![]() |
An necessary characteristic is that it additionally has an operator kind:
![]() |
Why is that this necessary? The reply is that it provides a symbolic strategy to specify not simply what alternative is made, but in addition the place it’s made. And for instance that is what’s wanted in specifying steps in proofs, say as generated by FindEquationalProof.
Emojis! And Extra Multilingual Assist
What’s a personality? Again when Model 1.0 was launched, characters had been represented as 8-bit objects: normally ASCII, however you would decide one other “character encoding” (therefore the ChararacterEncoding possibility) in case you wished. Then within the early Nineteen Nineties got here Unicode—which we had been one of many very first firms to assist. Now “characters” could possibly be 16-bit constructs, with almost 65,536 doable “glyphs” allotted throughout totally different languages and makes use of (together with some mathematical symbols that we launched). Again within the early Nineteen Nineties Unicode was a newfangled factor, that working programs didn’t but have built-in assist for. However we had been betting on Unicode, and so we constructed our personal infrastructure for dealing with it.
Thirty years later Unicode is certainly the common commonplace for representing character-like issues. However someplace alongside the way in which, it turned out the world wanted greater than 16 bits’ price of character-like issues. At first it was about supporting variants and historic writing programs (suppose: cuneiform or Linear B). However then got here emoji. And it turned clear that—sure, arguably in a return to the Egyptian hieroglyph type of communication—there was an virtually infinite variety of doable pictorial emoji that could possibly be made, every of them being encoded as their very own Unicode code level.
It’s been a sluggish growth. Authentic 16-bit Unicode is “aircraft 0”. Now there are as much as 16 further planes. Not fairly 32-bit characters, however given the way in which computer systems work, the method now could be to permit characters to be represented by 32-bit objects. It’s removed from trivial to try this uniformly and effectively. And for us it’s been a protracted course of to improve every part in our system—from string manipulation to pocket book rendering—to deal with full 32-bit characters. And that’s lastly been achieved in Model 13.1.
However that’s removed from all. In English we’re just about used to with the ability to deal with textual content as a sequence of letters and different characters, with every character being separate. Issues get a bit extra difficult whenever you begin to fear about diphthongs like æ. But when there are pretty few of those, it really works to only introduce them as particular person “Unicode characters” with their very own code level. However there are many languages—like Hindi or Khmer—the place what seems in textual content like a person character can be a composite of letter-like constructs, diacritical marks and different issues. Such composite characters are usually represented as “grapheme clusters”: runs of Unicode code factors. The principles for dealing with this stuff might be fairly difficult. However after a few years of improvement, main working programs now efficiently do it usually. And in Model 13.1 we’re capable of make use of this to assist such constructs in notebooks.
OK, so what does 32-bit Unicode appear to be? Utilizing CharacterRange (or FromCharacterCode) we will dive in and simply see what’s on the market in “character area”. Right here’s a part of abnormal 16-bit Unicode area:
![]() |
Right here’s a few of what occurs in “plane-1” above character code 65535, on this case catering to “legacy computations”:
![]() |
Aircraft-0 (under 65535) is just about all full. Above that, issues are sparser. However round 128000, for instance, there are many emoji:
![]() |
You should utilize these within the Wolfram Language, and in notebooks, similar to some other characters. So, for instance, you’ll be able to have wolf and ram variables:
![]() |
The 🐏 types earlier than the 🐺 as a result of it occurs to have a numerically smaller character code:
![]() |
In a pocket book, you’ll be able to enter emoji (and different Unicode characters) utilizing commonplace working system instruments—like ctrlcmdarea on macOS:
![]() |
The world of emoji is quickly evolving—and that may generally result in issues. Right here’s an emoji vary that features some very acquainted emoji, however on a minimum of one in all my laptop programs additionally contains emoji that show solely as :
![]() |
The explanation that occurs is that my default fonts don’t comprise glyphs for these emoji. However all isn’t misplaced. In Model 13.1 we’re together with a font from Twitter that goals to comprise glyphs for just about all emoji:
![]() |
Past coping with particular person Unicode characters, there’s additionally the matter of composites, and grapheme clusters. In Hindi, for instance, two characters can mix into one thing that’s rendered (and handled) as one:
![]() |
The primary character right here can stand by itself:
![]() |
However the second is mainly a modifier that extends the primary character (on this specific case including a vowel sound):
![]() |
However as soon as the composite हि has been shaped it acts “textually” similar to a single character, within the sense that, for instance, the cursor strikes by it in a single step. When it seems “computationally” in a string, nevertheless, it may nonetheless be damaged into its constituent Unicode components:
![]() |
This type of setup can be utilized not just for a language like Hindi but in addition for European languages which have diacritical marks like umlauts:
![]() |
Regardless that this appears like one character—and in Model 13.1 it’s handled like that for “textual” functions, for instance in notebooks—it’s finally made up of two distinct “Unicode characters”:
![]() |
On this specific case, although, this may be “normalized” to a single character:
![]() |
It appears the identical, however now it actually is only one character:
![]() |
Right here’s a “mixed character” which you could kind
![]() |
however for which there’s no single character to which it normalizes:
![]() |
The idea of composite characters applies not solely to abnormal textual content, but in addition to emojis. For instance, take the emoji for a lady
![]() |
along with the emoji for a microscope
![]() |
and mix them with the “zero-width-joiner” character (which, evidently, doesn’t show as something)
![]() |
and also you get (sure, considerably bizarrely) a girl scientist!
![]() |
Evidently, you are able to do this computationally—although the “calculus” of what’s been outlined to date in Unicode is pretty weird:
![]() |
I’m form of hoping that the way forward for semantics doesn’t find yourself being outlined by the way in which emojis mix 😎.
As one final—arguably hacky—instance of mixing characters, Unicode defines numerous “two-letter” mixtures to be flags. Kind then
, and also you get 🇺🇸!
As soon as once more, this may be made computational:
![]() |
(And, sure, it’s an fascinating query what renders right here, and what doesn’t. In some working programs, no flags are rendered, and we have now to drag in a particular font to do it.)
![]() |
It was that the one “particular key sequence” one completely ought to know so as to use Wolfram Notebooks was shiftenter. However progressively there have began to be increasingly high-profile operations which might be conveniently completed by “urgent a button”. And slightly than anticipating individuals to recollect all these particular key sequences (or suppose to look in menus for them) we’ve determined to introduce a toolbar that shall be displayed by default in each commonplace pocket book. Model 13.1 has the primary iteration of this toolbar. Subsequent variations will assist an growing vary of capabilities.
It’s not been straightforward to design the default toolbar (and we hope you’ll like what we got here up with!) The principle downside is that Wolfram Notebooks are very normal, and there are an ideal many issues you are able to do with them—which it’s difficult to prepare right into a manageable toolbar. (Some particular forms of notebooks have had their very own specialised toolbars for some time, which had been simpler to design by advantage of their specialization.)
So what’s within the toolbar? On the left are a few analysis controls:
means “Consider”, and is solely equal to urgent shiftret (as its tooltip says).
means “Abort”, and can cease a computation. To the precise of
is the menu proven above. The primary a part of the menu permits you to select what shall be evaluated. (Don’t neglect the extraordinarily helpful “Consider In Place” that permits you to consider no matter code you’ve got chosen—say to show RGBColor[1,0,0] in your enter into
.) The underside a part of the menu provides a few extra detailed (however extremely helpful) analysis controls.
Shifting alongside the toolbar, we subsequent have:
![]() |
In case your cursor isn’t already in a cell, the pulldown permits you to choose what sort of cell you need to insert (it’s much like the “tongue” that seems throughout the pocket book). (In case your cursor is already inside a cell, then like in a typical phrase processor, the pulldown will inform you the type that’s getting used, and allow you to reset it.)
provides you a bit panel to regulate to look of cells, altering their background colours, frames, dingbats, and so forth.
Subsequent come cell-related buttons: . The primary is for cell construction and grouping:
![]() |
copies enter from above (cmdL). It’s an operation that I, for one, find yourself doing on a regular basis. I’ll have an enter that I consider. Then I’ll need to make a modified model of the enter to judge once more, whereas conserving the unique. So I’ll copy the enter from above, edit the copy, and consider it once more.
copies output from above. I don’t discover this fairly as helpful as copy enter from above, however it may be useful if you wish to edit output for subsequent enter, whereas leaving the “precise output” unchanged.
The block is all about content material in cells.
(which you’ll usually press repeatedly) is for extending a range—in impact going ever upwards in an expression tree. (You may get the identical impact by urgent ctrl. or by multiclicking, nevertheless it’s much more handy to repeatedly press a single button than to have to exactly time your multiclicks.)
is the single-button strategy to get ctrl= for getting into pure language enter:
![]() |
iconizes your choice:
![]() |
Iconization is one thing we launched in Model 11.3, and it’s one thing that’s proved extremely helpful, notably for making code straightforward to learn (say by iconizing particulars of choices). (You may also iconize a range from the right-click menu, or with ctrlcmd'.)
is most related for code, and toggles commenting (with
) a range.
brings up a palette for math typesetting.
allows you to enter
that shall be transformed to Wolfram Language math typesetting.
brings up a drawing canvas.
inserts a hyperlink (cmdshiftH).
For those who’re in a textual content cell, the toolbar will look totally different, now sporting a textual content formatting management:
Most of that is pretty commonplace. allows you to insert “code voice” materials.
and
are nonetheless within the toolbar for inserting math right into a textual content cell.
On the right-hand finish of the toolbar are three extra buttons: .
provides you a dialog to publish your pocket book to the cloud.
opens documentation, both particularly wanting up no matter you’ve got chosen within the pocket book, or opening the entrance web page (“root information web page”) of the primary Wolfram Language documentation. Lastly,
allows you to search in your present pocket book.
As I discussed above, what’s in Model 13.1 is simply the primary iteration of our default toolbar. Count on extra options in later variations. One factor that’s notable concerning the toolbar on the whole is that it’s 100% applied in Wolfram Language. And along with including a substantial amount of flexibility, this additionally implies that the toolbar instantly works on all platforms. (By the way in which, in case you don’t need the toolbar in a selected pocket book—or for all of your notebooks—simply right-click the background of the toolbar to select that possibility.)
Sharpening the Consumer Interface
We first launched Wolfram Notebooks with Model 1.0 of Mathematica, in 1988. And ever since then, we’ve been progressively sharpening the pocket book interface, doing extra with each new model.
The ctrl= mechanism for getting into pure language (“Wolfram|Alpha-style”) enter debuted in Model 10.0—and in Model 13.1 it’s now accessible from the button within the new default pocket book toolbar. However what really is
when it’s in a pocket book? Up to now, it’s been a reasonably complicated symbolic construction primarily appropriate for analysis. However in Model 13.1 we’ve made it a lot easier. And whereas that doesn’t have any direct impact in case you’re simply utilizing
purely in a pocket book, it does have an impact in case you copy
into one other utility, like pure-text e-mail. Up to now this produced one thing that might work if pasted again right into a pocket book, however undoubtedly wasn’t notably readable. In Model 13.1, it’s now merely the Wolfram Language interpretation of your pure language enter:
![]() |
What occurs if the computation you do in a pocket book generates an enormous output? Ever since Model 6.0 we’ve had some type of “output limiter”, however in Model 13.1 it’s grow to be a lot sleeker and extra helpful. Right here’s a typical instance:
![]() ![]() |
Speaking of massive outputs (in addition to different issues that preserve the pocket book interface busy), one other change in Model 13.1 is the brand new asynchronous progress overlay on macOS. This doesn’t have an effect on different platforms the place this downside had already been solved, however on the Mac modifications within the OS had led to a scenario the place the pocket book entrance finish may mysteriously pop to the entrance in your desktop—a scenario that has now been resolved.
One of many barely uncommon person interface options that’s existed ever since Model 1.0 is the Why the Beep? menu merchandise—that permits you to get an evidence of any “error beep” that happens when you’re operating the system. The perform Beep allows you to generate your personal beep. And now in Model 13.1 you should use Beep["string"] to arrange an evidence of “your beep”, that customers can retrieve by the Why the Beep? menu merchandise.
The essential pocket book person interface works as a lot as doable with commonplace interface components on all platforms, in order that when these components are up to date, we at all times robotically get the “most fashionable” look. However there are components of the pocket book interface which might be fairly particular to Wolfram Notebooks and are at all times customized. One which hadn’t been up to date for some time is the Preferences dialog—which now in Model 13.1 will get a full makeover:
![]() |
Once you inform the Wolfram Language to do one thing, it usually simply goes off and does it, with out asking you something (nicely, until it explicitly wants enter, wants a password, and so forth.) However what if there’s one thing that it is perhaps a good suggestion to do, although it’s not strictly needed? What ought to the person interface for this be? It’s tough, however I believe we now have a very good resolution that we’ve began deploying in Model 13.1.
Particularly, in Model 13.1, there’s an instance associated to the Wolfram Operate Repository. Say you utilize a perform for which an replace is on the market. What now occurs is {that a} blue field is generated that tells you concerning the replace—although it nonetheless retains going with the computation, ignoring the replace:
![]() |
For those who click on the Replace Now button within the blue field you are able to do the replace. After which the purpose is which you could run the computation once more (for instance, simply by urgent shiftenter), and now it’ll use the replace. In a way the core thought is to have an interface the place there are doubtlessly a number of passes, and the place a computation at all times runs to completion, however you’ve got a simple strategy to change the way it’s arrange, after which run it once more.
Giant-Scale Code Enhancing
One of many nice issues concerning the Wolfram Language is that it really works nicely for packages of any scale—from lower than a line lengthy to tens of millions of traces lengthy. And for the previous a number of years we’ve been engaged on increasing our assist for very massive Wolfram Language packages. Utilizing LSP (Language Server Protocol) we’ve offered the aptitude for most traditional exterior IDEs to robotically do syntax coloring and different customizations for the Wolfram Language.
In Model 13.1 we’re additionally including a few options that make large-scale code enhancing in notebooks extra handy. The primary—and extensively requested—is block indent and outdent of code. Choose the traces you need to indent or outdent and easily press tab or shifttab to indent or outdent them:
![]() |
Ever since Model 6.0 we’ve had the power to work with .wl package deal information (in addition to .wls script information) utilizing our pocket book enhancing system. A brand new default characteristic in Model 13.1 is numbering of all code traces that seem within the underlying file (and, sure, we accurately align line numbers accounting for the presence of non-code cells):
![]() |
So now, for instance, in case you get a syntax error from Get or a associated perform, you’ll instantly have the ability to use the road quantity it experiences to search out the place it happens within the underlying file.
Scribbling on Notebooks
In Model 12.2 we launched Canvas as a handy interface for interactive drawing in notebooks. In Model 13.1 we’re introducing the notion of toggling a canvas on prime of any cell.
Given a cell, simply choose it and press , and also you’ll get a canvas:
![]() |
Now you should use the drawing instruments within the canvas to create an annotation overlay:
![]() |
For those who consider the cell, the overlay will keep. (You possibly can do away with the “canvas wrapper” by making use of Regular.)
Timber Proceed to Develop 🌱🌳
In Model 12.3 we launched Tree as a brand new elementary assemble within the Wolfram Language. In Model 13.0 we added a wide range of styling choices for timber, and in Model 13.1 we’re including extra styling in addition to a wide range of new elementary options.
An necessary replace to the elemental Tree assemble in Model 13.1 is the power to call branches at every node, by giving them in an affiliation:
![]() |
All tree features now embrace assist for associations:
![]() |
In lots of makes use of of timber the labels of nodes are essential. However notably in additional summary functions one usually needs to cope with unlabeled timber. In Model 13.1 the perform UnlabeledTree (roughly analogously to UndirectedGraph) takes a labeled tree, and mainly removes all seen labels. Here’s a commonplace labeled tree
![]() |
and right here’s the unlabeled analog:
![]() |
In Model 12.3 we launched ExpressionTree for deriving timber from normal symbolic expressions. Our plan is to have a variety of “particular timber” acceptable for representing totally different particular sorts of symbolic expressions. We’re starting this course of in Model 13.1 by, for instance, having the idea of “Dataset timber”. Right here’s ExpressionTree changing a dataset to a tree:
![]() |
And now right here’s TreeExpression “inverting” that, and producing a dataset:
![]() |
(Keep in mind the conference that *Tree features return a tree; whereas Tree* features take a tree and return one thing else.)
Right here’s a “graph rendering” of a extra difficult dataset tree:
![]() |
The brand new perform TreeLeafCount allows you to depend the entire variety of leaf nodes on a tree (mainly the analog of LeafCount for a normal symbolic expression):
![]() |
One other new perform in Model 13.1 that’s usually helpful in getting a way of the construction of a tree with out inspecting each node is RootTree. Right here’s a random tree:
![]() |
RootTree can get a subtree that’s “near the foundation”:
![]() |
It will possibly additionally get a subtree that’s “removed from the leaves”, on this case happening to components which might be at stage –2 within the tree:
![]() |
In some methods the styling of timber is just like the styling of graphs—although there are some vital variations on account of the hierarchical nature of timber. By default, choices inserted into a selected tree component have an effect on solely that tree component:
![]() |
However you can provide guidelines that specify how components within the subtree under that component are affected:
![]() |
In Model 13.1 there may be now detailed management accessible for styling each nodes and edges within the tree. Right here’s an instance that offers styling for mother or father edges of nodes:
![]() |
Choices like TreeElementStyle decide styling from the positions of components. TreeElementStyleFunction, alternatively, determines styling by making use of a perform to the information at every node:
![]() |
This makes use of each information and place info for every node:
![]() |
In analogy with VertexShapeFunction for graphs, TreeElementShapeFunction gives a normal mechanism to specify how nodes of a tree must be rendered. This named setting for TreeElementShapeFunction makes each node be displayed as a circle:
![]() |
But Extra Date-Dealing with Particulars
We first launched dates into Wolfram Language in Model 2.0, and we launched fashionable date objects in Model 10.0. However to essentially make dates totally computable, there are lots of detailed instances to think about. And in Model 13.1 we’re coping with one more of them. Let’s say you’ve obtained the date January 31, 2022. What date is one month later—provided that there’s no February 31, 2022?
If we outline a month “bodily”, it corresponds to a sure fractional variety of days:
![]() |
And, sure, we will use this to resolve what’s a month after January 31, 2022:
![]() |
Barely complicated right here is that we’re coping with date objects of “day” granularity. We will see extra if we go right down to the extent of minutes:
![]() |
If one’s doing one thing like astronomy, this type of “bodily” date computation might be what one needs. But when one’s doing on a regular basis “human” actions, it’s virtually definitely not what one needs; as an alternative, one needs to land on some calendar date or one other.
Right here’s the default within the Wolfram Language:
![]() |
However now in Model 13.1 we will parametrize extra exactly what we wish. This default is what we name "RollBackward": wherever we “land” by doing the uncooked date computation, we “roll backward” to the primary legitimate date. An alternate is "RollForward":
![]() |
No matter technique one makes use of, there are going to be bizarre instances. Let’s say we begin with a number of consecutive dates:
![]() |
With "RollBackward" we have now the weirdness of repeating February 28:
![]() |
With "RollForward" we have now the weirdness of repeating March 1:
![]() |
Is there any various? Sure, we will use "RollOver":
![]() |
This retains advancing by days, however then has the weirdness that it goes backwards. And, sure, there’s no “proper reply” right here. However in Model 13.1 now you can specify precisely what you need the conduct to be.
The identical challenge arises not only for months, but in addition, for instance, for years. And it impacts not simply DatePlus, but in addition DateDifference.
It’s price mentioning that in Model 13.1, along with coping with the element we’ve simply mentioned, the entire framework for doing “date arithmetic” in Wolfram Language has been made vastly extra environment friendly, generally by components of a whole bunch.
Capturing Video & Extra
We’ve had ImageCapture since Model 8.0 (in 2010) and AudioCapture since Model 11.1 (in 2017). Now in Model 13.1 we have now VideoCapture. By default VideoCapture[] provides you a GUI that permits you to document out of your digicam:
![]() |
Clicking the down arrow opens up a preview window that reveals your present video:
![]() |
Once you’ve completed recording, VideoCapture returns the Video object you created:
![]() |
Now you’ll be able to course of or analyze this Video object similar to you’d some other:
![]() |
VideoCapture[] is a blocking operation that waits till you’ve completed recording, then returns a outcome. However VideoCapture may also be used “not directly” as a dynamic management. Thus, for instance
![]() |
allows you to asynchronously begin and cease recording, whilst you do different issues in your Wolfram Language session. However each time you cease recording, the worth of video is up to date.
VideoCapture data video out of your digicam (and you should use the ImageDevice choice to specify which one when you’ve got a number of). VideoScreenCapture, alternatively, data out of your laptop display screen—in impact offering a video analog of CurrentScreenImage.
VideoScreenCapture[], like VideoCapture[], is a blocking operation so far as the Wolfram Language is anxious. However if you wish to watch one thing taking place in one other utility (say, an online browser), it’ll just do nice. And as well as, you can provide a display screen rectangle to seize a selected area in your display screen:
![]() ✕
VideoScreenCapture[{{0, 50}, {640, 498}}] |
Then for instance you’ll be able to analyze the time sequence of RGB colour ranges within the video that’s produced:
![]() |
What if you wish to display screen document from a pocket book? Properly, then you should use the asynchronous dynamic recording mechanism that exists in VideoScreenCapture simply because it does in VideoCapture.
By the way in which, each VideoCapture and VideoScreenCapture by default seize audio. You possibly can swap off audio recording both from the GUI, or with the choice AudioInputDevice→None.
If you wish to get fancy, you’ll be able to display screen document a pocket book through which you might be capturing video out of your digicam (which in flip reveals you capturing a video, and so forth.):
![]() ✕
VideoScreenCapture[EvaluationNotebook[]] |
Along with capturing video from real-time goings-on, you can too generate video straight from features like AnimationVideo and SlideShowVideo—in addition to by “touring” a picture utilizing TourVideo. In Model 13.1 there are some vital enhancements to TourVideo.
Take an animal scene and extract bounding packing containers for elephants and zebras:
![]() |
Now you may make a tour video that visits every animal:
![]() |
Outline a path perform of a variable t:
![]() |
![]() |
Now we will use the trail perform to make a “spiralling” tour video:
![]() |
Faculty Calculus
Reworking school calculus was one of many early achievements of Mathematica. However even now we’re persevering with so as to add performance to make school calculus ever simpler and smoother to do—and extra instantly connectable to functions. We’ve at all times had the perform D for taking derivatives at some extent. Now in Model 13.1 we’re including ImplicitD for locating implicit derivatives.
So, for instance, it may discover the spinoff of xy with respect to x, with y decided implicit by the constraint x2 + y2 = 1:
![]() |
Miss the primary argument and also you’ll get the usual school calculus “discover the slope of the tangent line to a curve”:
![]() |
Up to now all of this can be a pretty easy repackaging of our longstanding calculus performance. And certainly these sorts of implicit derivatives have been accessible for a very long time in Wolfram|Alpha. However for Mathematica and the Wolfram Language we wish every part to be as normal as doable—and to assist the sorts of issues that present up in differential geometry, and in issues like asymptotics and validation of implicit options to differential equations. So along with abnormal college-level calculus, ImplicitD can do issues like discovering a second implicit spinoff on a curve outlined by the intersection of two surfaces:
![]() |
In Mathematica and the Wolfram Language Combine is a perform that simply will get you solutions. (In Wolfram|Alpha you’ll be able to ask for a step-by-step resolution too.) However notably for instructional functions—and generally additionally when pushing boundaries of what’s doable—it may be helpful to do integrals in steps. And so in Model 13.1 we’ve added the perform IntegrateChangeVariables for altering variables in integrals.
An instantaneous challenge is that whenever you specify an integral with Combine[...], Combine will simply go forward and do the integral:
![]() |
However for IntegrateChangeVariables you want an “undone” integral. And you may get this utilizing Inactive, as in:
![]() |
And given this inactive kind, we will use IntegrateChangeVariables to do a “trig substitution”:
![]() |
The result’s once more an inactive kind, now stating the integral in a different way. Activate goes forward and really does the integral:
![]() |
IntegrateChangeVariables can cope with a number of integrals as nicely—and with named coordinate programs. Right here it’s remodeling a double integral to polar coordinates:
![]() |
Though the fundamental “structural” transformation of variables in integrals is kind of easy, the entire story of IntegrateChangeVariables is significantly extra difficult. “Faculty-level” modifications of variables are normally rigorously organized to come back out simply. However within the extra normal case, IntegrateChangeVariables finally ends up having to do nontrivial transformations of geometric areas, troublesome simplifications of integrands topic to sure constraints, and so forth.
Along with altering variables in integrals, Model 13.1 additionally introduces DSolveChangeVariables for altering variables in differential equations. Right here it’s remodeling the Laplace equation to polar coordinates:
![]() |
Typically a change of variables can simply be a comfort. However generally (suppose Common Relativity) it may lead one to a complete totally different view of a system. Right here, for instance, an exponential transformation converts the same old Cauchy–Euler equation to a kind with fixed coefficients:
![]() |
Fractional Calculus
The primary spinoff of x2 is 2x; the second spinoff is 2. However what’s the spinoff? It’s a query that was requested (for instance by Leibniz) even within the first years of calculus. And by the 1800s Riemann and Liouville had given a solution—which in Model 13.1 can now be computed by the brand new FractionalD:
![]() |
And, sure, do one other spinoff and also you get again the 1st spinoff:
![]() |
Within the extra normal case we have now:
![]() |
And this works even for damaging derivatives, in order that, for instance, the (–1)st spinoff is an abnormal integral:
![]() |
It may be a minimum of as troublesome to compute a fractional spinoff as an integral. However FractionalD can nonetheless usually do it
![]() |
although the outcome can shortly grow to be fairly difficult:
![]() |
Why is FractionalD a separate perform, slightly than simply being a part of a generalization of D? We mentioned this for fairly some time. And the rationale we launched the express FractionalD is that there isn’t a singular definition of fractional derivatives. Actually, in Model 13.1 we additionally assist the Caputo fractional spinoff (or differintegral) CaputoD.
For the spinoff of x2, the reply continues to be the identical:
![]() |
However as quickly as a perform isn’t zero at x = 0 the reply might be totally different:
![]() |
CaputoD is a very handy definition of fractional differentiation when one’s coping with Laplace transforms and differential equations. And in Model 13.1 we will now solely compute CaputoD but in addition do integral transforms and clear up equations that contain it.
Right here’s a -order differential equation
![]() |
and a -order one
![]() |
in addition to a πth-order one:
![]() |
Word the looks of MittagLefflerE. This perform (which we launched in Model 9.0) performs the identical type of position for fractional derivatives that Exp performs for abnormal derivatives.
Extra Math—Some Lengthy Awaited
In February 1990 an inner bug report was filed towards the still-in-development Model 2.0 of Mathematica:
![]() |
It’s taken a very long time (and comparable points have been reported many occasions), however in Model 13.1 we will lastly shut this bug!
Think about the differential equation (the Clairaut equation):
![]() |
What DSolve does by default is to offer the generic resolution to this equation, by way of the parameter 𝕔1. However the delicate level (which in optics is related to caustics) is that the household of options for various values of 𝕔1 has an envelope which isn’t itself a part of the household of options, however can be an answer:
![]() |
In Model 13.1 you’ll be able to request that resolution with the choice IncludeSingularSolutions→True:
![]() |
And right here’s a plot of it:
![]() |
DSolve was a brand new perform (again in 1991) in Model 2.0. One other new perform in Model 2.0 was Residue. And in Model 13.1 we’re additionally including an extension to Residue: the perform ResidueSum. And whereas Residue finds the residue of a posh perform at a particular level, ResidueSum finds a sum of residues.
This computes the sum of all residues for a perform, throughout the entire complicated aircraft:
![]() |
This computes the sum of residues inside a selected area, on this case the unit disk:
![]() |
Create Your Personal “Information to Features” Pages
An necessary a part of the built-in documentation for the Wolfram Language are what we name “information pages”—pages like the next that arrange features (and different constructs) to offer an total “cognitive map” and abstract of some space:
![]() |
In Model 13.1 it’s now straightforward to create your personal customized information pages. You possibly can record built-in features or different constructs, in addition to issues from the Wolfram Operate Repository and different repositories.
Go to the “root web page” of the Documentation Heart and press the icon:
![]() |
You’ll get a clean customized information web page:
![]() |
Fill within the information web page nevertheless you need, then use Deploy to deploy the web page both domestically, or to your cloud account. Both approach, the web page will now present up within the menu from the highest of the foundation information web page (and so they’ll additionally present up in search):
![]() |
You would possibly find yourself creating only one customized information web page on your favourite features. Otherwise you would possibly create a number of, say one for every job or subject you generally cope with. Information pages aren’t about placing within the effort to create full-scale documentation; they’re far more light-weight, and aimed extra at offering fast (“what was that perform referred to as?”) reminders and “big-picture” maps—leveraging all the particular perform and different documentation that already exists.
Visible Results & Beautification
At first it appeared like a minor characteristic. However as soon as we’d applied it, we realized it was far more helpful than we’d anticipated. Simply as you’ll be able to type a graphics object with its colour (and, as of Model 13.0, its filling sample), now in Model 13.1 you’ll be able to type it with its drop shadowing:
![]() |
Drop shadowing seems to be a pleasant strategy to “deliver graphics to life”
![]() |
or to emphasise one component over others:
![]() |
It really works nicely in geo graphics as nicely:
![]() |
DropShadowing permits detailed management over the shadows: what route they’re in, how blurred they’re and what colour they’re:
![]() |
Drop shadowing is extra difficult “below the hood” than one may think. And when doable it really works utilizing {hardware} GPU pixel shaders—the identical know-how that we’ve used since Model 12.3 to implement material-based floor textures for 3D graphics. In Model 13.1 we’ve explicitly uncovered some well-known underlying forms of 3D shading. Right here’s a geodesic polyhedron (sure, that’s one other new perform in Model 13.1), with its floor normals added (utilizing the once more new perform EstimatedPointNormals):
![]() |
Right here’s probably the most primary type of shading: flat shading of every side (and the specularity on this case doesn’t “catch” any sides):
![]() |
Right here now could be Gouraud shading, with a somewhat-faceted glint:
![]() |
After which there’s Phong shading, wanting considerably extra pure for a sphere:
![]() |
Ever since Model 1.0, we’ve had an interactive strategy to rotate—and zoom into—3D graphics. (Sure, the mechanism was a bit primitive 34 years in the past, nevertheless it quickly obtained to roughly its fashionable kind.) However in Model 13.1 we’re including one thing new: the power to “dolly” right into a 3D graphic, imitating what would occur in case you really walked right into a bodily model of the graphic, versus simply zooming your digicam:
![]() |
And, sure, issues can get a bit surreal (or “treky”)—right here dollying in after which zooming out:
3D Voronoi!
There are some capabilities that—over the course of years—have been requested time and again. Up to now these have included infinite undo, excessive dpi shows, a number of axis plots, and others. And I’m completely happy to say that almost all of those have now been taken care of. However there’s one—seemingly obscure—“straggler” that I’ve heard about for nicely over 25 years, and that I’ve really additionally wished myself fairly just a few occasions: 3D Voronoi diagrams. Properly, in Model 13.1, they’re right here.
Arrange 25 random factors in 3D:
![]() |
![]() |
Now make a Voronoi mesh for these factors:
![]() |
To “see inside” we will use opacity:
![]() |
Why was this so arduous? In a Voronoi there’s a cell that surrounds every unique level, and contains all over the place that’s nearer to that time than to some other. We’ve had 2D Voronoi meshes for a very long time:
![]() |
However there’s one thing simpler concerning the 2D case. The difficulty isn’t a lot the algorithm for producing the cells as it’s how the cells might be represented in such a approach that they’re helpful for subsequent computations. Within the 2D case every cell is only a polygon.
However within the 3D case the cells are polyhedra, and to make a Voronoi mesh we have now to have a polyhedral mesh the place all of the polyhedra match collectively. And it’s taken us a few years to construct the massive tower of computational geometry essential to assist this. There’s a considerably easier case primarily based purely on cells which might be at all times both simplices or hexahedra—that we’ve used for finite-element options to PDEs for some time. However in a real 3D Voronoi that’s not sufficient: the cells might be any (convex) polyhedral form.
Listed here are the “puzzle piece” cells for the 3D Voronoi mesh we made above:
![]() |
Reconstructing Geometry from Level Clouds
Decide 500 random factors inside an annulus:
![]() |
![]() |
Model 13.1 now has a normal perform reconstructing geometry from a cloud of factors:
![]() |
(In fact, given solely a finite variety of factors, the reconstruction can’t be anticipated to be excellent.)
The perform additionally works in 3D:
![]() |
![]() |
ReconstructionMesh is a normal superfunction that makes use of a wide range of strategies, together with prolonged variations of the features ConcaveHullMesh and GradientFittedMesh that had been launched in Model 13.0. And along with reconstructing “stable objects”, it may additionally reconstruct lower-dimensional issues like curves and surfaces:
![]() |
A associated perform new in Model 13.1 is EstimatedPointNormals, which reconstructs not the geometry itself, however regular vectors to every component within the geometry:
![]() |
New in Visualization
In each new model for the previous 30 years we’ve steadily expanded our visualization capabilities, and Model 13.1 isn’t any exception. One perform we’ve added is TernaryListPlot—an analog of ListPlot that conveniently plots triples of values the place what one’s making an attempt to emphasise is their ratios. For instance let’s plot information from our knowledgebase on the sources of electrical energy for various nations:
![]() |
The plot reveals the “vitality combination” for various nations, with those on the underside axis being these with zero nuclear. Inserting colours for every axis, together with grid traces, helps clarify methods to learn the plot:
![]() |
More often than not plots are plotting numbers, or a minimum of portions. In Model 13.0, we prolonged features like ListPlot to additionally settle for dates. In Model 13.1 we’re going a lot additional, and introducing the opportunity of plotting what quantity to purely symbolic values.
Let’s say our information consists of letters A by C:
![]() |
How can we plot these? In Model 13.1 we simply specify an ordinal scale:
![]() |
OrdinalScale allows you to specify that sure symbolic values are to be handled as if they’re in a specified order. There’s additionally the idea of a nominal scale—represented by NominalScale—through which totally different symbolic values correspond to totally different “classes”, however in no specific order.
Representing Quantities of Chemical substances
Molecule lets one symbolically characterize a molecule. Amount lets one symbolically characterize a amount with items. In Model 13.1 we now have the brand new assemble ChemicalInstance that’s in impact a merger of those, permitting one to characterize a sure amount of a sure chemical.
This provides a symbolic illustration of 1 liter of acetone (by default at commonplace temperature and stress):
![]() |
We will ask what the mass of this occasion of this chemical is:
![]() |
ChemicalConvert lets us do a conversion returning specific items:
![]() |
Right here’s as an alternative a conversion to moles:
![]() |
This straight provides the quantity of substance that 1 liter of acetone corresponds to:
![]() |
This generates a sequence of straight-chain hydrocarbons:
![]() |
Right here’s the quantity of substance similar to 1 g of every of those chemical substances:
![]() |
ChemicalInstance allows you to specify not simply the quantity of a substance, but in addition its state, particularly temperature and stress. Right here we’re changing 1 kg of water at 4° C to be represented by way of quantity:
![]() |
Chemistry as Rule Utility: Symbolic Sample Reactions
On the core of the Wolfram Language is the summary thought of making use of transformations to symbolic expressions. And at some stage one can view chemistry and chemical reactions as a bodily instantiation of this concept, the place one’s not coping with summary symbolic constructs, however as an alternative with precise molecules and atoms.
In Model 13.1 we’re introducing PatternReaction as a symbolic illustration for courses of chemical reactions—in impact offering an analog for chemistry of Rule for normal symbolic expressions.
Right here’s an instance of a “sample response”:
![]() |
The primary argument specifies a pair of “reactant” molecule patterns to be remodeled into “product” molecule patterns. The second argument specifies which atoms through which reactant molecules map to which atoms through which product molecules. For those who mouse over the ensuing sample response, you’ll see corresponding atoms “gentle up”:
![]() |
Given a sample response, we will use ApplyReaction to use the response to concrete molecules:
![]() |
Listed here are plots of the ensuing product molecules:
![]() |
The molecule patterns within the sample response are matched towards subparts of the concrete molecules, then the transformation is finished, leaving the opposite components of the molecules unchanged. In a way it’s the direct analog of one thing like
![]() |
the place the b within the symbolic expression is changed, and the result’s “knitted again” to fill in the place the b was.
You are able to do what quantities to numerous sorts of “chemical practical programming” with ApplyReaction and PatternReaction. Right here’s an instance the place we’re basically build up a polymer by successive nesting of a response:
![]() |
![]() |
It’s usually handy to construct sample reactions symbolically utilizing Wolfram Language “chemical primitives”. However PatternReaction additionally allows you to specify reactions as SMARTS strings:
![]() |
PDEs for Rods, Rubber and Extra
It’s been a 25-year journey, steadily growing our built-in PDE capabilities. And in Model 13.1 we’ve added a number of (admittedly considerably technical) options which were a lot requested, and are necessary for fixing specific sorts of real-world PDE issues. The primary characteristic is with the ability to arrange a PDE as axisymmetric. Usually a 2D diffusion time period can be assumed Cartesian:
![]() |
However now you’ll be able to say you’re coping with an axisymmetric system, along with your coordinates being interpreted as radius and peak, and every part assumed to be symmetrical within the azimuthal route:
![]() |
What’s necessary about this isn’t simply that it makes it straightforward to arrange sure sorts of equations, but in addition that in fixing equations axial symmetry might be assumed, permitting far more environment friendly strategies for use:
![]() |
Additionally in Model 13.1 is an extension to the stable mechanics modeling framework launched in Model 13.0. Simply as there’s viscosity that damps out movement in fluids, so there’s an identical phenomenon that damps out movement in solids. It’s extra of an engineering story, and it’s normally described by way of two parameters: mass damping and stiffness damping. And now in Model 13.1 we assist this type of so-called Rayleigh damping in our modeling framework.
One other phenomenon included in Model 13.1 is hyperelasticity. For those who bend one thing like metallic past a sure level (however not to date that it breaks), it’ll keep bent. However supplies like rubber and foam (and a few organic tissues) can “bounce again” from mainly any deformation.
Let’s think about that we have now a sq. of rubber-like materials. We anchor it on the left, after which we pull it on the precise with a sure drive. What does it do?
This defines the properties of our materials:
![]() |
We outline variables for the issue, representing x and y displacements by u and v:
![]() |
Now we will arrange our complete downside, and clear up the PDEs for it for every worth of the drive:
![]() |
Then one can plot the outcomes, and see the rubber being nonlinearly stretched:
![]() |
There’s ultimately appreciable depth in our dealing with of PDE-based modeling, and our growing means to do “multiphysics” computations that span a number of forms of physics (mechanical, thermal, electromagnetic, acoustic, …). And by now we’ve obtained almost 1000 pages of documentation purely about PDE-based modeling. And for instance in Model 13.1 we’ve added a monograph particularly about hyperelasticity, in addition to expanded our assortment of documented PDE fashions:

Interpretable Machine Studying
Let’s say you’ve got skilled a machine studying mannequin and also you apply it to a selected enter. It provides you some outcome. However why? What had been the necessary options within the enter that led it to that outcome? In Model 13.1 we’re introducing a number of features that attempt to reply such questions.
Right here’s some easy “coaching information”:
![]() |
We will use machine studying to make a predictor for this information:
![]() |
Making use of the predictor to a selected enter provides us a prediction:
![]() |
What was necessary in making this prediction? The "SHAPValues" property launched in Model 12.3 tells us what contribution every characteristic made to the outcome; on this case v was extra necessary than u in figuring out the worth of the prediction:
![]() |
However what about on the whole, for all inputs? The brand new perform FeatureImpactPlot provides a visible illustration of the contribution or “impression” of every characteristic in every enter on the output of the predictor:
![]() |
What does this plot imply? It’s mainly exhibiting how usually there are what contributions from values of the 2 enter options. And with this specific predictor we see that there’s a variety of contributions from each options.
If we use a unique technique to create the predictor, the outcomes might be fairly totally different. Right here we’re utilizing linear regression, and it seems that with this technique v by no means has a lot impression on predictions:
![]() |
If we make a predictor utilizing a choice tree, the characteristic impression plot reveals the splitting of impression similar to totally different branches of the tree:
![]() |
FeatureImpactPlot provides a type of hen’s-eye view of the impression of various options. FeatureValueImpactPlot provides extra element, exhibiting as a perform of the particular values of enter options the impression factors with these values would have on the ultimate prediction (and, sure, the precise factors plotted listed below are primarily based on information simulated on the idea of the distribution inferred by the predictor; the precise information is normally too huge to need to carry round, a minimum of by default):
![]() |
CumulativeFeatureImpactPlot provides a visible illustration of how “successive” options have an effect on the ultimate worth for every (simulated) information level:
![]() |
For predictors, characteristic impression plots present impression on predicted values. For classifiers, they present impression on (log) possibilities for specific outcomes.
Mannequin Predictive Management
One space that leverages many algorithmic capabilities of the Wolfram Language is management programs. We first began growing management programs performance greater than 25 years in the past, and by Model 8.0 ten years in the past we began to have built-in features like StateSpaceModel and BodePlot particularly for working with management programs.
Over the previous decade we’ve progressively been including extra built-in management programs capabilities, and in Model 13.1 we’re now introducing mannequin predictive controllers (MPCs). Many easy management programs (like PID controllers) take an advert hoc method through which they successfully simply “watch what a system does” with out making an attempt to have a particular mannequin for what’s happening contained in the system. Mannequin predictive management is about having a particular mannequin for a system, after which deriving an optimum controller primarily based on that mannequin.
For instance, we may have a state-space mannequin for a system:
![]() |
Then in Model 13.1 we will derive (utilizing our parametric optimization capabilities) an optimum controller that minimizes a sure set of prices whereas satisfying specific constraints:
![]() |
The SystemsModelControllerData that we get right here incorporates a wide range of components that enable us to automate the management design and evaluation workflow. For instance, we will get a mannequin that represents the controller operating in a closed loop with the system it’s controlling:
![]() |
Now let’s think about that we drive this complete system with the enter:
![]() |
Now we will compute the output response for the system, and we see that each output variables are pushed to zero by the operation of the controller:
![]() |
Throughout the SystemsModelControllerData object generated by ModelPredictiveController is the precise controller computed on this case—utilizing the brand new assemble DiscreteInputOutputModel:
![]() |
What really is that this controller? In the end it’s a set of piecewise features that will depend on the values of states x1[t] and x2[t]:
![]() |
And this reveals the totally different state-space areas through which the controller has:
![]() |
Algorithmic and Randomized Quizzes
In Model 13.0 we launched our query and evaluation framework that permits you to creator issues like quizzes in notebooks, along with evaluation features, then deploy these to be used. In Model 13.1 we’re including capabilities to allow you to algorithmically or randomly generate questions.
The 2 new features QuestionGenerator and QuestionSelector allow you to specify inquiries to be generated based on a template, or randomly chosen from a pool. You possibly can both use these features straight in pure Wolfram Language code, or you should use them by the Query Pocket book authoring GUI.
When you choose Insert Query within the GUI, you now get a selection between Mounted Query, Randomized Query and Generated Query:
![]() |
Decide Randomized Query and also you’ll get
![]() |
which then permits you to enter questions, and ultimately produce a QuestionSelector—which is able to choose newly randomized questions for each copy of the quiz that’s produced:
![]() |
Model 13.1 additionally introduces some enhancements for authoring questions. An instance is a pure-GUI “no-code” strategy to specify multiple-choice questions:
![]() |
The ExprStruct Information Construction
Within the Wolfram Language expressions usually have two features: they’ve a construction, and so they have a that means. Thus, for instance, Plus[1,1] has each a particular tree construction
![]() |
and has a worth:
![]() |
Within the regular operation of the Wolfram Language, the evaluator is robotically utilized to all expressions, and basically the one strategy to keep away from analysis by the evaluator is to insert “wrappers” like Maintain and Inactive that essentially change the construction of expressions.
In Model 13.1, nevertheless, there’s a brand new strategy to deal with “unevaluated” expressions: the "ExprStruct" information construction. ExprStructs characterize expressions as uncooked information constructions which might be by no means straight seen by the evaluator, however can nonetheless be structurally manipulated.
This creates an ExprStruct similar to the expression {1,2,3,4}:
![]() |
This structurally wraps Complete across the record, however does no analysis:
![]() |
One may also see this by “visualizing” the information construction:
![]() |
Regular takes an ExprStruct object and converts it to a standard expression, to which the evaluator is robotically utilized:
![]() |
One can do a wide range of basically structural operations straight on an ExprStruct. This is applicable Plus, then maps Factorial over the ensuing ExprStruct:
![]() |
The result’s an ExprStruct representing an unevaluated expression:
![]() |
With "MapImmediateEvaluate" there may be an analysis completed every time the mapping operation generates an expression:
![]() |
One highly effective use of ExprStruct is in doing code transformations. And in a typical case one would possibly need to import expressions from, say, a .wl file, then manipulate them in ExprStruct kind. In Model 13.1 Import now helps an ExprStructs import component:
![]() |
This selects expressions that correspond to definitions, within the sense that they’ve SetDelayed as their head:
![]() |
Right here’s a visualization of the primary one:
![]() |
Tremendous-Environment friendly Compiler-Primarily based Exterior Code Interplay
Let’s say you’ve obtained exterior code that’s in a compiled C-compatible dynamic library. An necessary new functionality in Model 13.1 is a super-efficient and really streamlined strategy to name any perform in a dynamic library straight from throughout the Wolfram Language.
It’s one of many accelerating stream of developments which might be being made doable by the large-scale infrastructure build-out that we’ve been doing in reference to the brand new Wolfram Language compiler—and particularly it usually leverages our refined new type-handling capabilities.
As a primary instance, let’s contemplate the RAND_bytes (“cryptographically safe pseudorandom quantity generator”) perform in OpenSSL. The C declaration for this perform is:
In Model 13.1 we now have a symbolic strategy to characterize such a declaration straight within the Wolfram Language:
![]() |
(Typically we’d additionally need to specify the library that this perform is coming from. OpenSSL occurs to be a library that’s loaded by default with the Wolfram Language so that you don’t want to say it.)
There are fairly just a few new issues happening within the declaration. First, as a part of our assortment of compiled varieties, we’re including ones like "CInt" and "CChar" that discuss with uncooked C language varieties (right here int and char). There’s additionally CArray which is for declaring C arrays. Discover the brand new ::[ ... ] syntax for TypeSpecifier that enables compact specs for parametrized varieties, just like the char* right here, that’s described in Wolfram Language as "CArray"::["CChar"].
Having arrange the declaration, we now must create an precise perform that may take an argument from Wolfram Language, convert it to one thing appropriate for the library perform, then name the library perform, and convert the outcome again to Wolfram Language kind. Right here’s a approach to try this on this case:
![]() |
What we get again is a compiled code perform that we will straight use, and that works by very effectively calling the library perform:
![]() |
The FunctionCompile above makes use of a number of constructs which might be new in Model 13.1. What it basically does is to take a Wolfram Language integer (which it assumes to be a machine integer), solid it right into a C integer, then move this to the library perform, together with a specification of a C char * into which the library perform will put its outcome, and from which the ultimate Wolfram Language outcome shall be retrieved.
It’s price emphasizing that a lot of the complexity right here has to do with dealing with information varieties and conversions between them—one thing that the Wolfram Language goes to plenty of hassle to keep away from normally exposing the person to. However after we’re connecting to exterior languages that make elementary use of varieties, there’s no selection however to cope with them, and the complexity they contain.
Within the FunctionCompile above the primary new assemble we encounter is
![]() |
The essential goal of that is to create the buffer into which the exterior perform will write its outcomes. The buffer is an array of bytes, declared in C as char *, or right here as "CArray"::["CChar"]. There’s an precise wrinkle although: who’s going to handle the reminiscence related to this array? The "Managed":: sort specifier says that the Wolfram Language wrapper will do reminiscence administration for this object.
The following new assemble we see within the FunctionCompile is
![]() |
Solid is one in all a household of recent features that may seem in compilable code, however haven’t any significance exterior the compiler. Solid is used to specify that information must be transformed to a kind per a specified sort (right here a C int sort).
The core of the FunctionCompile is using LibraryFunction, which is what really calls the exterior library perform that we declared with the library perform declaration.
The final step within the perform compiled by FunctionCompile is to extract information from the C array and return it as a Wolfram Language record. To do that requires the brand new perform FromRawPointer, which really retrieves information from a specified location in reminiscence. (And, sure, this can be a uncooked dereferencing operation that may trigger a crash if it isn’t completed accurately.)
All of this may occasionally at first appear slightly difficult, however for what it’s doing, it’s remarkably easy—and enormously leverages the entire symbolic construction of the Wolfram Language. It’s additionally price realizing that on this specific instance, we’re simply dipping into compiled code after which returning outcomes. In larger-scale instances we’d be doing many extra operations—usually specified straight by top-level Wolfram Language code—inside compiled code, and so sort declaration and conversion operations can be a smaller fraction of the code we have now to jot down.
One characteristic of the instance we’ve simply checked out is that it solely makes use of built-in varieties. However in Model 13.1 it’s now doable to outline customized varieties, such because the analog of C structs. For instance, contemplate the perform ldiv from the C commonplace library. This perform returns an object of sort ldiv_t, outlined by the next typedef:
Right here’s the Wolfram Language model of this declaration, primarily based on establishing a "Product" sort named "CLDivT":
![]() |
(The "ReferenceSemantics"→False possibility specifies that this sort will really be handed round as a worth, slightly than only a pointer to a worth.)
Now the declaration for the ldiv perform can use this new customized sort:
![]() |
The ultimate definition of the decision to the exterior ldiv perform is then:
![]() |
And now we will use the perform (and, sure, it is going to be as environment friendly as if we’d straight written every part in C):
![]() |
The examples we’ve given listed below are very small ones. However the entire construction for exterior perform calls that’s now in Model 13.1 is ready as much as deal with massive and complicated conditions—and certainly we’ve been utilizing it internally with nice success to arrange necessary new built-in items of the Wolfram Language.
One of many components that’s usually wanted in additional complicated conditions is extra refined reminiscence administration, and our new "Managed" sort gives a handy and streamlined approach to do that.
This makes a compiled perform that creates an array of 10,000 machine integers:
![]() |
Operating the perform successfully “leaks” reminiscence:
![]() |
However now outline a model of the perform through which the array is “managed”:
![]() |
Now the reminiscence related to the array is robotically freed when it’s not referenced:
![]() |
Instantly Compiling Operate Definitions
When you have an express pure perform (Operate[...]) you should use FunctionCompile to supply a compiled model of it. However what when you’ve got a perform that’s outlined utilizing downvalues, as in:
![]() |
In Model 13.1 you’ll be able to straight compile perform definitions like this. However—as is the character of compilation—you’ve got declare what varieties are concerned. Here’s a declaration for the perform fac that claims it takes a single machine integer, and returns a machine integer:
![]() |
Now we will create a compiled perform that computes fac[n]:
![]() |
The compiled perform runs considerably sooner than the abnormal symbolic definition:
![]() |
![]() |
The flexibility to declare and use downvalue definitions in compilation has the necessary characteristic that it permits you to write a definition simply as soon as, after which use it each straight, and in compiled code.
Manipulating Expressions in Compiled Code
An early focus of the Wolfram Language compiler is dealing with low-level “machine” varieties, similar to integers or reals of sure lengths. However one of many advances within the Model 13.1 compiler is direct assist for an "InertExpression" sort for representing any Wolfram Language expression inside compiled code.
Once you use one thing like FunctionCompile, it’s going to explicitly attempt to compile no matter Wolfram Language expressions it’s given. However in case you wrap the expressions with InertExpression the compiler will then simply deal with the expressions as inert structural objects of sort "InertExpression". This units up a compiled perform that constructs an expression (implicitly of sort "InertExpression"):
![]() |
Evaluating the perform constructs after which returns the expression:
![]() |
Usually, throughout the compiler, an "InertExpression" object shall be handled in a purely structural approach, with none analysis (and, sure, it’s intently associated to the "ExprStruct" information construction). However generally it’s helpful to carry out analysis on it, and you are able to do this with InertEvaluate:
![]() |
Now the InertEvaluate does the analysis earlier than wrapping Maintain across the inert expression:
![]() |
The flexibility to deal with expressions straight within the compiler would possibly appear to be some type of element. Nevertheless it’s really massively necessary in opening up prospects for future improvement with the Wolfram Language. For the previous 35 years, we’ve internally been capable of write low-level expression manipulation code as a part of the C language core of the Wolfram Language kernel. However the means of the Wolfram Language compiler to deal with expressions now opens this up—and lets anybody write maximally environment friendly code for manipulating expressions that interoperate with every part else within the Wolfram Language.
And Nonetheless Extra…
Even past all of the issues I’ve mentioned to date, there are all types of additional additions and enhancements in Model 13.1, dotted all through the system.
InfiniteLineThrough and CircularArcThrough have been added for geometric computation, and geometric scene specification. Geometric scenes can now be styled for customized presentation:
![]() |
There are new graph features: GraphProduct, GraphSum and GraphJoin:
![]() |
And there are new built-in households of graphs: TorusGraph and BuckyballGraph:
![]() |
You possibly can combine photos straight into Graphics (and Graphics3D):
![]() |
AbsoluteOptions now resolves many extra choices in Graphics, telling you what express worth was used whenever you gave an possibility simply as Computerized.
The perform LeafCount now has a Heads possibility, to depend expression branches inside heads. Splice works with any head, not simply Record. Features like IntersectingQ now have SameTest choices. You possibly can specify TimeZone choices utilizing geographic entities (like cities).
FindClusters now allows you to specify precisely what number of clusters you need to partition your information into, in addition to supporting UpTo[n].
In neural nets, ElementwiseLayer now helps “fashionable” nonconvex nonmonotonic activation features like Mish and GELU, AttentionLayer helps dropout and native masking, ReplicateLayer now helps integer arrays, and RandomArrayLayer helps additional statistical distributions. NetTrain now handles multioutput and nonscalar losses. Picture encoders and decoders assist resampling and padding, and there’s now assist for nuclear sampling. Our assist for the ONNX switch format continues to develop, with internet operators added in Model 13.1.
CenteredInterval—launched in Model 13.0—now helps 36 additional particular features (and, sure, every one wants theorems proved to make this work).
There’ll be extra approaching this in subsequent variations, however in Model 13.1 we’re starting the introduction of structured matrices which might be saved and computed with in particular, optimized methods. Examples embrace PermutationMatrix and LowerTriangularMatrix.
We’ve had intensive assist for computational microscopy for some time. However in Model 13.1 the "BioImageFormat" Import format now provides importing of the greater than 160 uncooked picture codecs utilized by totally different sorts of microscopes.
Model 13.0 dramatically expanded our means to import PDF. We’ve additional enhanced this in Model 13.1, for instance permitting positioned textual content to be imported into graphics as Textual content primitives.
We’ve supported commonplace textual content types like daring and italic perpetually, however now we have now a normal strategy to deal with struckthrough textual content as nicely:
![]() |
Along with all these “inside-the-system” enhancements, we’ve additionally completed making it doable to obtain desktop variations of Wolfram Language on all platforms (together with Linux) whereas leaving documentation on the internet. Documentation set up may also now be configured globally on a per-machine foundation, slightly than simply on a per-user foundation.
So—as of immediately, documentation or not—you may get Model 13.1 in your laptop. Oh, and the Wolfram Cloud has additionally now been up to date to make use of Model 13.1. I hope you get pleasure from the brand new options, and this subsequent step on the epic journey of Mathematica and the Wolfram Language.