Questions tagged [code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

How can I "map thread" similar notation definitions in one line?

In the past few days I have been dealing with different integral notation definitions made by myself. I have noticed several similar notation definitions with a common pattern, but currently I am only ...
user avatar
  • 289
0 votes
0 answers
62 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: ...
user avatar
  • 199
0 votes
0 answers
56 views

Code Producing FindMinimum::nrnum; how do we fix it?

Suppose $A=\left\{\sqrt{m}:m\in\mathbb{N}\right\}$ and $S\subseteq A$: I wish to create a code which finds: $$\min\left\{c:\forall(d\in S)\exists(c\in A)\left(c/d\in A\right),\max(S)\le c \le \prod\...
user avatar
  • 199
7 votes
2 answers
566 views

Help understand a line of code

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

How do we find the limit of my code?

Suppose we have the following: ...
user avatar
  • 199
2 votes
1 answer
91 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 ...
user avatar
  • 1,626
1 vote
1 answer
77 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 ...
user avatar
  • 1,626
0 votes
1 answer
40 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: ...
user avatar
2 votes
2 answers
75 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 ...
user avatar
1 vote
0 answers
46 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 ...
user avatar
1 vote
0 answers
78 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 ...
user avatar
0 votes
1 answer
38 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' ...
user avatar
  • 271
2 votes
0 answers
71 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?
user avatar
0 votes
1 answer
65 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 ...
user avatar
  • 1,626
0 votes
1 answer
30 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. ...
user avatar
  • 83
4 votes
1 answer
150 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 ...
user avatar
0 votes
0 answers
88 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. ...
user avatar
  • 101
1 vote
0 answers
38 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 ...
user avatar
  • 11
1 vote
0 answers
70 views

Need help understanding a chunk of code [closed]

...
user avatar
2 votes
1 answer
62 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 ...
user avatar
  • 1,723
1 vote
2 answers
72 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+\...
user avatar
5 votes
3 answers
337 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 ...
user avatar
1 vote
2 answers
64 views

Filtering solutions in PowerRepresentations

I have the following code: PowersRepresentations[10400, 7, 2] This produces Length[PowersRepresentations[10400, 7, 2]]=433789 ...
user avatar
  • 1,723
2 votes
1 answer
94 views

Getting two different results for the same computation

I have the following two codes: ...
user avatar
  • 1,723
2 votes
0 answers
63 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 ...
user avatar
0 votes
0 answers
41 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 ...
user avatar
  • 35
1 vote
1 answer
62 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?
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. ...
user avatar
2 votes
1 answer
81 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) \...
user avatar
  • 293
0 votes
0 answers
64 views

Alternative to Coefficient List

I was using CoeffientList to get the probabilities of this generating function... ...
user avatar
  • 341
5 votes
3 answers
415 views

Writing a program that divide numbers until I hit a one digit number

Well, I have the following question: How can I write a program such that an input number $n$ is divided by the number $k$ as long as the resulting number does not have one digit, if the resulting ...
user avatar
  • 1,723
2 votes
0 answers
172 views

How to use Mathematica code in LaTeX files?

How can you use Mathematica code in LaTeX files? any similar to A random number is RNUMBER and the square of RNUMBER is RNUMBER^2 appearing numbers instead the capital letters (or Mathematica code) ...
user avatar
  • 3,061
0 votes
0 answers
77 views

How can I wirte Mathematica code in microsoft word

What I am trying to do is write Mathematica code in Microsoft word because I am doing like tutorial, so how can I insert code with the form in the picture. As an alternative what I am doing is to ...
user avatar
  • 787
0 votes
1 answer
81 views

How to plot the roots of two complex equations?

I have these two equations as two variables '$a1$' and '$b1$', mentioned below and I want to plot the roots of $a1^{\dagger}*a1$ with respect to P0, which will give me bistable plot with three values. ...
user avatar
  • 83
0 votes
2 answers
107 views

Solving a system of equations using the data generated by PowersRepresentations and ParallelTable

First of all, it is possible to check the code that I am asking for because I know that $x=3051$ must yield at least a solution to the problem. Well, I have the following system of equations: Now, I ...
user avatar
  • 1,723
3 votes
2 answers
177 views

Finding 36 integer solutions to a set of 14 equations using various boundary conditions

What is good way to solve this system of equations? I have it run now for quite some time and it does not spit out a solution. ...
user avatar
  • 1,723
1 vote
2 answers
101 views

Solving a big system of equations using certain conditions

I have the following problem: I want to solve a big system of equations for a certain number of variables which I call $a_k$, the variables need to satisfy the following conditions: all $a_k\in\mathbb{...
user avatar
  • 1,723
1 vote
1 answer
98 views

Computing limits from the left and right and getting the same answer which isn't correct

When I use the following code: ...
user avatar
  • 1,723
0 votes
1 answer
60 views

How do I assign values to variables which comprise a matrix?

I have a m x n matrix (5 x 5) and I wish to assign values for m1,m2, m3, etc and n1, n2, and n3 etc, without changing the a[m x n] values. I'm not looking so much for a direct solution but maybe a ...
user avatar
  • 433
2 votes
1 answer
160 views

How to find the distances between two adjacent maxima in a solution from NDSolve

I try to find a general approach to plot the time evolution of horizontal distances from maximum to maximum in a solution of PDE. The solution u[x,t] normally have ...
user avatar
  • 691
4 votes
3 answers
247 views

Writing a program that will filter the integer solutions

I've the following equation: b==(-12 + Sqrt[3] Sqrt[ 3 (-4 + r)^2 + 12 a^2 (-2 + r) - 4 a (-5 + r) (-2 + r) + 4 a^3 (-2 + r)^2] + 3 r)/(6 (-2 + r)) ...
user avatar
  • 1,723
4 votes
1 answer
95 views

Why is my version of Euler's Method not working?

I am creating Euler's method for $\frac{dw}{dt}=(3-w)(w+1)$ for $\Delta t=0.5$ from $0\le t \le 3$. I tried the following. ...
user avatar
  • 199
2 votes
1 answer
46 views

Finding the 3D-model of a function that is rotated around the x-axis

How can I find the 3D model that is created by revolving the function: ...
user avatar
  • 1,723
2 votes
3 answers
91 views

Find the number of true's in a TrueQ expression

How can I find how many times the code: Table[TrueQ[FractionalPart[Sqrt[n]] == 0], {n, 1, m, 1}] Gives the value True back for a variable $m$? So, we know that ...
user avatar
4 votes
1 answer
71 views

Cantor type iterations in Mathematica

I am trying to draw the iterations of the IFS in which from an interval middle third is removed and in the resulting figure left line is shifted 1/6th to the right and right line is shifted 1/6th to ...
user avatar
  • 175
8 votes
0 answers
84 views

Design Patterns for System Functions?

Using PrintDefinitions give one a great view into many system functions. Often the design of these symbols incorporate multiple patterns that I see again and again. ...
user avatar
  • 30.3k
0 votes
0 answers
63 views

How do I change the axes?

...
user avatar
4 votes
1 answer
88 views

Strange bug in LUP Decomposition

I have written LU decomposition with partial pivot, but for some matrices, the entry L[[1,1]] isn't equal to 1 like it should be,...
user avatar