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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
106 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 ...
Tom00496's user avatar
2 votes
1 answer
179 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 ...
user84456's user avatar
  • 1,554
0 votes
1 answer
192 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 ...
Arbuja's user avatar
  • 39
1 vote
3 answers
78 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 ...
Arbuja's user avatar
  • 39
0 votes
0 answers
52 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 ...
user84456's user avatar
  • 1,554
3 votes
2 answers
166 views

Colouring stacked 2D in 3D

...
user84456's user avatar
  • 1,554
0 votes
1 answer
60 views

Why does the following code not change the table?

Consider the following code: ...
John Taylor's user avatar
  • 4,652
0 votes
1 answer
273 views

Why are the results of these codes different?

I apologize for the very long question with a relatively complicated code. I am dealing with a real problem, and the question below appeared from my attempt to simplify this problem to ask about it ...
John Taylor's user avatar
  • 4,652
4 votes
4 answers
272 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 ...
More Senne's user avatar
3 votes
2 answers
120 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 ...
Ali Hashmi's user avatar
  • 8,900
1 vote
3 answers
269 views

Creating an interactive plot that zooms into the function

Suppose we want an interactive plot for the code: ...
Arbuja's user avatar
  • 39
20 votes
4 answers
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 ...
xzczd's user avatar
  • 63.8k
4 votes
1 answer
123 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: ...
Carl's user avatar
  • 695
1 vote
0 answers
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 ...
joka's user avatar
  • 322
2 votes
1 answer
223 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 ...
zeraoulia rafik's user avatar
4 votes
2 answers
164 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 ...
shanedrum's user avatar
  • 557
0 votes
0 answers
72 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: ...
Arbuja's user avatar
  • 39
0 votes
0 answers
38 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 ...
Tom00496's user avatar
5 votes
1 answer
133 views

How to compile sum over the compiled expression?

Consider the following toy code: ...
John Taylor's user avatar
  • 4,652
1 vote
1 answer
108 views

How do we find the limit of my code?

Suppose we have the following: ...
Arbuja's user avatar
  • 39
1 vote
0 answers
105 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 ...
John Taylor's user avatar
  • 4,652
1 vote
1 answer
106 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 ...
Brandon Evans's user avatar
1 vote
0 answers
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 ...
Igor Kotelnikov's user avatar
1 vote
0 answers
139 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 ...
Igor Kotelnikov's user avatar
4 votes
2 answers
517 views

Euler-method implementation

How can I implement this pseudocode in Mathematica? Algorithm: ...
Birgitt's user avatar
  • 167
0 votes
0 answers
52 views

If definition of elements in table

