SwiftCalcs BlogNews, New Features and Examples from The SwiftCalcs Team

Copy Matrix Now Outputs CSV


There is a new feature at SwiftCalcs that if you work with large matrix you will find very useful.
In the past if you copy a matrix or vector variable you will get a latex string text. That you could not use if you wanted to do some more analysis on the data

Now, selecting and copying a Matrix variable, outputs CSV text, which can be saved in a file or pasted into a spreadsheet document for further analysis


What's New for May: Programs and Multi-line Functions

A new month means new features at Swift Calcs, and today we are excited to announce the availability of multi-line functions, which we call programs, in Swift Calcs.


Often times when performing an engineering calculation, we have create a set of steps to determine an answer based on one or more inputs. When we can simplify this down to a single line, we can use a function in Swift Calcs.

But what if we need more than one line? Swift Calcs has allowed conditional piece-wise functions since December, but any other multi-line functions or structures were not possible, until now.

Introducing Programs

Multi-line functions in Swift Calcs are called programs. With a program, a set of Swift Calcs commands are pre-compiled before use, greatly speeding calculation time and allowing for complex calculations to be repeated for a number of inputs or settings.

Programs allow all normal Swift Calcs commands that set the value of variables or functions, including math mode, solvers, and other tools from the toolbox. Chain commands together just like in a worksheet, and return your value for later use.

An Example

The easiest way to understand programs is by looking at an example. Consider finding the solution to a cubic equation in Swift Calcs:


What if we wanted to know the solution for a number of cubic equations with a differing cubic term coefficient? Before programs, we would have to copy the solver line multiple times, and update it each time for the value of the coefficient we want to solve for.

Programs provide another way. By using a program, we can wrap the solver into a function definition, and return the value:


Here, we have defined a program, cubic, with a single input, A. Inside the program, we utilize the solver, which depends on A, to find the solution near -1 to our cubic equation, and store it in a local variable, result. We finally use the return statement to return the value in result to the function.

On the next lines, we call the cubic program like we would any other function, and the solution is immediately returned. You can use programs anywhere like you would a function, even in plots...let's plot the cubic program for input values from 4 to 8:


Or use the solver to find the cubic coefficient that has a root at -1.35:


Programs can have any number of inputs, and any number of internal lines, to produce a single output. Multiple outputs can be returned as an array. Flow control, including if statements and for loops, allow you to add complexity and logic to your programs. And like any other function or variables, whole programs can be included in to other worksheets using the include worksheet tool.

Getting Started

To create a program, click and drag the program tool from the Programming section of the toolbox on to your worksheet. Alternatively, you can type program followed by a space on a new math-mode line.

Need more information? Check out the help article on programs and our new example on multivariate hypergemoetric distributions to see a complex program in action.

What's New: Include Variables from Other Worksheets

We've been spending the last weeks hard at work adding new functionality to the Swift Calcs platform and are excited to today announce the first major feature from this effort: the ability to include variables and functions into a worksheet.

Often times when performing calculations, it is useful to segregate different aspects of a calculation into multiple worksheets, or to define different inputs in different locations. Starting now, you can include variables or functions into a Swift Calcs worksheet that are defined in another worksheet. Get started by clicking the Import Worksheet tool under the General tab in the toolbox. You can include variables from any worksheet to which you have read level access, whether you are the original author or whether the worksheet was shared with you.

For users on our Free Public plan, you can include up to 2 variables or functions per source worksheet. For our Paid members, there are no limits on the numbers of variables or sources you can include in your work.

But wait, there's more...

We weren't done there, however. In addition to including your own worksheets, Swift Calcs has built a curated library of worksheets complete with useful constants and functions for a variety of engineering and scientific fields. We are starting today with constant libraries for the following fields:

When using the Include Worksheet tool, you'll be given the option of loading from the Swift Calcs library. We are working hard to increase the number of curated worksheets available over and plan to release more over the next few months, so keep checking back!

And we still weren't done

Often, its useful to define your own standard set of constants or functions for use in your work. Swift Calcs also allows you to set a default set of worksheets and variables to include in every new worksheet you create, ensuring your library of information is always automatically loaded for you. Set up your own defaults by clicking Change Settings under the account menu at the top right, or by clicking Change Default Settings under the Options menu in the menubar.

More help is available

Learn more about this feature and how to use it in the Swift Calcs help articles.

Hot off the press: Plots and Charts with Plotly.js

Our graphics team is happy to announce that Swift Calcs plots and charts are now driven by the wonderful open source library plotly.js!

