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.

0
votes
0answers
40 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. ...
2
votes
1answer
37 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 ...
0
votes
1answer
85 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 ...
0
votes
1answer
95 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 ...
0
votes
1answer
115 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. ...
-2
votes
1answer
82 views

What is wrong with my code? [closed]

What is wrong with my code below ...
1
vote
2answers
123 views

I have two lists that are the same, yet I get a FALSE when i try to show they are equivalent

I have tried changing the variables, reevaluating the cells, but it just keeps giving me false. The weird part is that it was originally true and it changed to false, randomly.I did not want to post ...
0
votes
1answer
55 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 ...
0
votes
1answer
34 views

Solve command code problem with system of equations

This is my original equation f[x_, y_] = (4 x^2 + y^2)*Exp[-x^2 - y^2]; So I'm trying to find the partial derivatives w/ respect to $x$ and $y$ and set them ...
6
votes
1answer
290 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: ...
1
vote
0answers
126 views

I can't find any mistake in my code! [closed]

...
1
vote
2answers
53 views

MaxValue does not use composed function correctly

I used the compose operator on two functions (a vector-valued interpolated from ndsolve composed with Norm) and then passed the result to MaxValue, which works fine only if I reapply the norm. What is ...
2
votes
1answer
66 views

Code for finding multiple roots only finding two

I've an issue with my code. I am basically trying to get the n-th root of a function. My code finds two roots correctly, but for others, which I think should be distinct, I get the two roots repeated ...
1
vote
0answers
59 views

What am I doing wrong in calculating the mean square error? [closed]

I am trying to compare the results of estimators from least squares and quantile regression from the perspective of the mean square error (MSE). The steps for performing this Monte Carlo approach are: ...
3
votes
2answers
127 views

Extract mesh coordinates from a LaplaceSolution Plot

I have made a code for the solution to a particular problem involving the Laplacian, and after plotting in 3D the resultant potential, I have tried to look for a ...
2
votes
0answers
40 views

How can I fix this cycle in order to iterate several times? [closed]

I have been working on a code whose only purpose is to get the mean value over four numbers. And I managed to do one cycle, however after trying to repeat this process until a certain condition is ...
2
votes
1answer
103 views

How to combine Graphics primitives in a DynamicModule without breaking it

I am trying to present Graphics primitives dynamically. I want the displayed image to be able to update after the user changes the controls. An example would be ...
0
votes
2answers
320 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\...
6
votes
2answers
113 views

NonlinearModelFit inside Manipulate

I can't understand why this behavior with my code... I'm trying to visually adjust the best parameters to fit my model, everything is working fine, less the part of adjusting the model. ...
0
votes
1answer
88 views

Why this expression doesn't work?

I am trying to choose a function and then the parameters using Manipulate, but isn't working... ...
5
votes
2answers
147 views

A box structure with a depth exceeding the maximum allowed depth was encountered

I am trying to perform the task in Mark McClure's article Parametric L-Systems and borderline fractals. I have copied his opening code on the first three pages: ...
-3
votes
1answer
89 views

Help with NDSolve for system of odes [closed]

Can someone please tell me what I am doing wrong? I am trying to solve a system of odes using NDSolve. The code I have written is as follows: ...
1
vote
1answer
88 views

Please help me find my error [closed]

When I use variables, errors are encountered. But when I change the variables to constants, I don't have a problem, but I wonder why. ...
0
votes
0answers
32 views

How to get a full name function [duplicate]

I have some function in string format,and I can get it short name without context ...
3
votes
1answer
192 views

Label State Space Models converting ODEs

Say I have a set of differential equations not necessarily in first order form. I would like to build the corresponding state space model. When equations are many and long, it becomes difficult to ...
3
votes
1answer
104 views
1
vote
1answer
58 views

Defining constants inside a script?

At the beginning of my script, I define a constant E by writing E:=2u+2uv, but then at the end of the script after running the final command, the result comes out with the form K/(2u+2uv). My question ...
-5
votes
1answer
163 views

How to get the coefficients of a generator function? [closed]