I need to define a table where the definition of the elements differs if the indices $i$ and $j$ are equal or different. In particular I have to implement the following formula $$(K_1^{(1)}(m_1,m_2))_{...
Davide Morgante's user avatar
-1 votes
1 answer
87 views

Costly function inside nested Modules [closed]

The function initDataTable simply reset all data to Black first, then set the bottom right quarter to ...
Chris Guo's user avatar
  • 149
0 votes
0 answers
90 views

Reduce method not working for system of equations

I have the following code which sets up a Reduce function call: ...
Blitzkrieg555's user avatar
0 votes
1 answer
74 views

Deleting all elements in a list where the output of elements from a function is zero

I tried using DeleteCases to delete elements in r1 where g2==0 to get a defined arithmetic ...
Arbuja's user avatar
  • 39
0 votes
1 answer
56 views

Code Producing Power::Infty

I tried computing the following ...
Arbuja's user avatar
  • 39
2 votes
1 answer
126 views

Python to Mathematica code bug

I have an assignment in Mathematica, which I've already solved using Python and it's a bit hard to convert the code. Here's what I have done so far: ...
mandella's user avatar
  • 133
0 votes
0 answers
47 views

How to create 2-D or 3-D curves to simulate something like the SIR model

I don’t know what is wrong with my code. I am trying to create 2-D or 3-D curves to simulate something like the SIR model, but with tumor growth instead. It is a proliferation-invasion/ reaction-...
user79647's user avatar
2 votes
0 answers
46 views

ParallelTry Hangs on previously working code

When I run the below ParallelTry command, it just sits on it and says its being evaluated, but I cant abort it, it doesn't return what I am expecting, and I have to ...
shanedrum's user avatar
  • 557
1 vote
0 answers
43 views

Errors in loading IGraphM [closed]

I have been using IGraphM without any problem until today. My Codes using IGraphM started to ...
Tugrul Temel's user avatar
  • 5,490
1 vote
0 answers
84 views

What is wrong with my code for implementing PSOR (Projected Successive Over Relaxation)? [closed]

I have written the numerical scheme of PSOR (Projected Successive Over Relaxation) method of a obstacle program in 1D, which is as follows: \begin{align*} &u_0=u_N=0\\ &u_i^{k+\frac{...
Alice's user avatar
  • 11
-3 votes
1 answer
88 views

Having trouble coding my own QR decomposition using Gram Schmidt [closed]

I have this code for Gram Schmidt: ...
John hall's user avatar
1 vote
2 answers
239 views

QR decomposition using Gram Schmidt [closed]

First of all I don't want to use the reflection method, only Gram-Schmidt. So here's the program for Gram-Schmidt: ...
John Hall's user avatar
1 vote
1 answer
71 views

Help Calculating My "Deviation"

I created a "distribution deviation" where for $\left\{a_1,...,a_k\right\}$ we take all take the mean of all combinations of $\frac{\min\left\{a_{i},a_{j}\right\}}{\max\left\{a_{i},a_j\right\...
Arbuja's user avatar
  • 39
0 votes
0 answers
97 views

Error in Monte Carlo simulation. Now Random walk (dotted curve) doesn't fit to the analytical curve (dashed curve)

I've been trying to code a kinetic monte carlo simulation for a system of consecutive chemical reactions using a fixed (repaired) code that the user flinty gives me in the last questions I post: ...
Nebula's user avatar
  • 13
1 vote
1 answer
91 views

Strange error not found in a monte carlo code, Infinite expression 1/0 encountered

I've been trying to code a kinetic monte carlo simulation for a dimerization reaction, 2M ---> D. However I have a kinetic Monte Carlo code for a first order decomposition reaction of AIBN (that's ...
Nebula's user avatar
  • 13
-1 votes
1 answer
44 views

Using coding to calculate my average for functions defined on countable sets?

Suppose we have a function $f:A\to\mathbb{R}$ where $A\subseteq[a,b]$, $a,b\in\mathbb{R}$ and $S\subseteq A$. Now suppose $f$ is $$f(x)=\begin{cases} x^2+1 & x\in S_1\\ x & x\in S_2\\ \end{...
Arbuja's user avatar
  • 39
1 vote
1 answer
116 views

How to partition $[a,b]$ into $m$ equal sub-intervals and count the number of sub-intervals that intersect with a subset of $[a,b]$?

Suppose we have a subset of $[a,b]$, where $a=0$ and $b=1$, such as $$A_1=\left\{\frac{1}{2^x}+\frac{1}{2^y}+\frac{1}{2^z}:x,y,z\in\mathbb{Z}\right\}\cap[0,1]$$ Which is a subset of $[0,1]$ If we ...
Arbuja's user avatar
  • 39
2 votes
1 answer
121 views

How to partition $[0,1]$ into $m$ equal sub-intervals and count the number of sub-intervals that intersect with my cantor set?

Suppose I define my cantor set as ...
Arbuja's user avatar
  • 39
1 vote
1 answer
75 views

ParametricPlot on Piecewise function not working with consecutive t values [closed]

I am trying to graph a piecewise function composed of a series of parametric cubic functions. I initially created a ParametricPlot for the first four pieces of the equation and it was working fine, as ...
Mark's user avatar
  • 33
0 votes
2 answers
85 views

Unable to find the exact dimension of an expression

I have defined a variable called y, this contains a huge equation, but when I look for the dimension of y it shows 3. How come a single expression has dimensions of 3? It is supposed to be 1 right? <...
acoustics's user avatar
  • 1,699
0 votes
0 answers
313 views

Fourier Transform and Inverse Fourier Transform of Lists

I am trying to compute the Fourier transform of a list, say an array of the form {{t1, y[t1]},.....{tn, y[tn]}}; apply some filters in the spectral components, and then back transform in time domain. ...
Matteo S's user avatar
  • 153
2 votes
1 answer
51 views

User Implemented SHA-1 is failing for strings of length >512 bits

So, earlier, I posed a question regarding getting a user implemented SHA-1 hash function to work correctly. Well, I fixed the problems, cleaned it up a little bit, but now I have the problem for when ...
Shinaolord's user avatar
1 vote
1 answer
251 views

Q: How to manage notebook crashes, "In a previous session", and memory consumption?

I worked in a notebook. Something went wrong. I do not know what or why. The notebook did not react anymore and closed. After it, I try to open the same notebook. Then the next text appears: "The ...
Michiel van Mens's user avatar
0 votes
1 answer
976 views

I can't solve system of differential equations with Dsolve

Here is the code and the system, and it is supposedly analytically solvable. $$\frac{dx(t)}{dt} = i(\frac{3w}{2}x + ke^{2iwt}y)$$ $$\frac{dy(t)}{dt} = i(kxe^{-2iwt} +\frac{3w}{2}y)$$ and my code ...
The Bosco's user avatar
  • 101
0 votes
1 answer
142 views

Help with debugging my code [closed]

In order to descrive the multifractal behaviour of a set, Baumann provides a code based on the functions Dq and Tau, given below. ...
Spook82's user avatar
  • 95