SDKs overview

xMath, powered by the Wolfram Language, offers a comprehensive suite of tools for computational tasks including symbolic mathematics, numerical analysis, data science, and visualization. The primary method for programmatic interaction is through the Wolfram Language Reference itself, which functions as both a programming language and a knowledge base. Beyond direct Wolfram Language usage, official SDKs and connectors enable integration with external programming environments, allowing developers to call Wolfram Language functions from languages like Python, Java, .NET, and R.

These SDKs are designed to provide a bridge between the extensive capabilities of the Wolfram Language kernel and other application development workflows. They allow developers to send Wolfram Language code for evaluation, retrieve results in native data formats, and manage Wolfram Language sessions within their chosen programming environments. This approach supports a hybrid development model where computationally intensive tasks or those requiring xMath's unique symbolic processing can be offloaded to a Wolfram Engine instance, while the surrounding application logic is handled by the host language.

The architecture typically involves a client library in the host language that communicates with a Wolfram Engine process, either locally or remotely. This setup ensures that developers can leverage the full power of xMath without needing to rewrite entire applications in the Wolfram Language. Furthermore, the ecosystem includes tools for deploying Wolfram Language code as APIs, facilitating server-side integration and microservices architectures.

Official SDKs by language

xMath provides official SDKs and connectors that allow developers to interface with the Wolfram Language from various programming environments. These tools are maintained by Wolfram Research and ensure stable, feature-rich integration. The core component for these integrations is often the Wolfram Engine, which executes the Wolfram Language code. Developers can connect to either a local Wolfram Engine installation or a remote one, such as a Wolfram Cloud instance.

