Photograph via snooOG

For information and tips about Mathematica features.


related reddits:

/r/Mathematica

11,593 Subscribers

3

Does Wolfram Cloud have a symbolic symbols palette?

Like the Desktop version of Mathematica?

So much more convenient to use a symbols palette than using Wolfram Language.

3 Comments
2025/01/01
02:46 UTC

1

How can I use packages in Wolfram Cloud?

Specifically, the HiGGS package, as part of xACT.

I understand how to load the package, but that page mentions using the Wolfram Cloud directory as the file system. I've tried going to Base>Applications and placing the xACT file and its contents there, and the HiGGS files in that, but the CloudGet command is failing, so obviously I'm doing something wrong.

I'd prefer to use Wolfram Mathematica, but right now I only have institutional access to Wolfram Cloud, I'd rather not spend any of my own money, and WLJS isn't yet in a state where it's able to properly format the outputs from HiGGS.

0 Comments
2024/12/31
02:38 UTC

3

What is DSolve`DSolveOrder2PFQSolsDump`b?

I am trying to solve a differential equation (image bellow) and the solution contains the following: DSolve`DSolveOrder2PFQSolsDump`b. Running ?DSolve`DSolveOrder2PFQSolsDump`b, returns that it is a symbol and google has nothing.

Has anyone see this before? What is it and then does it occur?

https://preview.redd.it/0m52iolea98e1.png?width=1536&format=png&auto=webp&s=feece0135af62e15b12254969b862980631237fa

https://preview.redd.it/fxm2wglea98e1.png?width=1531&format=png&auto=webp&s=1d1b6ffb8d0e1ee503e470f6ea1e0b1160dd78a0

5 Comments
2024/12/21
19:48 UTC

5

Notebook assistant experience

Anyone, who is not part of the development team, used the notebook assistant program to help with an actual project using Mathematica. It seems like it could be a game changer, but watching Stephen Wolfram struggle with his presentation https://www.youtube.com/live/jVG4FYo6qA8?si=gJtoM33EAw9MNrVR makes me wonder how long it will take to get it to be useful for my projects

0 Comments
2024/12/20
15:57 UTC

2

Binomial expansion for coefficient extraction of generating function

If you have a generating function, is it possible for Mathematica (and how?) to do the binomial expansion to (directly) obtain the formula for a coefficient?

As an example, I got the g.f.:

SeriesCoefficient[(1 - x^m)^n/(1 - x)^(n + 1), {x, 0, n m - s}]

Now I would do the binomial expansion myself, to arrive at the formula for the coefficient:

Sum[(-1)^k Binomial[n, k] Binomial[m(n - k) + n - s, n], {k, 0, Floor[n - s/m]}]

But I feel like Mathematica should probably be capable to do this for me, but I can't figure out how.

2 Comments
2024/12/17
11:58 UTC

1

Help please, kind of urgent :D

Hi everyone! I apologize in advance for my bad English, I'm trying my best.

I need help solving a Sudoku but using Mathematica. The problem is that I'm not allowed to use commands as SudokuSolve (which would make things a lot easier). The goal is to approach the solution through algebraic techniques, which means using variables, equations, and possibly matrix operations to find the solution. I made this code but it doesn't work for some reason:

(the comments are in Spanish)

In[17]:= (* Lo primero es definir el Sudoku como una matriz de variables*)

(*Cada celda es una variable desconocida,excepto donde ya conocemos los números.*)

sudoku = {{x11, 4, 6, 7, x15, x16, x17, x18, x19}, {x21,

x22, 8, x24, 6, 9, x27, 5, x29}, {x31, x32, x33, x34, 4, x36, x37,

9, x39}, {x41, x42, x43, x44, x45, 5, 4, 8, 3}, {x51, x52, x53,

x54, 2, x56, 5, 7, x59}, {x61, 8, x63, 4, x65, x66, x67, x68,

x69}, {7, 2, x73, 6, 5, x76, x77, x78, 4}, {x81, 3, x83, 8, x85, 7,

6, x88, 2}, {x91, x92, 8, 2, x95, x96, x97, 7,

x99}};

