# Questions tagged [code-review]

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.

304 questions
Filter by
Sorted by
Tagged with
614 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, ...
821 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 ...
269 views

### When computation takes a long time, how to find out if this is normal or if my script contains an error?

I study mechanical engineering and I' working on my first bigger project on Mathematica right now. It's a multibody problem that leads to a system of 4 large equations I'm supposed to solve ...
26 views

### Improvement of a method to plot values of a section of a line that moves with time

I have this code which animates a layer of fluid moving on the outside of an ellipse with a moving black point on the cylinder surface itself. I want to plot a line from the origin to the outer layer ...
98 views

### How can I map edgeweights from a matrix onto edges along the paths generated by another matrix

Suppose that we have two matrices with identical dimensions: matA and matB. I want to identify a set of pathways using ...
54 views

### help with improving my code

I am fairly new to MMA-12 and have written the following code to calculate possible coordinates (for given constraints [see If[]] in the code) and get the ...
485 views

### Is this a bug or my mistake?

This: Graph[{1 \[DirectedEdge] 2, 2 \[DirectedEdge] 3, 4 \[DirectedEdge] 1}] AdjacencyMatrix[%] // MatrixForm generates: But, this ...
68 views

### How to automize Shannon's Entropy calculation using a MM function

With the following code, I calculate Shannon's Entropy function HH1 for a given matrix mat. ...
63 views

### How can I index a function with the type of dataset used

I have the following code which serves my purpose for a single matrix input. For one or two matrices, the operation can be done manually, but I have 65 matrices and ...
43 views

### How can I use DeleteMissing[] to delete “complicated rules” from a matrix

The following works as intended: ...
76 views

### Solving an equation in integers giving an errormessage

I've the following code: ...
328 views

### Brute Force for solving Diophantine equation

I'm trying to solve the following Diophantine equation using Mathematica: $$2^x=5^y+3$$ I have a code,but is very slow. Can we speed up ? ...
59 views

### How can I plot a 2D LayeredGraph on a 3D plane with a MMA function

In my previous question, I wanted to plot a 2-dimensional MMA LayeredGraph[...] on a 3-dimensional surface (or plane), and @KGLR answered the question in the ...
132 views

### Compute moments, variance, skewness, mean from the PDF of a non standard distribution

I have tried to compute Skewness and variance and moment using the code below, I have tried first to create a distribution from my PDF using the command ...
63 views

69 views

### Mathematica only graphs the upper part of my cylinder

I have this code which first is supposed to make random points, draw lines through the points and then make these lines radical axes of cylinders. I have two problems with my code. First, it only ...
1k views

### Converting Matlab code to Mathematica [closed]

I have following Matlab code: ...
151 views

### Can someone please explain the code from another question

Source: Position of a pattern-matched part of an expression Can someone please explain the following code by Leonid Shifrin. ...
117 views

### Dealing with stiffness in solving Mukhanov-Sasaki equation

The code that I wrote is rather long, but I have included the whole code. ...
61 views

### I have a working code, but work very slowly. want to improve the code

I have working code which gives the result as expected by me. But the problem is it is taking too much of time to give me those results. I have a determinant function which depends on z1,z2,z3, kt,m, ...
27 views

### Relative Chop for Fractions with Trigonometric Terms

I have a fraction, which contains long sums of various terms that might include trigonometric functions in both the numerator and denominator. I want to get rid of the negligible terms. This is my ...
195 views

### Animated Lissajous Curves Parametric Plot

I love mathematical GIFs' power to illustrate and communicate math concepts widely. I haven't had much luck with the build-in ListAnimate on MMA Online but ...