Tagged Questions

This tag is intended for the review and improvement of style for already functioning code. It not meant to change the objective of the code.

126 views

Multiple object detection and tracking in images

The code below: reads in a number of png images, where the background is dark and objects of interest (here 3) are bright dots determines in each image the coordinates and other information ...
73 views

Using solve on conditional functions

I know that the code is pretty long, but most of it is just defintion. Do you see why the Solve gives me "his system cannot be solved with the methods available to Solve" back? ...
263 views

How to check the validity of an option value

I have a user-defined function, func, which takes the following form: func[arg1, arg2, options] Here is the actual code ...
122 views

What is wrong with my code so it neither produces a correct plot nor an error message?

I am trying to define some initial functions and then using them to define my secondary functions and then plot the secondary functions. I am supposed to get two curves with a finite width ...
242 views

Enneper's minimal surface

How to plot the Enneper's minimal surface like this I tried: ...
551 views

Mathematica Implementation of Householderâ€™s Method

I typed the Householder code in this paper, which starts on page 7. The code is: ...
185 views

How to construct the RHS of Wick's theorem

I've been trying this for a few days now, but I just can't seem to find an efficient (speed-wise) functional way to code the following task. Context: I would like to construct an expressions that is ...
166 views

Passing function as argument

I've been mucking around with passing functions as arguments to other functions and via trial and error seem to have something that works. I was wondering if someone could have a quick look at some ...
44 views

Exporting in .dat format [closed]

I am new to Mathematica. I am trying to write the data of the plot of some function which I am using in a .dat format. I am using the following commands to do so: ...
90 views

NDSolve for a system of nonlinear coupled pde

I try to solve a system($n$) of coupled nonlinear 1-d PDE's which is basically coupled sine-Gordon equations (through 2nd spatial derivative) in time and space. I am interested in the dynamics when I ...
748 views

What's the most “functional” way to do Cholesky decomposition?

I can do Cholesky in a procedural style, such as: ...
1k views

This is a rather specific question and I apologize for spamming you with some lengthy code. But it could be interesting for some reader and maybe you can help out, so please bear with me. I am using ...
142 views

How can I do a two dimensional Fold? [closed]

I'd like to Fold over higher dimensional objects than lists. Semantically, the format would be something like ...
37 views

wrong result of an iteration related to replacement and comparing

We have two nested matrix and a code for replacement following an equality as: ...
193 views

How to combine Tabview with Dynamic Graphic to change the colour of a polygon

How does one get TabView to specify the colour of the Polygon? How does one put a label on ...
46 views

FilterOptions Errors with Riemann Sum Notebook on Math World

I am trying to run the notebook for a maximum (upper) integration calculation (hopefully, symbolically). I am using the notebook available at Wolfram Math World (upper left of web page). When I ...
91 views

Partial comparison between lists contained in larger matrices [closed]

Please presume we have two nested matrices m1 and m2: ...
172 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 <...
71 views

sorting eigenvectors of a final combined matrix

I have two matrices m1 and m2 as below: ...
122 views

how to generate repeatable Unique streams?

I need to label some data in arbitrarily nested ragged lists, with a stream of unique labels. It's very convenient if the labels are consecutive integers, starting at ...
61 views

...
94 views

Maxima turn out to be false maxima when extremising function locally

In short: I have a 2-D function that gives this plot, where the orange dots are maxima: There are 4 maxima in this plot. Now, I plot the function again in a smaller region, close to these maxima, ...
145 views

Tips to write more readable code [closed]

What are some tips to write a more readable code? For example in C, tab is your friend. You can also declare variables in a way such that you can read the code easily later on. In Mathematica, if ...
252 views

Finding large Collatz Sequences, trying to improve speed

Background: I am already very much in love with Mathematica but I am also a novice. So far I have only gathered experience in procedural programming in Python. Generally speaking I am trying to ...
395 views

Clever use of DownValues, or failure to understand the “Mathematica Way.”

I needed to look at the changes in the values of about 4000 items from one year to the next. I have a table with identifiers and values for each year. Not all of the items are in each list. The ...
161 views

The equivalent of dplyr mutate with Dataset

In R, there is a package "dplyr" that works on data.frame objects, which is one of the origins of the Mathematica Dataset construct. One of the things dplyr can do is "mutate" the columns of a data....
169 views

Solving problem using recursive functions