In[18]:= (*Ahora vamos a poner las restricciones:

1- Cada celda debe tener un valor entre 1 y 9. Hacemos esto para que los valores que tomen las variables no se pasen*)

restriccionesCeldas = Table[1 <= sudoku[[i, j]] <= 9, {i, 9}, {j, 9}];

(* 2- Las filas no pueden tener numeros repetidos. Vamos a comparar los elementos de cada fila para asegurarnos de que no se repiten.*)

In[19]:=

restriccionesFilas = (Table[

Table[sudoku[[i, k]] != sudoku[[i, l]], {k, 9}, {l, k + 1,

9}], {i, 9}]);

(* 3- Las columnas no pueden tener numeros repetidos. Vamos a comparar los elementos de cada columna para asegurarnos de que no se repiten.*)

In[20]:=

restriccionesColumnas = (Table[

Table[sudoku[[k, j]] != sudoku[[l, j]], {k, 9}, {l, k + 1,

9}], {j, 9}]);

(* 4- Las submatrices de orden 3 (son 9 en total) no pueden tener números repetidos. Paraa ello vamos a analizar las 9 submatrices de orden 3 y ver que sus elementos sean diferentes. *)

In[21]:=

restriccionesSubmatrices =

Table[Table[

sudoku[[3 (a - 1) + i, 3 (b - 1) + j]] !=

sudoku[[3 (a - 1) + k, 3 (b - 1) + l]], {i, 3}, {j, 3}, {k, i,

3}, {l, If[k == i, j + 1, 1], 3}], {a, 3}, {b, 3}];

(* 5- Hay elementos que ya conocemos. Esos van a ser fijos. *)

In[22]:=

restriccionesConocidas = {sudoku[[1, 2]] == 4, sudoku[[1, 3]] == 6,

sudoku[[9, 3]] == 8, sudoku[[9, 4]] == 2, sudoku[[9, 9]] == 7,

sudoku[[7, 1]] == 7, sudoku[[7, 2]] == 2};

(* Ahora vamos a unir todas las restricciones, vamos a usar una lista*)

In[23]:=

restriccionesTotales =

Flatten[{restriccionesCeldas, restriccionesFilas,

restriccionesColumnas, restriccionesSubmatrices,

restriccionesConocidas}];

(* Vamos a usar un Solve para buscar los valores de los elementos y que cumplan las condiciones/restricciones*)

In[24]:= solucion = Solve[restriccionesTotales, Flatten[sudoku]];

(* y mostramos resultado como matriz*)

In[25]:= MatrixForm[sudoku /. First[solucion]]

ReplaceAll::reps: {1<=x11<=9,True,True,True,1<=x15<=9,1<=x16<=9,1<=x17<=9,1<=x18<=9,1<=x19<=9,1<=x21<=9,1<=x22<=9,True,1<=x24<=9,True,True,1<=x27<=9,True,1<=x29<=9,1<=x31<=9,1<=x32<=9,1<=x33<=9,1<=x34<=9,True,1<=x36<=9,1<=x37<=9,True,1<=x39<=9,1<=x41<=9,1<=x42<=9,1<=x43<=9,1<=x44<=9,1<=x45<=9,True,True,True,True,1<=x51<=9,1<=x52<=9,1<=x53<=9,1<=x54<=9,True,1<=x56<=9,True,True,1<=x59<=9,1<=x61<=9,True,1<=x63<=9,True,1<=x65<=9,<<1010>>} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.

I don't know what to do, I've tried asking chatGPT, MathGPT and Copilot. They all give me codes that say that it doesn't have a solution.

I really would appreciate some help as I’m in kind of a hurry (my deadline is Wednesday at midnight 💀)

2 Comments
2024/12/10
00:31 UTC

2

Calculating volatility of stocks over time

I am in school and new to Mathematica. I'm working on a project where I'm trying to calculate the volatility of stock prices between different sectors. I'm using the Wolfram FinancialData dataset and getting the adjusted close prices from 6 representative companies in 6 different sectors to do the analysis. However, I keep running into multiple issues when trying to pull the data in. The code below is a simplified version, only looking at the Technology sector for now while I try to debug this. It also looks at only 3 days worth of data, vs. the 5 years that I will eventually use. I've tried debugging this for a while and can't figure out where I'm stuck. It seems like it should be a simple fix since I'm using standard data and not calling anything that is particularly complicated. Any help is appreciated!

