If you want to learn how to write this API, see Developers > Example: Grid Of Plots. It is important to leave this, should there be any changes to the parameters. Underneath the plots is a group of cells, containing the formula array for calling the Wolfram API. The result is a plot in a floating window above the spreadsheet. This formula contains the name of the Wolfram API and references to the parameters the API requires. =WolframAPI("/Documentation/Example/GridOfPlots", Parameter("values", C9:C24)) The following is the formula used in the Excel worksheet: The worksheet contains a reference to the Excel function that calls the cloud, WolframAPI (located at E8). This example takes a vector of numbers and generates a matrix of plots.Īltering one of the parameter values will trigger a recalculation, calling the Wolfram Cloud. If you want to learn how to write this API, see Developers > Example: Plot Numbers. If you want to learn more about the Excel functions, see the Calling Wolfram APIs section. If this fails to execute correctly, please see the Troubleshooting section. Underneath the plot is the cell containing the formula for calling the Wolfram API. =WolframAPI("/Documentation/Example/PlotNumbers", Parameter("data", C9:C17)) The worksheet contains a formula with the Excel function, WolframAPI, which calls the Wolfram Cloud. Load the example spreadsheet and go to the Basic worksheet.Īltering one of the parameter values will trigger a recalculation, calling the Wolfram Cloud. It calls a Wolfram API with two parameters and adds them together. This example shows the basics of how to call a Wolfram API from Excel. Wolframalpha api download#To download the example spreadsheet, go to the CloudConnector for Excel resources webpage. This section is for Excel users and shows how to run through the example spreadsheet, which contains Excel functions that call Wolfram APIs. If you have not installed the CloudConnector for Excel, please see the Setup and Getting Started section for more details on the installation process. It uses pre-deployed Wolfram APIs to show how a Wolfram Cloud can be called from Excel. For example, if we’re working with currency units, then we might want to trim all but the last two decimal places: > x = get_plaintext_query('\pi')ģ.1415926535897932384626433832795028841971693993751058.Īlternatively, I remember in school being told to round to a particular number of significant figures.This section is designed for Excel users and developers of Wolfram APIs. If we have the plaintext number in a script, then we can also do some nice formatting. There may be other forms of input for which this is useful, but I couldn’t think of them when I wrote this. Right now it evaluates raw expressions, such as \frac, and definite integrals, such as \int_0^5 x^2 dx. It takes a few seconds to run, but it’s still faster than opening a web page and doing the copy/paste yourself. Drang’s script, and then ElementTree handles the XML decoding. The URL encoding is handled by quote_plus, taken from Dr. You’ll need to add your own App ID in line 8. split ( '~~' ) else : return result if _name_ = '_main_' : from sys import stdin print get_plaintext_query ( stdin. get ( 'title', '' ) = 'Definite integral' : return result. encode ( 'utf8' )) for pod in root : if pod. get ( '' % ( quote_plus ( latex ), appid )) root = ET. Import requests from urllib import quote_plus import as ET appid = 'XXXXXX-YYYYYYYYYY' def get_plaintext_query ( latex ): r = requests. Then you can register an API key, and make queries in the form If you don’t already have a (free) Wolfram ID, then signing up for one takes about a minute. I think I can use this to get the final piece. It’s much easier to use the Wolfram Alpha Developer API, which provides this very easily. I tried to parse the Wolfram Alpha page structure in the past, and it was a bit of a mess. Wolfram’s page structure doesn’t make that easy, but it’s something I want to explore. What I’d really like is to automate the copying and pasting of the answer. Drang’s script gets the L aT eX equation out of BBEdit and loads Wolfram Alpha, but you still need to click the “Copyable plaintext” link. Building on a post by Eddie Smith which shows how to use WolframAlpha to evaluate a L aT eX expression for a numerical answer, he shows off a way to automate getting the equation from BBEdit, to save a tedious copy/paste step. Although I don’t write numerical equations very often, I couldn’t help but smile at this post by Dr.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |