Skip to main content

Questions tagged [code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
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. ...
ahmed's user avatar
  • 85
1 vote
0 answers
55 views

Help with a partial differential equation - inaccurate result

I'm trying to solve the following partial differential equation using NDSolve ...
derdin1's user avatar
  • 63
0 votes
0 answers
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}...
Radia B's user avatar
  • 41
0 votes
0 answers
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: ...
John Doe's user avatar
  • 271
1 vote
0 answers
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: ...
Albert Copperfield's user avatar
2 votes
3 answers
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. ...
Mariano Suárez-Álvarez's user avatar
3 votes
1 answer
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 ...
Konstantin's user avatar
0 votes
0 answers
45 views

Matrix subtraction not working [duplicate]

I am using Mathematica to solve a hw question. I have the following code: ...
zaza sea's user avatar
1 vote
0 answers
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 ...
ahmed's user avatar
  • 85
0 votes
0 answers
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 ...
FDMEM's user avatar
  • 19
0 votes
0 answers
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 ...
user444's user avatar
  • 2,644
-2 votes
1 answer
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. ...
reza's user avatar
  • 113
0 votes
1 answer
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 ...
Adel 's user avatar
1 vote
2 answers
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 ...
SciJewel's user avatar
  • 575
0 votes
1 answer
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. ...
csn899's user avatar
  • 4,523
1 vote
1 answer
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 ...
user444's user avatar
  • 2,644
1 vote
2 answers
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=...
John Doe's user avatar
  • 271
4 votes
3 answers
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: ...
Jan Eerland's user avatar
  • 2,001
3 votes
3 answers
274 views

Graphic manipulation - Psychrometric chart

I'm working on a psychrometric chart on Mathematica. The code is as follows: ...
Julio Araujo Dos Santos's user avatar
1 vote
2 answers
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]); ...
user avatar
-1 votes
1 answer
51 views

Swap Composite Command Components

Let's take a composite Mathematica command: A[B[]] where A and B - two arbitrary ...
ayr's user avatar
  • 2,444
-1 votes
1 answer
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 ...
Superunknown's user avatar
0 votes
0 answers
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: ...
Arbuja's user avatar
  • 81
7 votes
2 answers
586 views

Help understand a line of code

this is a weird question, but I read the following line of code: ...
diegor's user avatar
  • 93
0 votes
0 answers
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 ...
Tom00496's user avatar
1 vote
1 answer
114 views

How do we find the limit of my code?

Suppose we have the following: ...
Arbuja's user avatar
  • 81
2 votes
1 answer
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 ...
ayr's user avatar
  • 2,444
1 vote
1 answer
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 ...
ayr's user avatar
  • 2,444
0 votes
1 answer
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: ...
Brandon Evans's user avatar
2 votes
2 answers
98 views

Could anyone please help with defining a vector function of tons of variables?

Could anyone please help with effectively defining a vector-valued function of tons of variables so that ...
mathlive1's user avatar
1 vote
0 answers
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 ...
Alberto Sierraalta's user avatar
1 vote
0 answers
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 ...
Miaoxiao Wang's user avatar
0 votes
1 answer
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' ...
John Doe's user avatar
  • 271
1 vote
0 answers
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?
Firdous Mala's user avatar
0 votes
1 answer
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 ...
ayr's user avatar
  • 2,444
0 votes
1 answer
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. ...
vini's user avatar
  • 83
4 votes
1 answer
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 ...
Kamal Khalil's user avatar
0 votes
0 answers
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. ...
M.Ramana's user avatar
  • 101
1 vote
0 answers
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 ...
Hadi's user avatar
  • 11
1 vote
0 answers
73 views

Need help understanding a chunk of code [closed]

...
Ma. Fernanda Robles Hernández's user avatar
2 votes
1 answer
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 ...
Jan Eerland's user avatar
  • 2,001
1 vote
2 answers
77 views

To write mathematica code for summation using a given data

I am given a set like some terms from the partition of $20$: $\{\{17, 3\}, \{13, 7\}, \{11, 3, 3, 3\}, \{7, 7, 3, 3\}, \{7, 5, 5, 3\}, \{5, 5, 5, 5\}\}$. From the above data, $20= \underline{1}*17+\...
user75105's user avatar
5 votes
3 answers
428 views

How to programmatically modify a function definition

I would like to know an efficient method (without converting Mathematica Code to strings and string processing) of modifying a function definition programmatically. For example, I would like to tidy ...
Iconoclast's user avatar
1 vote
2 answers
68 views

Filtering solutions in PowerRepresentations

I have the following code: PowersRepresentations[10400, 7, 2] This produces Length[PowersRepresentations[10400, 7, 2]]=433789 ...
Jan Eerland's user avatar
  • 2,001
2 votes
1 answer
110 views

Getting two different results for the same computation

I have the following two codes: ...
Jan Eerland's user avatar
  • 2,001
2 votes
0 answers
67 views

Microcontrollerkit No longer compiles code after update

I recently restarted a project where I used MicrocontrollerKit to generate code for me into the Wiring language to be then imported into arduino IDE for editing and ...
DrMrstheMonarch's user avatar
0 votes
0 answers
53 views

How to deal with unknown variables in NSolve?

I am trying to solve these equations by using NSolve and want to plot $p1^{2}+p2^{2}$ v/s P0. But there is some problem, it is showing running... but not showing any error. I don't know where I am ...
vidya's user avatar
  • 35
1 vote
1 answer
131 views

How to unprotect/see the code of a command in Mathematica [duplicate]

How do you see the code form of a command in Mathematica? I know there is a command in Mathematica, "Unprotect[]", but how do you actually use this?
Krishiv SURESH's user avatar
1 vote
1 answer
54 views

Formatted/modified Mathematica command

I know there is a way of making your own commands that outputs your desired information but I'm not sure how to do this. How do you format/modify/make your own command that outputs what you want. E.g. ...
Krishiv SURESH's user avatar
2 votes
1 answer
127 views

Implementing binomial expansion of (non-commuting) matrices in Mathematica

Given two matrices $A$ and $B$, their Binomial expansion is, in general, given by (see this page) $(A+B)^n = \sum\limits_{k=0, k=n[2]}^n \Bigg( \sum\limits_{r=0}^k \binom{k}{r} A^r B^{k-r} \Bigg) \...
Rob's user avatar
  • 433