Wolfram Computation Meets Knowledge

Wolfram Language

Best of Blog

Computational Chemistry: Find the Solution with Wolfram Technologies

From preparing food to nourish our bodies to finding cures for terminal illnesses, chemistry is a foundational part of our world. As a computational chemist, you may have a lot to learn to master this subject, but fueled by Wolfram’s collection of educational resources, elaborate simulation functions and research projects, you’ll be ready to tackle this exciting science head on.

Current Events & History

Instant Plugins for ChatGPT: Introducing the Wolfram ChatGPT Plugin Kit

A few weeks ago, in collaboration with OpenAI, we released the Wolfram plugin for ChatGPT, which lets ChatGPT use Wolfram Language and Wolfram|Alpha as tools, automatically called from within ChatGPT. One can think of this as adding broad “computational superpowers” to ChatGPT, giving access to all the general computational capabilities and computational knowledge in Wolfram […]

Best of Blog

Computational Astronomy: Learning beyond the Stars with Wolfram Technologies

With Global Astronomy Month in full swing, it’s exciting to see the merging of Wolfram Language and the world of astronomy in so many different applications from our developers and users—from courses to books to projects on Wolfram Community. No matter where you’re at in your computational astronomy journey, the following resources will encourage you […]

Education & Academic

New in 13.2: The Beginnings of Astro Graphics

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

The Beginnings of Astro Graphics

In addition to being able to compute astronomical things, Version 13.2 includes first steps in visualizing astronomical things. There’ll be more on this in subsequent versions. But Version 13.2 already has some powerful capabilities.

As a first example, here’s a part of the sky around Betelgeuse as seen right now from where I am:

Zooming out, one can see more of the sky:

There are lots of options for how things should be rendered. Here we’re seeing a realistic image of the sky, with grid lines superimposed, aligned with the equator of the Earth:

And here we’re seeing a more whimsical interpretation:

Just like for maps of the Earth, projections matter. Here’s a Lambert azimuthal projection of the whole sky:

The blue line shows the orientation of the Earth’s equator, the yellow line shows the plane of the ecliptic (which is basically the plane of the Solar System), and the red line shows the plane of our galaxy (which is where we see the Milky Way).

If we want to know what we actually “see in the sky” we need a stereographic projection (in this case centered on the south direction):

There’s a lot of detail in the astronomical data and computations we have (and even more will be coming soon). So, for example, if we zoom in on Jupiter we can see the positions of its moons (though their disks are too small to be rendered here):

It’s fun to see how this corresponds to Galileo’s original observation of these moons more than 400 years ago. This is from Galileo:

The old typesetting does cause a little trouble:

But the astronomical computation is more timeless. Here are the computed positions of the moons of Jupiter from when Galileo said he saw them, in Padua:

And, yes, the results agree!

By the way, here’s another computation that could be verified soon. This is the time of maximum eclipse for an upcoming solar eclipse:

And here’s what it will look like from a particular location right at that time:

Education & Academic

New in 13.2: Introducing Astro Computation

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

Introducing Astro Computation

Astronomy has been a driving force for computation for more than 2000 years (from the Antikythera device on)... and in Version 13.2 it’s coming to Wolfram Language in a big way. Yes, the Wolfram Language (and Wolfram|Alpha) have had astronomical data for well over a decade. But what’s new now is astronomical computation fully integrated into the system. In many ways, our astro computation capabilities are modeled on our geo computation ones. But astro is substantially more complicated. Mountains don’t move (at least perceptibly), but planets certainly do. Relativity also isn’t important in geography, but it is in astronomy. And on the Earth, latitude and longitude are good standard ways to describe where things are. But in astronomy—especially with everything moving—describing where things are is much more complicated. Oh, and there’s the question of where things “are,” versus where things appear to be—because of effects ranging from light-propagation delays to refraction in the Earth’s atmosphere.

The key function for representing where astronomical things are is AstroPosition. Here’s where Mars is now:

What does that output mean? It’s very “here and now” oriented. By default, it’s telling me the azimuth (angle from north) and altitude (angle above the horizon) for Mars from where Here says I am, at the time specified by Now. How can I get a less “personal” representation of “where Mars is”? Because if even I just reevaluate my previous input now, I’ll get a slightly different answer, just because of the rotation of the Earth:

One thing to do is to use equatorial coordinates, that are based on a frame centered at the center of the Earth but not rotating with the Earth. (One direction is defined by the rotation axis of the Earth, the other by where the Sun is at the time of the spring equinox.) The result is the “astronomer-friendly” right ascension/declination position of Mars:

