The tag has no usage guidance.

learn more… | top users | synonyms

48
votes
1answer
1k views

Export Code to Pseudocode?

I'm writing a paper and all my code is in Mathematica. The snippets are mostly simple, and consist of loops, maps, variables, and conditionals. I'd like add it to my paper, however, not many academic ...
28
votes
6answers
2k views

Mathematica Destructuring

Context I'm writing a function that look something like: ...
28
votes
7answers
616 views

What kinds of uses of SymbolicC (introduced in Mathematica 8) do you foresee? Are there any neat examples already?

Mathematica 8 introduced SymbolicC, a set of Mathematica functions that capture C language constructions in the familiar Mathematica tree-like fashion. Additionally, there are functions to write ...
13
votes
3answers
511 views

Generating assignments and transforming code inside Holding forms when generating code

I have been playing with slightly above trivial code manipulations in Mathematica. I thought Mathematica would be great for this kind of work because of rule replacement and expression manipulation, ...
12
votes
0answers
369 views

C Code generated from Mathematica not working?

I am a .Net developer. I'm trying to build a Visual C++ application using C code generated from Mathematica (by another person). I don't have Mathematica installed on my machine. When I try to compile ...
9
votes
2answers
191 views

How can I build an inline documentation utility?

I often have a large function to which I add inline comments, but then I can't see the forest for the trees. How can I make a tool that extracts the comments and tokens within them to generate an ...
8
votes
1answer
249 views

How do I indent C code generated by SymbolicC?

I'm continuing to experiment with the SymbolicC` package, and it's crucial to be able to inspect the generated code in order to do, well, anything useful with it. ...
8
votes
1answer
2k views

Creating a standalone (executable) from mathematica code

I have written a small mathematica code to input a ".csv" file and output the data in a specific format, in a ".txt" file. I would like to give this program as an executable to my friend as she ...
7
votes
1answer
145 views

How do I create a function pointer typedef using SymbolicC

I am just getting started with the SymbolicC package, and am trying to figure out how to handle function pointer typedefs, like, say: ...
7
votes
1answer
107 views

How to prevent SymbolicC constructs from using the semicolon (;) as the separator?

When putting several SymbolicC expressions in a list, they will usually be joined together with semicolons in the final generated code: ...
6
votes
0answers
62 views

Generating OpenCL C code [closed]

I'm trying to make an interactive complex function plotter using OpenCl. So far I can only plot functions that I hardcode into the kernel by hand. I'd like to be able to use ...
5
votes
1answer
210 views

Using mathematica to discover algorithms?

In Steven Wolfram's blog entries, he discusses using mathematica to discover algorithms. I have tried several different google searches for papers on such topics, and have found none. I suspect this ...
5
votes
0answers
178 views

Output most efficient Fortran code by mathematica

I am trying to output most efficient Fortran code by mathematica 9.0 with the method Simon provided: How can I get Mathematica to produce better Fortran code? The expressions is as follows: ...
4
votes
1answer
123 views

Generate FORTRAN77 code from Mathematica

I need to transform a function from Mathematica to Fortran77. An internal program FortranForm gives some result, but it works incorrectly in Fortran77. The string must start a 7th column and finish at ...
4
votes
1answer
243 views

Where do I get the mdefs.h file?

I want to generate some C code, and the reference here says that Mathematica comes with a mdefs.h file, but I cannot find it. Is there a place where I can download ...
4
votes
1answer
150 views

Generalization of a rule to N arguments

I am trying to apply a series expansion on a function x[t1,t2,...tn], with an expansion parameter a. For ...
4
votes
0answers
30 views

Why are Parenthesis not added to CExpression in Package SymbolicC?

The documentation of SymbolicC, more specifically of COperator, states that Parentheses are added as necessary together with the ...
3
votes
1answer
36 views

Indent SymbolicC [duplicate]

What is they shortest way to automatically indent SymbolicC at the Brackets { and }? For example: ...
3
votes
1answer
96 views

How to make N apply to exponent?

For example, I want to covert y + Sqrt[x] to y + x^0.5, where y and ...
3
votes
1answer
172 views

Mathematica Library

I created a Mathematica packagr and then I used the Needs function to add the library to my .nb file, but when use a function in my .nb file and the function is built in my library it comes up with ...
3
votes
0answers
124 views

CCodeGenerate and calling external functions

Is it possible to use CCodeGenerate to generate code which calls functions from other C libraries? For example, I would like to do something like this: ...
2
votes
2answers
185 views

How to generate a range of numbers

Is there a quick and dirty way to generate a list of numbers from 1 to some arbitrary large number in order such that the digits of each number are only 0's, 1's, and 2's? I tried doing ...
2
votes
3answers
199 views

SymbolicC Simplified Displayed

How might I display a simplified SymbolicC below. For example in the following example ...
2
votes
1answer
122 views

How can I adjust ContourPlot in Mathematica?

I have problem because of the max point and min point, when I have too high or low data point, it just make it white. Here is example of data ...
2
votes
1answer
197 views

Optimizing my code to generate symmetric tensors

I have written code that does carries out the following task: Construct a fully symmetric rank-$P$ "tensor" out of a collection of user-input rank-1 vectors, and a rank-2 symmetric tensor $h$. The ...
1
vote
2answers
79 views

Plot for pressure rise per wavelength [closed]

I have another question that i need to ask. I have been struggling in making the graphs for pressure rise per wavelenth. my equation for pressure rise per wavelength is: ...
1
vote
1answer
71 views

Variables input generation for Minimization in High dimensional space [duplicate]

I'm currently doing optimization in a high dimensional space. I was thinking of giving FindMinimum (or NMinimize not certain ...
1
vote
0answers
63 views

Get rid of external library dependency [closed]

I am trying to generate C code for some functions, which I do not post in full because they are a few hundred lines long. The functions do nothing too fancy: a bunch of dot products, powers and roots. ...
1
vote
1answer
378 views

Latest Mathematica 9.0 can't use Format.m to generate optimized Fortran code [closed]

Before updating to Mathematica 9.0, I have successfully generated beautiful Fortran code using Mark Sofroniou's Format.m package, which is posted on MathSource. ...
1
vote
0answers
251 views

matrix with IF/THEN condition

How to generate all posible matrices with some conditions on the elements? I need to make for given $n$ all $n\times n$ matrices $A=(a_{ij})$ with three conditions: I. $a_{ij}=+1$ or $0$ or $-1$. ...
0
votes
1answer
148 views

How to write this Matlab code in Mathematica

I have a small hiccup here. I am trying to write my Matlab code for a dynamical system in Mathematica. I have managed to get most of it except one part. The Mathematica code for the system is ...
0
votes
1answer
101 views

Graphing the sequence {$p_k$} = $\frac{c - a + dp_{k-1}}{b}$ [duplicate]

Graphing the sequence {$p_k$} = $\frac{c - a + dp_{k-1}}{b}$ I need to know how to graph this function where it automatically plugs in the previous term for $p_{k-1}$, the coefficients are of my ...
0
votes
0answers
48 views

Generate effective C/Java code (minimizing operations) [duplicate]

Is it possible to generate C/Java code with Mathematica so that it minimizes number of operations performed? For example, for matrix inverse or determinant? With good caching variables?