Language Package/Connector Install Command (Example) Maturity
Python WolframClientForPython pip install wolframclient Stable
Java Wolfram Language for Java Add dependency to pom.xml or build.gradle Stable
.NET (C#) Wolfram Language for .NET Install via NuGet Package Manager Stable
R Wolfram Language for R install.packages("WolframLanguageR") Stable
Node.js Wolfram Language for Node.js npm install wolfram-language-server Stable

Each of these connectors provides specific APIs for establishing a connection to a Wolfram Engine, evaluating Wolfram Language expressions, and handling the results. The Python client, for instance, allows for seamless data exchange between Python objects and Wolfram Language expressions, leveraging Python's data science ecosystem alongside xMath's computational power. For detailed instructions and API references, consult the Wolfram Language documentation portal.

Installation

Installing xMath's SDKs typically involves two main steps: ensuring you have access to a Wolfram Engine, and then installing the language-specific client library. The Wolfram Engine can be a desktop installation of Mathematica, a standalone Wolfram Engine, or a connection to the Wolfram Cloud.

Wolfram Engine Setup

  1. Install Mathematica or Wolfram Engine: For local development, download and install Mathematica or the standalone Wolfram Engine from the Wolfram website. Ensure the installation path is accessible and correctly configured in your system's PATH environment variable if you plan to use it from the command line.
  2. Wolfram Cloud Access: Alternatively, you can utilize the Wolfram Cloud for remote execution. This requires a Wolfram ID and appropriate cloud credits or a subscription. The client libraries will then connect to the cloud API endpoints.

Language-Specific Client Installation

Python

The Wolfram Client Library for Python is distributed via PyPI. Open your terminal or command prompt and run:

pip install wolframclient

For more advanced usage, including connecting to a specific local kernel or cloud endpoint, refer to the Wolfram Client for Python documentation.

Java

For Java projects, you typically add the Wolfram Language for Java library as a dependency using a build tool like Maven or Gradle. For Maven, add the following to your pom.xml:

<dependencies>
    <dependency>
        <groupId>com.wolfram</groupId>
        <artifactId>wolframclient</artifactId>
        <version>1.0.0</version> <!-- Replace with the latest version -->
    </dependency>
</dependencies>

Consult the Wolfram Language for Java guide for the most current version and setup details.

.NET (C#)

For .NET applications, the Wolfram Language for .NET library is available via NuGet. In Visual Studio, use the NuGet Package Manager Console:

Install-Package WolframLanguage.NET

Alternatively, search for "WolframLanguage.NET" in the NuGet Package Manager UI. The Wolfram Language for .NET documentation provides comprehensive examples.

R

The Wolfram Language for R package can be installed directly from CRAN (Comprehensive R Archive Network) within your R environment:

install.packages("WolframLanguageR")

Further configuration and usage examples are available in the Wolfram Language for R package documentation.

Quickstart example

This Python quickstart demonstrates how to connect to a Wolfram Engine, evaluate a simple Wolfram Language expression, and print the result. This example assumes you have the Wolfram Client for Python installed and a Wolfram Engine (either local or cloud) available.

from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl

# Establish a session with the Wolfram Engine.
# By default, it tries to find a local Wolfram Engine installation.
# For cloud connection, you would pass a 'cloud' argument with your credentials.
with WolframLanguageSession() as session:
    # Evaluate a Wolfram Language expression.
    # wl.FactorInteger is equivalent to FactorInteger[] in Wolfram Language.
    result = session.evaluate(wl.FactorInteger(123456789))

    # Print the result. The client automatically converts Wolfram Language
    # expressions to Python native types where possible.
    print(f"Factorization of 123456789: {result}")

    # Perform another calculation: symbolic differentiation
    derivative_result = session.evaluate(wl.D(wl.Power(wl.x, 3) + wl.Sin(wl.x), wl.x))
    print(f"Derivative of x^3 + Sin[x] with respect to x: {derivative_result}")

    # Evaluate an expression involving external data (e.g., current date)
    current_date = session.evaluate(wl.DateString())
    print(f"Current date from Wolfram Engine: {current_date}")

print("Session closed.")

This script first imports necessary classes from wolframclient. It then establishes a session using WolframLanguageSession(). Inside the with block, session.evaluate() sends Wolfram Language code (constructed using wl for convenience) to the engine. The results are returned and printed. The with statement ensures the session is properly closed even if errors occur. This pattern is foundational for integrating xMath's computational power into Python applications, enabling tasks from advanced mathematical operations to data analysis and visualization through Wolfram Language functions.

Community libraries

While Wolfram Research provides robust official SDKs, the broader developer community has also contributed libraries and tools that extend xMath's reach and integrate it into specialized workflows. These community-driven efforts often fill niches not covered by official offerings or provide alternative interfaces for specific use cases.

Notable Community Contributions:

  • Jupyter Kernel for Wolfram Language: This community-developed kernel allows developers to use the Wolfram Language directly within Jupyter Notebooks. This is particularly valuable for data scientists and researchers who prefer the interactive, cell-based environment of Jupyter for exploration, visualization, and documentation. It integrates Wolfram Language's symbolic and numerical capabilities alongside other data science tools in the Jupyter ecosystem.
  • Wolfram Language Server Protocol (WLSP) Integrations: Various community projects aim to provide enhanced IDE support for the Wolfram Language using the Language Server Protocol (LSP). These integrations offer features like syntax highlighting, code completion, and diagnostics in popular code editors such as VS Code, Atom, and Sublime Text, improving the developer experience for writing Wolfram Language code outside of Mathematica's native environment.
  • Specific Data Connectors and Wrappers: Developers have created custom connectors for niche databases or data formats, and wrappers for specific third-party APIs that might not have direct Wolfram Language support. These often appear as open-source projects on platforms like GitHub, enabling more flexible data ingress and egress for Wolfram Language applications.
  • Educational Resources and Examples: Beyond code, the community actively contributes to educational materials, tutorials, and example notebooks that demonstrate how to use xMath's capabilities in conjunction with other languages and tools. These resources are invaluable for new users and for exploring advanced techniques.

It is important to note that community libraries may have varying levels of maintenance and support compared to official SDKs. Developers should review the project's activity and documentation before integrating them into production systems. For the most up-to-date information on community efforts and to potentially contribute, explore forums and repositories linked from the Wolfram Community pages.