And maybe that’s good enough for a terrestrial astronomer. But what if you want to specify the position of Mars in a way that doesn’t refer to the Earth? Then you can use the now-standard ICRS frame, which is centered at the center of mass of the Solar System:

Often in astronomy the question is basically “which direction should I point my telescope in?”, and that’s something one wants to specify in spherical coordinates. But particularly if one’s “out and about in the Solar System” (say thinking about a spacecraft), it’s more useful to be able to give actual Cartesian coordinates for where one is:

And here are the raw coordinates (by default in astronomical units):

AstroPosition is backed by lots of computation, and in particular by ephemeris data that covers all planets and their moons, together with other substantial bodies in the Solar System:

By the way, particularly the first time you ask for the position of an obscure object, there may be some delay while the necessary ephemeris gets downloaded. The main ephemerides we use give data for the period 2000–2050. But we also have access to other ephemerides that cover much longer periods. So, for example, we can tell where Ganymede was when Galileo first observed it:

We also have position data for more than 100,000 stars, galaxies, pulsars and other objects—with many more coming soon:

Things get complicated very quickly. Here’s the position of Venus seen from Mars, using a frame centered at the center of Mars:

If we pick a particular point on Mars, then we can get the result in azimuth-altitude coordinates relative to the Martian horizon:

Another complication is that if you’re looking at something from the surface of the Earth, you’re looking through the atmosphere, and the atmosphere refracts light, making the position of the object look different. By default, AstroPosition takes account of this when you use coordinates based on the horizon. But you can switch it off, and then the results will be different—and, for example, for the Sun at sunset, substantially different:

And then there’s the speed of light, and relativity, to think about. Let’s say we want to know where Neptune “is” now. Well, do we mean where Neptune “actually is”, or do we mean “where we observe Neptune to be” based on light from Neptune coming to us? For frames referring to observations from Earth, we’re normally concerned with the case where we include the “light time” effect—and, yes, it does make a difference:

OK, so AstroPosition—which is the analog of GeoPosition—gives us a way to represent where things are, astronomically. The next important function to discuss is AstroDistance—the analog of GeoDistance.

This gives the current distance between Venus and Mars:

This is the current distance from where we are (according to Here) and the position of the Viking 2 lander on Mars:

This is the distance from Here to the star τ Ceti:

To be more precise, AstroDistance really tells us the distance from a certain object, to an observer, at a certain local time for the observer (and, yes, the fact that it’s local time matters because of light delays):

And, yes, things are quite precise. Here’s the distance to the Apollo 11 landing site on the Moon, computed 5 times with a 1-second pause in between, and shown to 10-digit precision:

This plots the distance to Mars for every day in the next 10 years:

Another function is AstroAngularSeparation, which gives the angular separation between two objects as seen from a given position. Here’s the result from Jupiter and Saturn (seen from the Earth) over a 20-year span:

Education & Academic

Fuel for the Future: Sustainable Foods with Wolfram Language

National Nutrition Month® is here, and the theme is “Fuel for the Future.” The future of food is sustainability, which we will explore through Wolfram Language. What is sustainable eating? It’s choosing the right foods, reducing food waste, eating local foods in season and even growing your own garden. Sustainability can lead to personal and planetary health.
Education & Academic

Getting Hot and Spicy on the Scoville Scale with Wolfram Language

National Chili Day is February 23 and we’re celebrating the spicy heat that peppers bring to a great bowl of chili by exploring the "ScovilleRating" property in Wolfram Language. The Scoville scale ranks the spiciness (or pungency) of peppers by measuring the amount of the molecule capsaicin in a pepper and assigning it a number rating in Scoville heat units (SHUs). Pharmacist and chemist Wilbur Scoville introduced the “Scoville organoleptic test,” which eventually became the Scoville scale, in 1912. At the time, Mr. Scoville relied on human taste testers willing to do this challenging job. Today, scientists use high-performance liquid chromatography (HPLC) to determine the precise amount of capsaicin in a pepper.
Education & Academic

New Interactive Course Teaches Useful Tips from an Expert Programmer

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

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

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

Motivation from History

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

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

Overview

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

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

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

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

Lessons

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

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

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

Exercises

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

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

Quizzes

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

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

Certifications Available

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

Feedback from Daily Study Group Participants

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

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

A Building Block for Success

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

Acknowledgments

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

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