(* will use 6 companies from Technology, Healthcare, Financials, Consumer Discretionary, Energy, Industrial sectors. For now, starting with Technology to ensure the code works *)
sectors = {{ Apple FINANCIAL ENTITY , Microsoft FINANCIAL ENTITY , NVIDIA FINANCIAL ENTITY , Alphabet Class A Shares FINANCIAL ENTITY , Meta FINANCIAL ENTITY , Amazon FINANCIAL ENTITY }};

(* using 3 days worth of data to test. Will expand to 5 years for full analysis *)
startDate = "2024-12-04";
endDate = "2024-12-06";

(* I've exported this data to a csv file and it looks correct - each stock has prices for the 3 days I'm evaluating *)
data = Table[FinancialData[stock, "AdjustedClose", {startDate, endDate}], {sector, sectors}, {stock, sector}];

(* added this code below because Mathematica kept giving an error stating there were non-numeric values in data. I'm assuming that it might be because there is a $ sign in the financial data. Once I added this, it was able to calculate the logReturns in the next line of code *)
cleanedData = QuantityMagnitude /@ Table[FinancialData[stock, "AdjustedClose", {startDate, endDate}], {stock, sectors}]

(* this should return a list of the differences of the logs between the stock prices, but it's returning a lot of 0s *)
logReturnsCleanedData = Table[Differences[Log[sectorData〚All, 2〛]],
(*Compute log returns*){sectorData, cleanedData}]

(* I was expecting this to return {2, 2, 2, 2, 2} but it is returning {5} *)
Length /@ logReturnsCleanedData

(* this gives me an error with the StandardDeviation function, and says that a "Rectangular array is expected at position 1 *)
stockVolatilities = Table[StandardDeviation[returns], {returns, logReturnsCleanedData}]

(* this is the full error message I get from the code above
StandardDeviation : Rectangular array expected at position 1 in StandardDeviation[{{{{0.587791, 0.599486, 0.602453}}, {0}, 0, {0, 0}, {0, 0}, 0, {0, 0, 0, 0, 0}}, {{{-1.10326, -1.11556, -1.13593}}, {0}, 0, {0, 0}, {0, 0}, 0, {0, 0, 0, 0, 0}}, {<<1>>}, {{{1.25846, 1.26049, 1.27265}}, {0}, 0, {0, 0}, {0, 0}, 0, {0, 0, 0, 0, 0}}, {{{-1.03441, -1.01558, -1.0107}}, {0}, 0, {0, 0}, {0, 0}, 0, {0, 0, 0,0, 0}}}]. *)

(* the remaining code below does not work yet since I cannot get the code above to output the correct info *)
sectorVolatilities = Mean /@ stockVolatilities

BarChart[sectorVolatilities,ChartLabels→{"Technology","Healthcare","Financials","Consumer Discretionary","Energy","Industrials"}, ChartStyle→"Pastel",AxesLabel→{"Sectors","Volatility"}]

1 Comment
2024/12/09
17:39 UTC

0

Mathematica Help

I'm using code someone wrote for me already and that, when they ran it, worked, but now when I try to run it it's not working. Any ideas why?

https://preview.redd.it/6pvk7w80cp5e1.png?width=2752&format=png&auto=webp&s=b7ae514cb83297429ce80a1bcedeb2136a518cac

10 Comments
2024/12/08
22:34 UTC

2

DSolve systems of DE

I am trying to solve the system of DE but whenever I plug it in, it just outputs my input

DSolve[{x'[t] == -2 y[t] + x[t]/(1 + x[t]^2 + y[t]^2),

y'[t] == 2 x[t] + y[t]/(1 + x[t]^2 + y[t]^2), x[0] == 0.5,

y[0] == 0.4}, {y, x}, t]

Is there anything wrong with my syntax or can mathematica just not solve this problem?

3 Comments
2024/12/07
15:49 UTC

1

Animate two parametric plots in same box

I am attempting to animate two parametric plots within the same box but I cannot determine how to do so. Guidance is appreciated.

3 Comments
2024/12/06
03:21 UTC

1

LieART

Hello everyone!

There is a livestream on LieART by Robert Feger on YouTube!

0 Comments
2024/12/04
16:44 UTC

3

Can I move mathematica to a different machine?

So i installed wolfram mathematica in my pc, licensed through my university. After some days i realized it would be much more handy to have that software in my laptop. So my question is fairly simple. Can i unistall the one in my pc and then install in my laptop?

3 Comments
2024/12/01
09:38 UTC

2

Any cool ideas about biology related project for freshmen?

I'm a freshmen student in physics and I have to do a project in mathematica of a certain level of difficulty. While I don't have great knowledge about biology, I'm interested in ProteinData because it looks cool. Any ideas about how I do a cool project about it?

1 Comment
2024/11/28
12:36 UTC

1

Windows ARM

Snapdragon X Elite

Is there any possibility to use mathematica on snapdragon chips as my university recommended snapdragon laptops and we need mathematica for our masterthesis.

Kind regards Your Wilfram appreciator

3 Comments
2024/11/28
06:45 UTC

3

Linear application

1 Comment
2024/11/26
00:45 UTC

1

Limit output calculates limit that does not exist

I have a following function and want to calculate its one sided Limit in x->1.

The left-sided output is totally fine, but I'm wondering why do I get -Infinity on right-sided Limit since it does not exist.
I also plotted the function and printed its domain using built-in function and all checks out with my understanding. So we do I get -inf output? What am I missing here?

https://preview.redd.it/ka89lgq70q2e1.jpg?width=403&format=pjpg&auto=webp&s=ea9791d8377eee86e5e576e9bc0269bb320d42e4

https://preview.redd.it/93eq5m480q2e1.jpg?width=446&format=pjpg&auto=webp&s=7f3b5b1e6ecd72aaca1d5178f7d5e6712b655f92

5 Comments
2024/11/23
21:36 UTC

2

perturbation method on mathematica

Can someone give some examples of differential equations on perturbation method using mathematica. I'm new to Mathematica and I'm sot sure if I can use it to solve them or how to use it.

1 Comment
2024/11/21
11:25 UTC

2

I'm trying to find de "a" and "b" values with this code but it's keep running the evaluation forever, so a think a did something wrong there...

V[x_] = (1 - Exp[-Sqrt[2/3]*x])^(2);

drV[x_] = D[V, x];

Solve[-drV/V == -Sqrt[2], x];

phif = 0.940;

X = (1 + (2 - a)*phi/(2 Sqrt[3 b]))^(2/(2 - a));

M[phi_] = -Sqrt[b/3] (X^a (a + 6 X) - 3 b*X)/(X^(1 + a/2)*(2 X^a - b));

drM[phi_] = D[M[phi], phi];

Mf[a_, b_] := M[phif] == V[phif];

drMf[a_, b_] := drM[phif] == drV[phif];

Solve[{Mf[a, b], drMf[a, b]}, {a, b}]

2 Comments
2024/11/21
00:16 UTC

2

A framework for debugging and data analysis using Mathematica/Jupyter notebooks

Processing img c28obgpgex1e1...

dbgbb!(...) makes it easy to debug array data using notebooks just like the dbg!(...) macro. It sends the data to the BulletinBoard server, and then it can be read from Mathematica/Jupyter notebooks

BulletinBoard is an in-memory object storage that mediates data between a Rust program and a notebook. The BulletinBoard server is available on crates.io, DockerHub, and GitHub. There is also a GUI application that acts as both client and server.

Data is stored as ArrayObjects, which is a self-describing binary data format optimized for array data and for object storage.

Check it out and enjoy the accelerated coding experience!

https://github.com/YShoji-HEP/dbgbb

https://github.com/YShoji-HEP/BulletinBoard

https://github.com/YShoji-HEP/ArrayObject

0 Comments
2024/11/20
09:34 UTC

0

Finding count of the number of words beginning with "q"

Here is the code generated taking help of an AI tool (ChatGPT):

Count[WordList[], StringMatchQ[#, "q" ~~ ___] &]

https://preview.redd.it/j34g0ev3qm1e1.png?width=1024&format=png&auto=webp&s=0c138d5a083da79d1e4e3093d0340866d340a00b

There is definitely something wrong as the output should not be zero.

The syntax StringMatchQ[#, "q" ~~ ___] & is something I find difficult to relate. It will help if someone could explain the relevance of #, ~~ ___, & within the code. Of course since the code is apparently giving wrong output, first need to revive the correct code.

Thanks in advance!

9 Comments
2024/11/18
09:38 UTC

0

Understanding TextSentences function

https://preview.redd.it/i4jxkeibbl1e1.png?width=1024&format=png&auto=webp&s=ad0395d4725d688de2a1f6acdef2ca38fc7f9c42

https://preview.redd.it/y7rwp18gbl1e1.jpg?width=1920&format=pjpg&auto=webp&s=0c798fe4e88212b0853f2dc6a483ca7e4fe7c92e

On running TextSentences[x], it will help if anyone can explain how the Wolfram Languages infers for example "Resrly" is not the first word of a new sentence.

1 Comment
2024/11/18
04:49 UTC

0

Reason output showing in list form

https://preview.redd.it/6f7t43588g1e1.png?width=1024&format=png&auto=webp&s=55abe4cad0adb8fa5cd853d2a4e039a8e3e12bf6

StringLength[MaximalBy[WordList[],StringLength]] 

Not sure why the output is in list form. Obviously there should be a way to convert this list form into integer form.

1 Comment
2024/11/17
11:42 UTC

0

Showing in the form of a string first letter of sentences

The problem is to make a string from the first letters of all the sentences in the Wikipedia article about computers.

Here is my tentative code:

StringJoin[StringTake[StringSplit[WikipediaData["computers"],"."], 2]] 

https://preview.redd.it/fs0r1jrkge1e1.png?width=1024&format=png&auto=webp&s=54954a1a8b005db37fa1b152241a15ab1631531e

Not sure about the error messages shown in red above.

I chose 2 instead of 1 for StringTake argument as there seems to be a whitespace after period.

Help is sought also for how to ensure that the first letter after a sentence is selected irrespective of it appears after the period or followed by one or more whitespaces.

5 Comments
2024/11/17
05:45 UTC

0

Understanding double square bracket [[1]] for extracting portion of a list

StringSplit[stringsample,{"."}][[ 1]] 

The double square bracket syntax appears not that intuitive with otherwise the usual way which is putting one function above the other.

If I understand correctly, the output of StringSplit function which is a list is being used by [[1]] to show just the first element of the list. What appears strange is the syntax.

1 Comment
2024/11/16
11:17 UTC

1

Using StringSplit and show output within quotes

https://preview.redd.it/zn5kg68rc51e1.png?width=1024&format=png&auto=webp&s=715ef9d25b17651c6026b168b79050c8d3190378

The goal is to by using StringSplit, split the text on the basis of comma appearance.

StringSplit["Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",","] 

The above syntax generated after referring to Wolfram docs on StringSplit:

https://preview.redd.it/iyzn5rddd51e1.png?width=1024&format=png&auto=webp&s=8f2ab1c3623abedea34c05a12a12112894db7d21

It seems the comma is indeed split but difficult to discern from the output. So trying to take help of InputForm function in order to show each substring with quotes.

https://preview.redd.it/4hch1elje51e1.png?width=1024&format=png&auto=webp&s=4495bf4c692b5eca24e6bd08ff8088809473929d

The docs uses InputForm[%] as second code after the StringSplit code. Not sure how the second code using InputForm function will know that it is the previous code of which referred.

I tried to do the same with my code and here is the screenshot:

https://preview.redd.it/084qubpze51e1.png?width=1024&format=png&auto=webp&s=920097c6381965c9895f42113cbec96cd8eefd58

3 Comments
2024/11/15
23:20 UTC

Back To Top