# Questions tagged [code]

The tag has no usage guidance.

69 questions
Filter by
Sorted by
Tagged with
29 views

### Running the code take too long

I am trying to run this code but it takes a very long time and does not finish. ...
• 85
1 vote
55 views

### Help with a partial differential equation - inaccurate result

I'm trying to solve the following partial differential equation using NDSolve ...
• 63
57 views

### Solve system of integrated differential equations

I want to solve a system of integrated differential equations but I am encountering a problem with my Mathematica code. \text{ka}=\text{kb}=1; \text{wa}=\text{wb}=\frac{w}{2}; \text{Jxy}=0.5; \text{Jz}...
• 41
55 views

### Using CrossEntropyLoss function for basic neural network

Hi I am interested in understanding how to use the neural network functions in Mathematica. I have just started learning hence this is a basic query. The simple example I am looking at is as follows: ...
• 271
1 vote
55 views

### How to simplify the results of squared amplitude calculations in FeynCalc?

I want to calculate the squared amplitude of the Feynman diagram of double-pion photoproduction using FeynCalc package. Here is the code I created: ...
326 views

### Saving formatted code [closed]

I am writing some ODE notes with lots of pictures generated using Mathematica, and I'd like to include the code used to generate them. Currently I have a notebook where all the pictures are generated. ...
79 views

### Hiding code in presentations programmatically

A number of discussions is dedicated to hiding the code/input in presentations or notebooks. It is very simple to hide the input by hand. I could not find, if it is possible to hide input by the code ...
• 926
45 views

### Matrix subtraction not working [duplicate]

I am using Mathematica to solve a hw question. I have the following code: ...
1 vote
101 views

### Solve system of ODE by fractional finite difference method

I am trying to solve the following system using fractional finite difference method: where e=0.1, a=1.3, m=0.3, p=10, g=3, k=1 and s1, s2, s3 it was mentioned in this paper that it is calculated ...
• 85
48 views

### How to solve this Third Order PDE using NDSolve; Showing some missing variable error

I just confuse why ***u[0,t]==Sin[\omega t] cannot be used as a variable error was showing ...
• 19
54 views

### Part specification error

I am doing a solved exercise shared here. However, while running the code, I encountered an error on page-8, under the Dynamics section. with error : I think this error is due to the absence of ...
• 2,644
75 views

### How can I calculate the negativity?

I tried to calculate the negativity that is defined as follows: $eq(1): N = Tr(Sqrt(A.A\dagger))-1$ The result should be ~0.41 in for example r~0.01 (when r is close to 0) and it decreases versus r. ...
• 113
56 views

### How to find a conditional solution of inequalities?

Im trying to find the conditions of: a>0,b>0,c>1,d>0 (a + (2 a - b/c) d + (a + b - b/c) d^2 + (-b + (2 b)/c) d^3 + (b d^4)/ c - (b d^5)/c) > 0 I ...
• 1
1 vote
295 views

### Order of Terms in Algebraic Expression

When I write an algebraic expression of the following form, B*OverBar[A]*C^3 + A*OverBar[C]*B B C^3 Overscript[A, _]+A B Overscript[C, _] the order of the ...
• 575
100 views

### Why can't the denominator be rationalized for such a result?

The root formula of the output is rational for denominator, and the result of FullSimplify output is the same. ...
• 4,523
1 vote
330 views

### Stepped Infinite Square Well [closed]

Here is the link for making the above graph for the Stepped infinite square well. The problem here is, all the eigenfunctions and energy eigenvalues are previously defined. Whereas, I want to use this ...
• 2,644
1 vote
79 views

### Defining and executing large matrix operators on vectors efficiently

