The tag has no usage guidance.

learn more… | top users | synonyms

4
votes
4answers
138 views

Automatically add debug contents to a program

Sometimes I'll use Print[1] or Print[n] to debug in a long loop, but it's really a boring job to add these sentence by sentence ...
15
votes
3answers
567 views

Generating assignments and transforming code inside held 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, ...
3
votes
1answer
80 views

Generate assignment code to symbols from string

I want the function to take in string, then assign a value to its corresponding symbol. An implementation using ToExpression is ...
3
votes
3answers
175 views

OEIS A144311 Generating function

I'm looking for a way to use calculate OEIS A144311 efficiently in Mathematica. First, let's define the series. In one sense or another, this series considers the number between "relative" twin ...
0
votes
2answers
103 views
6
votes
0answers
73 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 ...
4
votes
1answer
131 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 ...
0
votes
1answer
177 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 <...
1
vote
1answer
75 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 yet)...
4
votes
1answer
151 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 ...
5
votes
1answer
221 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 ...
1
vote
2answers
83 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: $Δp=∫_0^¹∫_0^¹(((∂p)/(∂x)))_{...
3
votes
1answer
98 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 ...
4
votes
0answers
33 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 ...
2
votes
3answers
203 views

SymbolicC Simplified Displayed

How might I display a simplified SymbolicC below. For example in the following example ...
7
votes
1answer
111 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: ...
28
votes
7answers
631 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 ...
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 ...
3
votes
1answer
39 views

Indent SymbolicC [duplicate]

What is they shortest way to automatically indent SymbolicC at the Brackets { and }? For example: ...
2
votes
1answer
128 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 ...
1
vote
0answers
65 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. ...
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 ...
12
votes
0answers
386 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 ...
5
votes
0answers
181 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: ...
1
vote
1answer
401 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. ...
2
votes
1answer
207 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 ...
3
votes
1answer
176 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 ...
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 ...
8
votes
1answer
3k 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 doesn'...
1
vote
0answers
258 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$. ...
8
votes
1answer
253 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. ...
7
votes
1answer
148 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: ...
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?
30
votes
6answers
2k views

Mathematica Destructuring

Context I'm writing a function that look something like: ...
3
votes
0answers
126 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: ...
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 ...
4
votes
1answer
248 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 ...