# 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.

108 questions
Filter by
Sorted by
Tagged with
393 views

### What is wrong with my code? [closed]

What is wrong with my code below ...
1 vote
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 ...
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 ...
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 ...
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: ...
1 vote
143 views

...
1 vote
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 ...
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 ...
1 vote
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: ...
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 ...
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 ...
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 ...
1 vote
824 views

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 ...
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 ...
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, ...
1 vote
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 ...
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. ...
1 vote
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): ...
1 vote
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 ...
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 ...
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? ...
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: <...
1 vote
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: ...
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? ...
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. ...
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$ ...
267 views

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

I wrote some code in Mathematica: ...
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 ...
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, ...
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)$ ...
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 ...
1 vote
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. <...
2k views

### Create Table of replacement rules

I want to create a table of replacement rules. ...
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 ...
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 <...
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 ...
366 views

### Why Min cannot be used as constrains of NMinimize?

I met a strange problem when trying to do an optimization. Initialization code, ...