# Questions tagged [broken-code]

Use this tag only if you did your research and you still don't know why your syntactically correct code does not work.

114 questions
Filter by
Sorted by
Tagged with
41 views

### Why am I getting this error? Set::setraw: Cannot assign to raw object 73

Here is my code. I tried all modifications to this code but I'm not able to resolve the problem. Can anyone tell me why am I getting this error? ...
89 views

### SoftmaxLayer with one-hot vectors

The quantum physics problem I am looking at is a rotated qubit. The setup involves a y-rotated qubit measured in the z-basis (hence spin-up and spin-down). This scenario typically includes modeling ...
1 vote
89 views

### Most efficient way of defining the following sets for every step $n$

For each $n\in\mathbb{N}$, how do we compute sets $A_n$ and $B_n$ below: Let $A_1=[0,2/3)$. Let $B_1=(2/3,1]$. If $A_n$ is a union of intervals, then for each interval cut out the middle $1/2^{n+1}$ ...
64 views

### Generate all commutators and anti-commutators up to a certain order of a list of matrices

I am given a list of matrices. At first order I want to evaluate the commutators and anti-commutators of all pairs in the list and return a new list that contains two lists: one containing all ...
1 vote
36 views

### Define a function using symbolic constants [closed]

I want to calculate the derivative and find critical points of the following function: $$$\frac{(w+w_s)(w^2+w_s^2)L^2C^3}{(wR^2C+(w^2 LC-1)^2)(w_s R^2C+(w_s^2 LC-1)^2)}$$$ ...
88 views

### Alternative Representation for Energy Levels and Energy Level Density

I need to show the energy level density around the local maximum of this double-well potential. I can do it using the following: ...
251 views

### Unicode symbols not encoded properly in BarcodeImage[] in Mathematica 13.3

Trying to generate a simple QR code with ← or U+2190. I got varying results: the same in Mathematica versions 12.3 and 13.1 but very different in version 13.3. Mathematica 13.3 was updated to ...
111 views

### Integrate function differing from RUBI's Int function in version 13.3.0

I had Mathematica Version 12.3.1 Student Edition and Integrate and RUBI's Int functions produced the same answers for my purposes with good results. I updated my version to 13.3.0 Student Edition and ...
197 views

### Python Code to Mathematica for Classical Map of Kicked Top

I am trying to convert this Python code for Classical map of kicked top to Mathematica. For a single trajectory, I am able to ...
136 views

### How to get rid of 0.000 and change 5.*10^n to 3*10^n on Log Plots?

Using Version 13.1.0.0 (Edit: MacOS BigSur Version 11.6, Hardware M1 chip) In order to show some Log (or LogLog) plot features that I find annoying, here is some code: ...
197 views

### Fixing a code which covers $[-k,k]\times[-k,k]$ for a given $k\in\mathbb{N}$, with smaller rectangles of equal area?

Motivation: From this post we, initially, wanted to cover a rectangle using smaller, non-overlapping rectangles with the same area: the difference between the total area of the smaller rectangles and ...
1 vote
85 views

### Labeling point coordinates in path graph using VertexLabels

Question: How do we label point coordinates in Pathgraph using VertexLabels. Suppose we have a list of points ...
54 views

### Part specification error

I am doing a solved exercise shared here. However, while running the code, I encountered an error on page-8, under the Dynamics section. with error : I think this error is due to the absence of ...
176 views

...
62 views

### Why does the following code not change the table?

Consider the following code: ...
148 views

### How to compile sum over the compiled expression?

Consider the following toy code: ...
301 views

### Efficient generation of n-bit base-m Gray code with adjacent bit changes

How can I generate n-bit base-m Gray code in Mathematica, where only 1 bit changes at a time and all possibilities are covered? I have been hitting my head against a metaphorical wall for a few hours ...
121 views

### Why does introducing value of variable for NDSolve via function not work for this problem?

I am very confused and even restarted Kernel several times (Mathematica 13.1 Windows 10). However, I fail to understand why one evaluation of NDSolve works while a ...
1 vote
293 views

### Creating an interactive plot that zooms into the function

Suppose we want an interactive plot for the code: ...
1k views

### What's wrong with this FFT-based Von Kármán vortex street simulation?

About 9 years ago, I came across this interesting website, and found the following paragraph with a broken Mathematica code sample: When fluid passes an object, it can leave a trail of vortices ...
1 vote
28 views

### How to attach Upvalues to CompoundExpression?

I'm trying to make something like this work: Evaluating someData // Query[whatever...] /* summarizeInPrettyWay /* promptToRemoveCompoundExpression ; should produce ...
288 views

### Stability classification code for dynamic system

I'm interested in carrying out stability analysis on discrete dynamic systems, as was done in this paper. The Author used their function ...
176 views

### Adding numbers with defined precision produces incorrect result

I've tracked a bug in my code down to the problem of adding two numbers together, with the left argument having machine precision, e.g by 3` . The issue is, if ...
74 views

### How do we define the function near the end of my post?

Suppose I have two sets $F_{1,n}$ and $F_{2,n}$ written as: ...
431 views

### What is wrong with this code? (Usage of FunctionInterpolation and how to make code efficient)

I am trying to create an interpolation out of a function that comes from an improper integral. The end goal is to make a 3d plot over a specific region. Specifically, I have the following code: ...
39 views

### Problem with ToExpression and TexForm changing two variables multiplied together into one multi-lettered variable

I have a problem where if I multiply two variables a c in Mathematica, then copy as LaTeX (or just use the Mathematica output) to get a c, then put it in ToExpression["a c",TeXForm], I get ...
1 vote
115 views

### How do we find the limit of my code?

Suppose we have the following: ...
1 vote
118 views

### How to fix Mathematica crashing in the following case?

I have a problem with Mathematica when trying to glue two tables together. The tables have the form ...
1 vote
119 views

### Outputting probability of rolling 6 dice N times, generating a new output each roll

I am looking to output the probability of n classic six-sided dice but I am not sure how to go about starting. This is what I have written out so far, but no way to go about accounting for n dice for ...
1 vote
51 views

### Possible bug: Wrong differentiation of ParametricFunction inside Parallelize?

In the note RootSearch problem when called from within ParallelDo I described the problem with Ted Ersek's RootSearch package and came to the conclusion that it is ...
1 vote
145 views

### RootSearch problem when called from within ParallelDo

I have been using Ted Ersek's RootSearch package for Wolfram Mathematica for many years. The package worked great, including inside the ...
560 views

### Euler-method implementation

How can I implement this pseudocode in Mathematica? Algorithm: ...