Built on d3.js, plotly.js offers a wide range of chart types, visual styles, and display options that enable more refined and visually pleasing plots and charts in Swift Calcs. This new library is a great improvement over the previous library we relied on, bringing with it great cross-browser support, stability, and a wide range of options.

And what does this mean for me?

As of today, Plotly has been integrated into Swift Calcs as a true drop-in replacement. Your plots, including styling options for markers, lines, and colors, will now appear in Plotly generated diagrams. The plot types have been simplified, and more display options are available, including:

More plots are next...

The change to Plotly also opens a wide range of new plot options to the Swift Calcs development team, and we are working hard to enable these new plot styles for general use. Soon, Swift Calcs will support contour plots, interactive 3D wireframe and surface plots, bubble plots, pie charts, and more.

So here's a thanks to Plotly.js and the wonderful open-source software community for powering the graphics back-end that makes Swift Calcs possible!

What's New: February 2017

Celebrate Valentine's Day with these new features from Swift Calcs...you'll fall in love with math all over again!

Unit Pre-Processing and Adaptive Plots

As outlined in an extensive blog post, we increased the speed of solvers and plots by 5-100x through the use of unit pre-processing and adaptive plotting. The chart below shows computation times for some of our test scripts before and after this update...it's made an incredible impact! Head over to the blog for a full rundown.

Variable Accents

An often requested feature, Swift Calcs now supports adding accent characters to variable names, including single, double, and triple dots, tilde, bar, and the vector symbol. Find the new accents in the math toolbar!

Checkbox, Radio, and Pulldown Inputs for Variables

The slider is one of the most-used tools in the Swift Calcs toolbox, providing a visual and interactive way to set the value of a variable for use later in a worksheet.

We have now added three more interactive entry tools, all available in the Variables section of the toolbox:

Spline interpolation

A new interpolate tool has been added to the toolbox under the Data section. Provide a set of x and y data and the tool will return a piecewise function to interpolate values between points. The tool also allows you to choose the order of the splines (linear, quadratic, etc) and whether to allow extrapolation outside of the data domain.

Plot Auto-Range

For function plots without pre-set y-axis limits, we've implemented a new sampling algorithm to determine appropriate limits to choose in order to produce a visually useful plot. Previously, we would simply use the maximum and minimum values for the plot, a strategy that fails when asymptotes are present in the plot. Take a look below to see how the plot of cos(x)/x appears before and after the update:

image image

Tooltip help

Looking to learn keyboard shortcuts? We've added tooltips to all toolbox tools and menubar items. Simply hover your mouse over a tool or menubar option, and after a short moment a small tooltip will appear with the text shortcut. For tools, you can type the text shortcut at the start of any math mode item to insert that tool, and menubar shortcuts can be used anywhere inside a math mode item.

Convert to PDF

The best way to transform a Swift Calcs document into a PDF is by using the 'print to PDF' feature available on many computers. Not everyone has this option, however, or it may not be available on your machine. To support conversion to PDF, we've added a Download as PDF option in the File menu. When chosen, the system will generate a PDF of the current worksheet and email it to you as an attachment.

A set of functions for finding values in vectors

Check out three new functions in the command library: closest, closestgreater, and closestlesser, which will return the closest value in a vector to the desired number.

Team Management

With the release of Swift Calcs Professional and Business, we are now offering support for teams. When you subscribe to a pro or business membership for your team, the team administrator will gain the ability to add or remove users from their team, and users on the team will have a new sharing option to share whole Projects or Worksheets with members of the team.

New Worksheet Listings and Sort by Name

We've updated our default worksheet listings. You'll now see in Swift Calcs your active worksheets by default, which includes all worksheets you have opened or edited, regardless of whether you created them. You'll also find in the Project list a section titled Created by Me that lists worksheets and Projects you created. If others have invited you to worksheets, you'll see a Shared with Me section, and teams will see Team Projects as well. These new project lists help organize your work and make finding projects and worksheets faster and easier. Finally, we've added support for sorting the worksheet listing by name, as well as the usual date, to help in finding files.

iOS external keyboard support

Do you use an iPad with the Smart Keyboard or an external bluetooth keyboard with any iOS device? There is a weird bug where Apple devices don't send non-alphanumeric key presses to the browser window (why? Because Apple). This made Swift Calcs nearly unusable on these devices. Using a workaround described here, we can discern keypresses on iOS by examining the change in a textbox when non-alphanumeric keys are pressed on iOS devices. The end result? External keyboards with iOS now work as expected, opening up a new range of devices to the Swift Calcs family.