# Questions tagged [programming]

Questions on writing non-trivial programs in Mathematica. Do not use this tag for questions on plotting/graphics or for questions on doing mathematics with Mathematica, where the focus is more on the math than the program.

1,591 questions
Filter by
Sorted by
Tagged with
28 views

### Solving list manipulation exercise involving longest sequence of identical digits in a list using functional programming idiom

I have been trying to improve my list manipulation skills by doing some of the exercises in Wolfram's Intro book. I am struggling to solve this question using only functional programming constructs. ...
• 189
1 vote
77 views

### Find the feasible solutions of a minimal path set of vectors

Finding the feasible solutions for vectors representing minimum paths based on the mathematical basis: First example I need to create the constraints according to equations (1) and (2) above: ...
• 982
1 vote
126 views

### Probability of a union with probability function of vector

I want to calculate the probability of a discrete random variable. ...
• 982
52 views

### Why do notebooks by default put symbols in Global context where they can collide with all other notebooks?

This default setting can cause subtle and difficult to find problems, such as inconsistent or incorrect answers when symbols, variables or functions in different notebooks have the same name. I speak ...
• 31
234 views

### Are there contributed Mathematica programs which yield the normal form and Lyapunov coefficients of an ODE at a bifurcation point, in dimens 3 or more

Despite the very numerous times this computation (see for example normal forms and Lyapunov exponents in Guckenheimer and P. Holmes.Nonlinear Oscillations, Dynamical Systems, and Bifurcations of ...
• 1,932
300 views

### What algorithm does Mathematica's FindSequenceFunction use, and can it be replicated in Python?

I am curious about the algorithm used by Mathematica's FindSequenceFunction to identify patterns in sequences. This function is powerful in finding closed-form ...
59 views

### How to efficiently find the series of quasi-normal frequencies using FindRoot?

I want to use FindRoot reproducing the following result in the table 1 of the article "Scalar gravitational perturbations and quasinormal modes in the five-dimensional Schwarzschild black ...
• 41
49 views

### I want to add my own images to this project that traces the contour lines

i want to add my own images to this project that traces the contour lines how do i go about doing that here is the link to the project: https://demonstrations.wolfram.com/...
88 views

### How to push the performance of this compiled function

I have the function optvals solving for two variables. For the given example of variables, I need the program to run atmost in a millisecond. The main part of the ...
• 496
77 views

### Value Assignment and Checking for Subscripted Variables

I'm using a subscript as a counter in some code. Here, I give a value: Subscript[θ, 1] = 0 Without making any other assignments, I want to check if other ...
98 views

### Need help in implementing q-SeriesToq-Product in Mathematica

In Mathematica Guidebook for symbolic computations (https://www.amazon.com/dp/0387950206/wolframresearch-20), in the Exercises, 30 (c)(p. 359), there is a question: I have no clue how to implement ...
• 23
1 vote
73 views

### Sum of disjoint product of sets [closed]

If we have the following sets and we need to apply the Sum of disjoint product property to them, as in the following example: Take: $$P_1=\{x_1 x_4\}$$ $$P_2=\{x_2 x_5\}$$ $$P_3=\{x_1 x_3 x_5\}$$ <...
• 982
103 views

### Why does FindInstance require specifying variables, and how to transform a list of logical expressions into the list of its variables [duplicate]

It would be convenient to have a function VarsfromLogical which out of {a+b>c,c+d==a} outputs {a,b,c,d} Incidentally, I use ...
• 1,932
65 views

101 views

### How to write code realizing this manual operation? [closed]

I want to use the output of N[E,15]. However the output is really 2.7182818284590452353397844906664158861515. if you copy the ...
• 41
61 views

### How to post message about invalid options and return unevaluated input?

Consider this function. ...
• 959
1 vote
30 views

### Generator of limits of successions according to type of indeterminacy. Correct syntax

I am trying to make a limit generator with 3 columns, number of the exercise, the second column is the limit (perfectly written with n-->00), and the third column is the result of the limit. I have ...
• 11
194 views

### Listing all user-defined definitions used in a function call

Is it possible to obtain all user defined definitions (and attributes) that are used in the evaluation of certain command (or alternatively just their symbols which I could imagine being easier when ...
• 4,611
66 views

### Successive multiplications using Mathematica tools

Successive rotations on the unit circle Given an arbitrary starting point $z$ on the unit circle in the complex plane, the goal is to compute a cycle of rotations by $\pi$/2 with successive ...
• 1,092
96 views

### How to compute the infinite continued fraction?

I am reading the article "Eigenvalues and eigenfunctions of spin-weighted spheroidal harmonics in four and higher dimensions", which is on https://arxiv.org/abs/gr-qc/0511111. I want to ...
• 41
150 views

### Arrange solutions of equations in column form in a table

If we have the following system of equations: ...
• 982
178 views

### How to compute the continued fraction to a generic step by Mathematica?

I am reading the article "Eigenvalues and eigenfunctions of spin-weighted spheroidal harmonics in four and higher dimensions", which is on https://arxiv.org/abs/gr-qc/0511111. I want to ...
• 41
86 views

### Large Structured Programming with Compile

Is it possible or wise to build a large program structure with only Compile? With FunctionCompile it is possible to create ...
60 views

### Use table data to substitute into a function

If I have the following function Rx = Subscript[x, 1] Subscript[x, 2] + Subscript[x, 3] - Subscript[x, 1] Subscript[x, 2] Subscript[x, 3] I want to add it as a ...
• 982
1 vote
273 views

32 views

### Generate random arithmetic test with MMA

I have been trying for a long time to generate a question test where operations with 2 rationals appear printed. Can someone help me with the code? shows the following errors. a) The options appear ...
• 55
1 vote
39 views

### More generic version of Variables` [duplicate]

What's the best way to extend Variables to work on expressions that are not polynomial? IE, the following returns {x,y}, but I ...
• 7,905
102 views

### Caching result of evaluation in the notebook?

Sometimes I have a cell which takes a while to re-evaluate, but the result is quite small. It would be nice to have an easy way to "cache" some computations by embedding the result in the ...
• 7,905
123 views

### Turning expr+replacement rules into a function which automatically applies replacement rules?

What's a good pattern to turn expression+replacement rules into a function which automatically applies these replacement rules? IE, I'm finding a common pattern in my code, have some programmatically ...
• 7,905
50 views

### Nest n-times a multi-variable function with only one of the variables being updated with previous function value

I have a function y1 of three variables, x, y, and z. (y1 also depends upon f1 defined previously). I would like to Nest or interate, such that on the nth iteration, the y1's 3rd variable, z, will be ...
• 71