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
-2 votes
1 answer
393 views

What is wrong with my code? [closed]

What is wrong with my code below ...
DMH16's user avatar
  • 379
1 vote
2 answers
132 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 ...
Marisol Roman's user avatar
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
0 votes
1 answer
39 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 ...
Itsnhantransitive's user avatar
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
1 vote
0 answers
143 views

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

...
gogo2020's user avatar
1 vote
2 answers
75 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 ...
migrral's user avatar
  • 15
2 votes
1 answer
162 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 ...
Pagode's user avatar
  • 121
1 vote
0 answers
314 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: ...
Thadeu Freitas Filho's user avatar
3 votes
2 answers
291 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 ...
Mounice's user avatar
  • 85
2 votes
0 answers
43 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 ...
Mounice's user avatar
  • 85
2 votes
1 answer
166 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 ...
user42582's user avatar
  • 4,185
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
6 votes
2 answers
174 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. ...
user avatar
0 votes
1 answer
101 views

Why this expression doesn't work?

I am trying to choose a function and then the parameters using Manipulate, but isn't working... ...
user avatar
6 votes
2 answers
171 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: ...
David's user avatar
  • 14.8k
-3 votes
1 answer
117 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: ...
Matt Rueben's user avatar
1 vote
1 answer
99 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. ...
이동민's user avatar
0 votes
0 answers
37 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 ...
yode's user avatar
  • 26.3k
5 votes
1 answer
567 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 ...
Mirko Aveta's user avatar
  • 2,150
3 votes
1 answer
115 views

How to add element to a list once and then the last element will get replaced in the following iterations?

...
user36426's user avatar
  • 3,225
1 vote
1 answer
69 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 ...
Damien Clarke's user avatar
-5 votes
1 answer
190 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\...
antonio asis's user avatar
0 votes
1 answer
79 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 ...
user34047's user avatar
  • 335
3 votes
2 answers
640 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 ...
Thimo Merkel's user avatar
7 votes
2 answers
514 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, ...
useranonis's user avatar
1 vote
0 answers
152 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 ...
Gregory Xue's user avatar
-5 votes
1 answer
105 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. ...
user41071's user avatar
  • 117
1 vote
1 answer
349 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): ...
David's user avatar
  • 13
1 vote
0 answers
33 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 ...
Matt's user avatar
  • 11
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
2 votes
1 answer
1k 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? ...
Bikramjit's user avatar
0 votes
1 answer
67 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: <...
SuperCiocia's user avatar
  • 1,472
1 vote
3 answers
542 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: ...
SuperCiocia's user avatar
  • 1,472
-7 votes
1 answer
134 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? ...
Srdjan's user avatar
  • 5
0 votes
1 answer
125 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. ...
odnerpmocon's user avatar
0 votes
1 answer
50 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$ ...
hoyast's user avatar
  • 23
2 votes
1 answer
267 views

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

I wrote some code in Mathematica: ...
Misery's user avatar
  • 2,570
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
2 votes
1 answer
367 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, ...
Olsen's user avatar
  • 21
0 votes
2 answers
204 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)$ ...
user44840's user avatar
  • 421
4 votes
1 answer
896 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
1 vote
1 answer
880 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. <...
User12309's user avatar
  • 427
3 votes
2 answers
2k views

Create Table of replacement rules

I want to create a table of replacement rules. ...
olliepower's user avatar
  • 2,224
0 votes
1 answer
98 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 ...
Jotasmall's user avatar
  • 121
3 votes
3 answers
1k views

For-loop not working as I expect

I want to do this: When 10 <= t < 130, give t -> 1; When 130 <= t<300, give <...
Yuuhsing Tuan's user avatar
-4 votes
1 answer
1k views

How can I plot a function that is the sum of another function?

I plotted m[t], but actually what I want to plot is g[t], which is a summation of m[t] from ...
user124627's user avatar
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
3 votes
1 answer
138 views

some confusion about ReplaceRepeated

This is Right. NestWhile[Log, 100, # > 1 &] {100} //. {x_} /; x > 1 :> {Log[x]} 100. //. x_ /; x > 1 :> Log[x] This is wrong,why? ...
Apple's user avatar
  • 3,663
0 votes
1 answer
340 views

updating code from 5.0 to 9.0

I am updating a code from a 5.0 version to a 9.0 version. I am speaking about "Advanced visual quantum mechanics". There is a package with this code: ` ...
Raffaele Carlone's user avatar