Attached below is a question posed by the Canadian Mathematical Society, and I have my code and answer. Is there a better way of writing the code, and will the answer be different as a result? My ...
124 views

Understanding simple code [closed]

Can anyone help me with how to understand the definition of the ExpandNCM function listed in the NonCommutativeMultiply ...
99 views

How to define UpValues of NBSpline when the length of argument is unknown?

I mimic the built-in BSplineBasis[] to build a user-defined function NBSpline[], Namely, ...
244 views

Extract what symbol is set by SetDelayed, Set, TagSet, UpSet, SetAttributes, etc

One of the recent features of the Mathematica Plugin for IntelliJ IDEA (www.mathematicaplugin.halirutan.de) is a Structure View which let's you see information about several definitions that are done ...
146 views

Better way to compute triple (or higher order) convolution

I have an identity that I want to verify: \sum_{i+j+k\ge 2}\binom{n}{i,j,k}{B_{N,i}B_{N,j}B_{N,k}}=\left(\frac{2N^2+n^2-3nN}{2N^2}\right)B_{N,n}+\left(\frac{3n^2-2n-4nN}{2N^2}\right)B_{N,n-1}+\...
841 views

converting Matlab program to Mathematica code

I have the following Matlab program; ...
144 views

Plot of The RiemannSiegelZ Function

I would appreciate your help to visualize the of the following function RiemannSiegelZ[x] with this range. { 18154980120849865 , 18154980120849885 } I tried this: ...
96 views

Eigenvalues and Eigenvectors Order [duplicate]

Say I have a list of eigenvalues and eigenvectors produced from a matrix $M$ using the command {eig1,eig2}=Eigensystem[M], which will return the eigenvalues with ...
37 views

Variable Definitions and Random Numbers [closed]

I have currently created the following matrix: m={{RandomReal[{0,1}],RandomReal[{0,1}]},{RandomReal[{0,1}],RandomReal[{0,1}]}} In other words, a $2 \times 2$ ...
52 views

Saving Dot-ed eigenvectors in a special comparison

We have produced a 4*4 matrix in any iteration containing nx from 0 to 2 by steps of 0.5. and in any iteration we have saved sorted orthogonalized-eigenvectors based on their eigenvalues with this ...
52 views

Reducing quantile & color map queries for use with Associations

This set of queries perform basic maps to quantile and then color-map. There's got to be a more compact solution. What are some approaches to reduction? Numeric: ...
94 views

Memory Management for Large Datasets [closed]

I've written some Mathematica code to generate polynomial roots. The code take an argument n as the highest degree of polynomial to solve for and then exports a file containing a list of the roots: <...
312 views

Runge-Kutta-2 on System

After spending some time using the Mathematica documentation and this Mathematica.SE answer, I implemented the Runge-Kutta-2 routines. I am hoping someone can validate what I did and tell me that it ...
66 views

Sort and Save Matrices Eigenvectors to a Larger Matrix

We are going to sort and save all orthoginalized-eigenvectors of 4*4 random matrices (produced in any iteration) to a larger matrix such as storagematrix. Since, produced random matrices are 4*4, ...
2k views

May the Fourth be with you

Happy Star Wars day. I was playing around with the image manipulation functions in Mathematica in an attempt to recreate the Star Wars crawl. There's an HTML/CSS implementation which is in my ...
121 views

Composition vs serial assignment, which performs better?

I have a giant block of code that manipulations an expression in many different ways. Currently it looks like ...
271 views

Having trouble translating Matlab fsolve into Mathematica

I searched the site and found that someone said FindRoot is equivalent to fsolve, however, without proper options, ...
159 views

How to deal with the condition that a function own many options?

Assming that I have a function myFunc which has some options. ...
79 views

Inverse Superposition

There are 4 tables that, I have written them as bellow: (m, n, s, and r are orthogonal basis. r.r=n.n=m.m=s.s=1, and m.n=n.r=...=0). a's, b's, c's and d's are coefficients and are numeric values. <...
232 views

Some Problem with WhenEvent! [closed]

Anyone knows what's the problem with the following code and how can I fix it? I am not sure that I wrote the WhenEvent section correctly. By the way, I want to solve the equations and then plot y vs. ...
59 views

extraction new generated vectors in module with replaced parts

We have four vectors: ...
726 views

Button evaluation inside DynamicModule

Someone know why this Button works when clicked: ...