For an $N$-qubit system, I am interested in coding, in an efficient way, the following set of Kraus operators $\{A_c\}_c$ defined in the computational basis as \begin{align} \hat{A}_c := \sum_{m=...
• 271
271 views

### Finding a subset in the set of the digits of Pi

Well, I want to find the first position where the digits of Pi are {a,b,c,...,z}. So to find the first n digits of Pi and put them in listform I used: ...
• 2,001
274 views

### Graphic manipulation - Psychrometric chart

I'm working on a psychrometric chart on Mathematica. The code is as follows: ...
1 vote
235 views

### Can we solve the following integral by MATHEMATICA?

I am trying to solve the integral using the following Mathematica code. f1 = (t[m + 1] - t)^(\[Alpha] - 1)*(t - t[m - 1])*(t - t[m - 2]); ...
51 views

### Swap Composite Command Components

Let's take a composite Mathematica command: A[B[]] where A and B - two arbitrary ...
• 2,444
45 views

### Using barchart on outputs [closed]

I want to use barchart to make a plot with a series of outputs from the given command max1={max, arg} = NMaximize[{solutionI[t], 0 < t < 100}, t] here it is ...
• 605
74 views

### How do we define the function near the end of my post?

Suppose I have two sets $F_{1,n}$ and $F_{2,n}$ written as: ...
• 81
586 views

### Help understand a line of code

this is a weird question, but I read the following line of code: ...
• 93
39 views

### Problem with ToExpression and TexForm changing two variables multiplied together into one multi-lettered variable

I have a problem where if I multiply two variables a c in Mathematica, then copy as LaTeX (or just use the Mathematica output) to get a c, then put it in ToExpression["a c",TeXForm], I get ...
1 vote
114 views

### How do we find the limit of my code?

Suppose we have the following: ...
• 81
95 views

### Strange effect in the SphericalPlot3D [closed]

I found something odd in Mathematica when using the SphericalPlot3D command. Ranges for $x,y∈[0,2 \pi]$ are the same. All I do is swap sine and cosine. But when I ...
• 2,444
1 vote
90 views

### Separating terms in an expression with many variables by their "nature"

I have an expression like this: $f=t_1(\sin(\alpha),\cos(\beta),\cos(\gamma)^2) \cdot r_1(x,y,z)+t_n(\sin(\alpha),\cos(\beta),\cos(\gamma)^2) \cdot r_n(x,y,z)$ Where $t_i$ and $r_i$ - functions of ...
• 2,444
42 views

### Updating the association with answers from the TrigProperties Function

I have created a list of rules I would like to update with values. My goal here is to be able to write the following: ...
98 views

Could anyone please help with effectively defining a vector-valued function of tons of variables so that ...
1 vote
49 views

### Help me understand a part of this code (using Clock) [closed]

I'm a begginer in Mathematica and I need help understanding a part of some code that I took and adapt from another question in this forum. The code is to animate one by one a list of points (with x,y ...
1 vote
123 views

### How to solve ODEs using deep learning in Mathematica [closed]

I have a number of ODEs (58) with 16 parameters and 9 variables. I want to solve the ODEs to obtain the analytical relationship between the parameters and variables. It is obviously that the ODEs ...
56 views

### FoldList type evaluation for multivariable function

In the example code which follows I define a two variable conditional function h[_i, _v], one variable denotes the integer index i, and the other is an N-dimensional vector v (I denote dimension 'N' ...
• 271
1 vote
73 views

### How can I access Mathematica on a more powerful machine remotely? [closed]

I have Mathematica installed on my machine. My code is taking a long time. It could be owing to my machine strength. Is there a way to run my code remotely on a cloud?
• 111
173 views

### The list of coefficients of the "polynomial", which has the order of derivatives instead of degrees

I have some equation eqn = (A + B).x''[t] + Transpose[x'[t]].(2 A - 3 B + 1).x'[t] +(СС - 5).y'[t]+ Sin[x[t]+y[t]] I need to collect all the coefficients at ...
• 2,444
34 views

### How to resolve problem during summation of functions?

I am trying to find out the output of this basic problem but getting an error. If anyone can resolve this will be helpful. ...
• 83
169 views

### A system of nonlinear ODEs

I am working with Mathematica to plot a system of Nonlinear ODEs, I did a program but it doesn't work. I don't know exactly where is the problem? If someone kindly can help with a remark or a ...
• 133
321 views

### How to convert a Python code to a Mathematica code?

I've written the following code in Python. I want to write this code in Mathematica but I don't know Mathematica. How can I convert this code to a code in Mathematica? Thanks in advance. ...
• 101
1 vote
58 views

### Show Code Assist

I want to cancel the Auto Popup in the options menu. It turns to False but when I come back to the code it turns to true again. I clicked in Apply. I need to turn it off because it sometimes does not ...
• 11
1 vote
73 views

...
64 views

### Counting the number of elements

I have the following output: {{{0, 1}}, {{1, 1}, {1, 2}}, {{2, 1}, {2, 3}}, {{3, 1}, {3, 2}, {3, 3}, {3, 4}}} Using Length[] on ...
• 2,001
1 vote