You can use the Shortcuts app on your iPhone or iPad to create scripts that calculate the results of complex formulas. In this example, we'll ask for the inputs needed for the simple physics position formula: time, initial position, initial velocity and acceleration. We'll then calculate the position of the object at that time. Unfortunately, there is no simple way to process a formula in Shortcuts yet, but we can use a series calculator functions to do it.

**Video Transcript / Captions**

Closed captioning for this video is available on YouTube: Siri Shortcuts: Physics Position Formula.

So one possible use of the Shortcuts app on the iPhone or iPad is to allow you to perform complex formulas over and over again and have it in kind of a nice little program environment where it prompts you for each thing. So for example let's say you're studying physics and you're using the position formula where you can take variables like the time, the initial position, velocity and acceleration and figure out the position of a ball rolling on a table, a car rolling down a hill or a rocket shooting up into space. Here's what the formula looks like and we're going to recreate that using Shortcuts.

So, get the Shortcuts app if you don't already have it in the iOS App Store. It's the one from Apple of course. I already have it there at the bottom. You see Physics Position Formula. But let me show you how to create at least the first few steps manually so you see how I do it.

The first thing we want to do is we want to have a nice little asking interface where it asks for things. So we're going to search for Ask For Input and I'm going to add that. We'll do a question like, what is the time? Then we'll go ahead and set an initial value to zero and change it to a number. Great, so we're going to have lots of inputs like that.

Now we want to save this time variable. We'll put it into a variable here. So I'll so Set Variable. Now we could use the magic variables in there but I think for something like this it gets really complex pretty fast so I think creating variables with names makes a lot of sense. So, we'll do time. So now it's going to ask you for the time and then you'll set it. If I run it you can see what happens. Asks you for the time, what's the time, hit Okay, and then that's it.

So now we will go and do the next thing which is going to ask again for an initial position. So Ask For Input. I'm just going to save some time here by typing Position, instead of Ask for Position. The default answer of zero. Very commonly when you do this type of equation you're starting at zero. You know the rockets launching from the ground or whatever. So you have that. Then we'll do another set variable and then we'll put that in the answer because what we're going to do is we'll start with the initial position and then we'll keep adding things to it. So we might as well do it here. I could set it to initial position or something like that but then I would just have to add a bunch of more steps to add that to the eventual answer. We've go that.

Now let's add another Ask For Input and we'll, this time, ask for velocity, the initial velocity of it and we'll do a zero number and then we'll basically take that. We're going to run a calculation with it. There's no reason for us to store it in a variable because we can use it right away. So we'll do a calc, calculate, and this is where it's just really disappointing because it would be great if you could store all these inputs into variables and then do one little mathematical formula like you could do in a normal programming languages. But here all you can do is all these little calculations like you're using a calculator. So you can just do one calculation at a time.

So what we're going to do with this one is we're going to multiply the velocity times the time. So we have the velocity coming out of that last input there. Now we have to multiply that, so we'll change it to multiply, and we'll go and choose the variable time. So we're going to get the result of the velocity times the time. Now we're going to do another calculation. We're going to add that. Remember this is kind of like doing it on a calculator so the order of operations is kind of like you're going to do the multiplication first and then you're going to add it to the answer. Great. So now we have most of the equation done.

Now we want to set a variable and what we can do is basically give it the same name. We'll set the answer. So we're going to replace the answer with it. So that's what we've got so far. Part of it. I'm going to go and jump right here into the finished one so you can see what it looks like. You can see here I'm doing things a little nicer. What is the time value and I put the parentheses S for seconds. Right. Then I set that to time. What is the initial position. In parentheses M for meters and take that and put that in answer. What's the initial velocity. M/S, meters per second and the number there. Then I do that calculation like we just did. Multiply that by the time and add the answer and then store it back in the answer.

Now we're going to ask what's the acceleration. Meters per second squared and we'll take that. We'll then calculate that times the time and times the time again because it's times squared. Times .5 because you multiply by one half and then we'll add that to the answer. No need to sort back in the answer because now we can just output it. I use QuickLook for the output. You can do Show Result and then have a nice little output of the result there. QuickLook does the trick. So I can run it now. Actually I set it to a name. Physics Position Formula. Gave it a little rocketship icon. Set Show it in the Widgets but I didn't really need it anywhere else. I didn't need it to Set Siri. I don't need to activate this with my voice.

