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

65 questions
Filter by
Sorted by
Tagged with
29 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 ...
56 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? <...
54 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. ...
43 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 ...
104 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 ...
254 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 ...
118 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. ...
108 views

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

What is wrong with my code below ...
124 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 ...
72 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 ...
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 ...
318 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: ...
128 views

...
61 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 ...
77 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 ...
79 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: ...
156 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 ...
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 ...
109 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 ...
378 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 ...
572 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 ...
401 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, ...
144 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 ...
95 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. ...
231 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): ...
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 ...
501 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 ...
545 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? ...
55 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: <...
253 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: ...
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? ...
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. ...
48 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$ ...
160 views

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

I wrote some code in Mathematica: ...
4k 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 ...
304 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, ...
167 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)$ ...