I am trying to programming the following in Mathematica; however I am having trouble getting this to work inside the For loop. $$\text{For}\left[i=1;i^2<10,i\...
0
votes
1answer
78 views

I just don't see the difference

I checked it by hand and i am sure that the first code does what i want it to do. But i just don't get even by calculating by hand why the 2nd code is wrong. The only difference in the two codes is ...
3
votes
2answers
541 views

Solving a reaction diffusion dystem [closed]

I have a problem solving a numerical reaction diffusion equation. It emits the following message: RecursionLimit::reclim2: "Recursion depth of 1024 exceeded during evaluation How can I solve this ...
6
votes
2answers
367 views

Sound synthesizer using Manipulate

Sound synthesizers, both digital and analog, often include a parameter section for shaping the amplitude of a sound wave over time. This parameter section is commonly known as an "ADSR EG" (attack, ...
1
vote
0answers
131 views

How to suppress the Windows crash report dialog results from Mathematica sporadical crash when the code is running [closed]

This problem occurs in mathematica 10.0 for windows 7 64 bit. The dialog box in the center of the picture shows that "mathematica kernel for windows has stopped working". I don't know when this error ...
-5
votes
1answer
94 views

Can't get plot using the Evaluate function [closed]

I am trying to plot a series of five curves using a loglogplot command and then labeling the curves with a value. This is the program I am trying to run. ...
1
vote
1answer
199 views

ParametricPlot3D shows an empty box

I'm trying to visualize numerical solution of 4 differential equations (these are the coordinates of a wave function in a quantum mechanical system): ...
1
vote
0answers
30 views

Inconsistency when adding a variable to an analysis

I have a system of three ODEs that I want to find the steady states of, and whether or not they're stable via a simple analysis. To do so, I just calculate the eigenvalues of the Jacobian evaluated at ...
10
votes
2answers
422 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 ...
1
vote
1answer
462 views

NDSolve: Indeterminate expression 0. ComplexInfinity encountered? [closed]

The following code give errors that I don't understand. Could you please suggest a method to solve these differential equations? ...
0
votes
1answer
52 views

Second order differential equation, with term from previous numerical solution

I have a second order differential equation, in terms of a term that was previously obtained from numerically solving another equation. Numerical solution of equation before 2nd order equation: <...
1
vote
3answers
211 views

Solving cubic equation with unknown coefficients

I am trying to solve a cubic equation with unknown coefficients (p and t), here is the code: ...
-7
votes
1answer
114 views

My program to model exterior ballistics doesn't doesn't produce the plot I expect

Here is my program to model exterior ballistics. It doesn't doesn't produce the plot I expect. How can I fix it? ...
0
votes
1answer
107 views

Lagrange multipliers implementation (beginner question) [closed]

I am trying to write a code to find the minimum of $f(x,y) = (Mx + Ny) \,/\sqrt{M^2 x + N^2 y}$?, subject to the constraint $g(x,y)=x+y-1$. Also, $x,y>0$, and $M$ and $N$ are positive constants. ...
0
votes
1answer
47 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$ ...
2
votes
1answer
152 views

Why different output is obtained for the same code (Mathematica 10.1)?

I wrote some code in Mathematica: ...
8
votes
2answers
3k 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 ...
2
votes
1answer
298 views

Getting errors when I try to evaluate code taken from Trott's Mathematica Guidebook for Graphics

I would like to learn how to make high quality images in Mathematica. In my pursuit, I have come across Michael Trott's Mathematica Guidebook for Graphics. I have been trying some of the examples, ...
0
votes
2answers
161 views

Replace $z$ with interpolated function and plotting

I start off with this equation $z(x,y) = sin(xy)$. I create an interpolation from $0 < x < 5$ and $0 < y < 5$. I then use this interpolation on a simple function $w(x,y) = x + y + z(x,y)$ ...
4
votes
1answer
604 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 ...
1
vote
1answer
228 views

Error message: Coordinate index 0 is out of range for the enclosing GraphicsComplex

I am unable understand following error message: Coordinate index 0 is out of range for the enclosing GraphicsComplex. How to fix it? Attached data here: pts and polygons. See also end of question. <...
3
votes
2answers
801 views

Create Table of replacement rules

I want to create a table of replacement rules. ...
0
votes
1answer
88 views

What's going wrong with this button! [duplicate]

I'm implementing an Adaline algorithm where all inputs are 1x5526 and the output is a number from 1 to 10. I have this two functions defined and worked outside the ...