So now when I run it's going to ask what's the time value. Let's say five seconds. What's the initial position. Let's say ten meters. What's the initial velocity. Let's say 15 meters per second. What's the acceleration. Let's say 2 meters per second squared. It's going to give me the result of 110. If you run it through the formula it's the correct answer. So now I can use this, very quickly, to calculate the position formula whenever I need it.

So one possible use of the Shortcuts app on the iPhone or iPad is to allow you to perform complex formulas over and over again and have it in kind of a nice little program environment where it prompts you for each thing. So for example let's say you're studying physics and you're using the position formula where you can take variables like the time, the initial position, velocity and acceleration and figure out the position of a ball rolling on a table, a car rolling down a hill or a rocket shooting up into space. Here's what the formula looks like and we're going to recreate that using Shortcuts.

So, get the Shortcuts app if you don't already have it in the iOS App Store. It's the one from Apple of course. I already have it there at the bottom. You see Physics Position Formula. But let me show you how to create at least the first few steps manually so you see how I do it.

The first thing we want to do is we want to have a nice little asking interface where it asks for things. So we're going to search for Ask For Input and I'm going to add that. We'll do a question like, what is the time? Then we'll go ahead and set an initial value to zero and change it to a number. Great, so we're going to have lots of inputs like that.

Now we want to save this time variable. We'll put it into a variable here. So I'll so Set Variable. Now we could use the magic variables in there but I think for something like this it gets really complex pretty fast so I think creating variables with names makes a lot of sense. So, we'll do time. So now it's going to ask you for the time and then you'll set it. If I run it you can see what happens. Asks you for the time, what's the time, hit Okay, and then that's it.

So now we will go and do the next thing which is going to ask again for an initial position. So Ask For Input. I'm just going to save some time here by typing Position, instead of Ask for Position. The default answer of zero. Very commonly when you do this type of equation you're starting at zero. You know the rockets launching from the ground or whatever. So you have that. Then we'll do another set variable and then we'll put that in the answer because what we're going to do is we'll start with the initial position and then we'll keep adding things to it. So we might as well do it here. I could set it to initial position or something like that but then I would just have to add a bunch of more steps to add that to the eventual answer. We've go that.

Now let's add another Ask For Input and we'll, this time, ask for velocity, the initial velocity of it and we'll do a zero number and then we'll basically take that. We're going to run a calculation with it. There's no reason for us to store it in a variable because we can use it right away. So we'll do a calc, calculate, and this is where it's just really disappointing because it would be great if you could store all these inputs into variables and then do one little mathematical formula like you could do in a normal programming languages. But here all you can do is all these little calculations like you're using a calculator. So you can just do one calculation at a time.

So what we're going to do with this one is we're going to multiply the velocity times the time. So we have the velocity coming out of that last input there. Now we have to multiply that, so we'll change it to multiply, and we'll go and choose the variable time. So we're going to get the result of the velocity times the time. Now we're going to do another calculation. We're going to add that. Remember this is kind of like doing it on a calculator so the order of operations is kind of like you're going to do the multiplication first and then you're going to add it to the answer. Great. So now we have most of the equation done.

Now we want to set a variable and what we can do is basically give it the same name. We'll set the answer. So we're going to replace the answer with it. So that's what we've got so far. Part of it. I'm going to go and jump right here into the finished one so you can see what it looks like. You can see here I'm doing things a little nicer. What is the time value and I put the parentheses S for seconds. Right. Then I set that to time. What is the initial position. In parentheses M for meters and take that and put that in answer. What's the initial velocity. M/S, meters per second and the number there. Then I do that calculation like we just did. Multiply that by the time and add the answer and then store it back in the answer.

Now we're going to ask what's the acceleration. Meters per second squared and we'll take that. We'll then calculate that times the time and times the time again because it's times squared. Times .5 because you multiply by one half and then we'll add that to the answer. No need to sort back in the answer because now we can just output it. I use QuickLook for the output. You can do Show Result and then have a nice little output of the result there. QuickLook does the trick. So I can run it now. Actually I set it to a name. Physics Position Formula. Gave it a little rocketship icon. Set Show it in the Widgets but I didn't really need it anywhere else. I didn't need it to Set Siri. I don't need to activate this with my voice.

So now when I run it's going to ask what's the time value. Let's say five seconds. What's the initial position. Let's say ten meters. What's the initial velocity. Let's say 15 meters per second. What's the acceleration. Let's say 2 meters per second squared. It's going to give me the result of 110. If you run it through the formula it's the correct answer. So now I can use this, very quickly, to calculate the position formula whenever I need it.

View the Shortcut

Get the Shortcut

Proof of your card carrying nerd membership. Ha ha ha!