Close
Close window
CodeGeneration Overview - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


Home : Support : Online Help : Programming : Code Generation Package : CodeGeneration Overview
[フレーム] [フレーム]

Overview of the CodeGeneration Package

Basic Functionality

Description

The CodeGeneration package is a collection of commands and subpackages that enable the translation of Maple code to other programming languages.

Output

Translated source code in the target language.

Code Generation Assistant

You can generate code using an interactive template with the Code Generation Assistant .

Accessing CodeGeneration Package Commands

Each command in the CodeGeneration package can be accessed by using the long form or the short form of the command in the command calling sequence.

Long form

>

CodeGeneration:-C([[x, 2*y], [5, z]]);

Short form

>

with(CodeGeneration);

>

C([[x, 2*y], [5, z]]);

Essential CodeGeneration Package Commands

C

translate Maple code to C code

CSharp

translate Maple code to C# code

Fortran

translate Maple code to Fortran code

Java

translate Maple code to Java code

JavaScript

translate Maple code to JavaScript code

Julia

translate Maple code to Julia code

Matlab

translate Maple code to MATLAB(R) code

Perl

translate Maple code to Perl code

Python

translate Maple code to Python code

R

translate Maple code to R code

Swift

translate Maple code to Swift code

VisualBasic

translate Maple code to VisualBasic code

Examples

>

withCodeGeneration

C,CSharp,Fortran,IntermediateCode,Java,JavaScript,Julia,LanguageDefinition,Matlab,Names,Perl,Python,R,Save,Swift,Translate,VisualBasic

(1)

Generate C code

>

Cx+y+z2xz

cg = -2 * x * z + x + y + z;

Generate MATLAB® code

>

Matlabx,2y+z,xy,z

cg0 = [x 2 * y + z; x * y z;];

Generate Visual Basic code

>

VisualBasics=1.0+x,t=lnsexpx,r=expx+xt

s = 0.10E1 + x
t = Log(s) * Exp(-x)
r = Exp(-x) + x * t

Details

For more information including:

options available to alter the translated output

extending the CodeGeneration package using the LanguageDefinition subpackage


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /