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
1 vote
2 answers
233 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
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.4k
10 votes
2 answers
1k views

What is the Difference Between Rule (->) and RuleDelayed (:>)?

I am new to Mathematica so this question may seem rudimentary. Sorry for that! :) I want to implement the well-known property of Kronecker's Delta $$\Sigma_{i=1}^{n} a_i \delta_{ij}=a_j,\quad 1 \le ...
Hosein Rahnama's user avatar
10 votes
2 answers
5k views

How to set up a simple Monte Carlo simulation?

there is a 1% chance that there will be a scattering event, if there is a scattering event the direction of scattering will be determined by a random sample of the custom[a_] function and if there is ...
AW1991's user avatar
  • 153
7 votes
1 answer
425 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: ...
AG1123's user avatar
  • 561
3 votes
2 answers
744 views

EdgeRenderingFunction question

Bug introduced in 9.0 and fixed in 10.0.0 (Edit 1 : I added this paragraph after the original post, for context) Some context for this question can be found in another post (https://mathematica....
pdini's user avatar
  • 475
1 vote
2 answers
824 views

Michaelis–Menten kinetics using Gillespie Algorithm

I am trying to implement Michaelis–Menten kinetics using Gillespie Algorithm. $$\text{Reaction 1:}\quad E+S\rightarrow C$$ $$\text{Reaction 2:}\quad C\rightarrow E+S$$ $$\text{Reaction 1:}\quad C\...
OkkesDulgerci's user avatar
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,642
4 votes
1 answer
894 views

Issue in ParallelTable after evaluating another function using NDSolve and FindRoot. What is wrong with this inverse?

I am trying to find the inverse of a function which is defined through NDSolve and NIntegrate. The question is pretty similar ...
Santiago's user avatar
  • 1,201
4 votes
1 answer
366 views

Why Min cannot be used as constrains of NMinimize?

I met a strange problem when trying to do an optimization. Initialization code, ...
saturasl's user avatar
  • 1,429
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
2 votes
5 answers
2k views

Where did I go wrong with my implementation of finding a plane tangent to a surface?

I am working on finding the plane tangent to a paraboloid at a given point. My code: ...
xyz's user avatar
  • 595
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
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
1 vote
0 answers
104 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,642
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
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
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
0 votes
1 answer
97 views

Do-loop with ParametricNDSolveValue not giving expected results

I have written code that using a Do-loop. In the loop I am changing the value of x, v, l and R, and looking at the computed ...
aluuzz's user avatar
  • 57