Skip to main content
10 votes
Accepted

Writing a program that will filter the integer solutions

You can use Solve. Your equation: ...
Carl Woll's user avatar
  • 131k
8 votes

Help understand a line of code

let's use curry one by one. Flatten[Module[{x}, x = #; Join[x[[1]], #] & /@ x[[2 ;; -1]]] & /@ igraph, 1] // Select[Length@# > 1 &]; ...
AsukaMinato's user avatar
  • 9,978
7 votes
Accepted

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

One way might be ...
Nasser's user avatar
  • 146k
7 votes
Accepted

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

You have to define the recursive increment. (I assume in your code S[w + 1, t] == w + h*S[w, t] is related to that.) ...
Anton Antonov's user avatar
7 votes

Help understand a line of code

Mathematica's FullForm writes an expression without any abbreviations, not even ones you wish it would use: ...
Michael E2's user avatar
  • 238k
6 votes

A system of nonlinear ODEs

There are two main problems in your code: A typo in your differential equations: phi -> psi Using the exact DSolve for such ...
Domen's user avatar
  • 27.2k
6 votes
Accepted

Finding a subset in the set of the digits of Pi

Let's set up our parameters: digitCount = 1000; piDigits = First@RealDigits[N[Pi, digitCount]]; testSequence = {7, 9, 3}; You can now use SequencePosition: ...
lericr's user avatar
  • 30.2k
6 votes
Accepted

Hiding code in presentations programmatically

Try with this: ...
Gustavo Delfino's user avatar
5 votes

Writing a program that will filter the integer solutions

You might try IntegerQ ...
Ulrich Neumann's user avatar
4 votes
Accepted

Strange bug in LUP Decomposition

The problem is in these two lines: max = Max[U[[k ;;, k]]]; index = Flatten[Position[U[[k ;;, k]], max]][[1]]; You are looking for the pivoting row, so you have ...
Henrik Schumacher's user avatar
4 votes

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

You can also use FixedPointList ...
kglr's user avatar
  • 398k
4 votes
Accepted

How to programmatically modify a function definition

To operate on notebooks Let nb be the notebook you want to alter obtained with NotebookGet[]. For instance, it could be ...
Michael E2's user avatar
  • 238k
4 votes

How to programmatically modify a function definition

This is my first time wading into metaprogramming in Mathematica, so take this with a pinch of salt. I can get the DownValues of ...
flinty's user avatar
  • 25.5k
4 votes
Accepted

Strange effect in the SphericalPlot3D

We can compare the two cases in Cartesian coordinate. r1[θ_, φ_] = Sin[θ] Cos[φ]; r2[θ_, φ_] = Sin[φ] Cos[θ]; ...
cvgmt's user avatar
  • 76.6k
4 votes

Graphic manipulation - Psychrometric chart

Add a white domain erasePlot to the plot. ...
cvgmt's user avatar
  • 76.6k
4 votes
Accepted

Graphic manipulation - Psychrometric chart

...
Syed's user avatar
  • 55.6k
4 votes

Graphic manipulation - Psychrometric chart

You can use RegionFunction option with your boundary function Y[1,T] Note that you don't need to plot each contour separately. ...
Edmund's user avatar
  • 42.4k
4 votes

Stepped Infinite Square Well

Having solved the problem with writing the potential, you may use "Eigensystem" to solve this problem (with arbitrary numerical values): ...
Daniel Huber's user avatar
  • 53.1k
4 votes

Order of Terms in Algebraic Expression

Let us introduce the following function: ...
Alexei Boulbitch's user avatar
4 votes

Saving formatted code

You can save the code in the comments of the file. I use ExportByteArray and ImportByteArray to demonstrate but you can convert ...
Edmund's user avatar
  • 42.4k
3 votes

How to programmatically modify a function definition

That's not a real answer... But I failed to format it as a comment. Again. You're opening a deep can of worms now, called "metaprogramming". Please search for "metaprogramming" and ...
Pavel Perikov's user avatar
3 votes

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

Unprotect[] is there to remove the Protected attribute. This allows the definition of a command to be modified, but doesn't ...
MassDefect's user avatar
  • 10.1k
3 votes
Accepted

Solving a big system of equations using certain conditions

One way I prefer to go about such problems is using 0-1 programming. So each of the 9 variables gets split into 15 component sub-variables. The components are all 0 except for one which is 1. The all-...
Daniel Lichtblau's user avatar
3 votes
Accepted

Cantor type iterations in Mathematica

For labeling you can post-process the output to inject Texts: ...
kglr's user avatar
  • 398k
3 votes
Accepted

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

Try RevolutionPlot3D with option RevolutionAxis -> "X": ...
kglr's user avatar
  • 398k
3 votes

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

$Version "13.0.0 for Mac OS X x86 (64-bit) (December 3, 2021)" Clear["Global`*"] For a variable number of arguments ...
Bob Hanlon's user avatar
  • 160k
3 votes
Accepted

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

...
Bob Hanlon's user avatar
  • 160k
3 votes

Can we solve the following integral by MATHEMATICA?

As mentioned in comment, it is GenerateConditions which sometimes makes it slow. To verify this, do the definite integration by hand and verify it is same as when ...
Nasser's user avatar
  • 146k
3 votes

Finding a subset in the set of the digits of Pi

Using string-functions ds = StringRiffle[First @ RealDigits @ N[Pi, 1000], ""]; StringPosition["793"] @ ds {{14, 16}, {440, 442}, {487, 489}} ...
eldo's user avatar
  • 77.7k
3 votes

How can I calculate the negativity?

The negativity can be calculated via negativity[A_] := Total[Sqrt[Eigenvalues[A . A\[ConjugateTranspose]]]] - 1 We can test this, ...
evanb's user avatar
  • 6,151

Only top scored, non community-wiki answers of a minimum length are eligible