/r/Mathematica

Photograph via snooOG

For information and tips about Mathematica features.


related reddits:

/r/Mathematica

11,441 Subscribers

1

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?

1 Comment
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

2

Choose a product to launch

How can I solve this problem? When I try to click to select, I cannot select it. When I click on the details, I see the license (free trial account). My university provides a code, so I want to use it, but there is no place to enter my code. I uninstalled and reinstalled Mathematica, but I still couldn’t solve the issue.

https://preview.redd.it/nr2rnglhix0e1.png?width=1330&format=png&auto=webp&s=b82f0119e8bb618f702a8b0b95f0c6dc69a451c8

0 Comments
2024/11/14
20:44 UTC

0

Find the string positions where the periods occur in the article

https://preview.redd.it/ex4bakm1su0e1.png?width=1024&format=png&auto=webp&s=744ef83aefb3440d06880f109ad9cbf99f754ec1

StringPosition[WikipediaData["Strings"],"."] 

The aim is to find the positions where the periods occur in the article. The output is strange with only 3 results.

1 Comment
2024/11/14
11:35 UTC

0

Counting of number of words in a string with StringSplit and Length

https://preview.redd.it/5kkdpmeuvs0e1.png?width=1024&format=png&auto=webp&s=5b5bf1529db293a95f3a56c95d713e5647733d04

For finding how many words are there in the Wikipedia article "Computer", after running the below code, getting 9358 (instead of 9239):

https://preview.redd.it/jmwllyp79u0e1.png?width=1024&format=png&auto=webp&s=908a5f031b3582d43568510c6af861bcd0115dd3

https://preview.redd.it/w1so87u79u0e1.png?width=1024&format=png&auto=webp&s=2961f0e7af17a949b0d18f19cec0f38084af4ae8

Length[StringSplit[WikipediaData["computer"]]] 

If I am correct, StringSplit counts each word based on the number of times it encounters white space while parsing through the whole string. So even if there are punctuation marks like commas, that should not affect the count of words.

0 Comments
2024/11/14
05:17 UTC

0

Find the string length of the Wikipedia article for "computer'

This is a question in exercises part of Strings & Text (An Elementary Introduction to the Wolfram Language).

Not sure what it means by Wikipedia and 'computer' in this context. Is WikipediaData function designed so as to access the content of wikipedia.org?

Also what it exactly means by Wikipedia article for 'coimputer'. Will it refer to this url page: https://en.wikipedia.org/wiki/Computer?

1 Comment
2024/11/14
00:43 UTC

1

Why bar chart starts on the x axis leaving a gap in the first unit

https://preview.redd.it/kfb6qlkkum0e1.png?width=1024&format=png&auto=webp&s=045dce4fa348ff2ba97deaabc130de084a7ca10d

BarChart[StringLength[StringSplit["A long time ago, in a galaxy far,far away", ","]]] 

While I can follow the reason for three bars as there are 2 commas in the string, unable to grasp the reason why first unit in the x axis left empty (or with zero value).

1 Comment
2024/11/13
08:54 UTC

1

Beginner needs help solving implicit equation

I have an equation that i need to solve but Mathematica only outputs empty brackets

di = 0.1;

dRI = 0.11;

da = dIA + 0.01;

ai = 1000;

lR = 47;

lI = 0.08;

lA = 220;

aa = 15;

ka = 0.5299;

eq = 1/ka ==

da/di*ai + da/2*lR*Log[dRI/di] + da/2*lI*Log[dIA/dRI] +

da/2*lA*Log[da/dIA] + 1/aa

Solve[eq, dIA]

Ouput:

1.88715 ==

1/15 + 10002.2 (0.01 + dIA) + 0.04 (0.01 + dIA) Log[9.09091 dIA] +

110 (0.01 + dIA) Log[(0.01 + dIA)/dIA]

{}

https://preview.redd.it/r0f2uqrcxb0e1.png?width=904&format=png&auto=webp&s=e002d1fde5e5b0529d4d6eb5dab4c06d959e4ab8

I asked ChatGPT but that didnt help. What am I doing wrong?

2 Comments
2024/11/11
20:09 UTC

3

Laptop specs for Mathematica

Hello!

I am about to buy a new laptop and I would like some advice in terms of which specs I should focus on, given that my main usage for work is Mathematica (plus all the usual stuff, email, web, etc). Since Mathematica can be used in many ways and for different purposes here some details for my use case.

I am a theoretical physicist and I use Mathematica constantly everyday. 90% of what I do is symbolic calculations that involve a huge amounts of terms. I usually reduce most of operations to basic ones, in order to speed things up. A typical example (for those among you that do a similar job) is calculation of many Feynman diagrams, which in principle are integrals but can be easily reduced to algebraic operations and the most time-consuming part is the simplification of terms (typically hundreds of thousands). By simplifications I mean applying some rules to substitute terms so they sum up and simplify.

Another example in my daily usage are perturbative expansions. In many situations I have to derive some expressions which are functions of quantities that are power series and then derive the power series of the result.

Less often I do numerical calculations or graphics (but I do them). I also sometimes do some numerical scans.

Please, also consider that, besides the heavy usage of Mathematica, I use other coding language like FORM. Also, I don't do any graphic design or video editing, but I am considering some online teaching, so a good camera and screen-sharing fluidity is important (also important when giving online seminars or work meetings). Finally, as a pure hobby, I also make some ambient music using ableton live :).

Since the new macbook pro with the M4 chips are out, and they seem a huge upgrade, I am considering buying one.

But there are many different specs and many golden coins involved.

What would be the most important aspect(s) to look at? I have zero knowledge on which Mathematica functionality uses which laptop's feature. I can only note that, when Mathematica takes long time and the fans are on, CPU is 100%, while RAM is mostly fine. So, should I focus more on number of cores rather than ram (which anyway should be 16GB, at least)?

Just to keep it in context with the laptop I am looking at, there is a huge jump in performance from the M4 [16 GB of ram, 512 ssd, 10 core (4+6)] and the M4 pro [24 GB of ram, 512 ssd, 12 core (8+4)], but I am not sure if it is worth for my usage.

At the moment I have a Lenovo yoga slim 7 from 2020 with Ubuntu. At that time I switched from Windows to Ubuntu simply because I couldn't stand Windows anymore and I have zero regrets ;). However, I am not really a typical Linux user and the fact that I need to access the terminal for any tiny thing is frustrating (still less than using Windows...). This is why I am thinking of switching to macOS which may be the right half-way between dumb Windows and Linux.

A final note, the Macbooks mentioned above are the devices that I am considering now but your answers do not need to be specifically on those models (although any advice is welcome), it was just for context.

Thanks and cheers!

9 Comments
2024/11/11
14:45 UTC

0

Fubini theorem

Hello, I'm going to present a Calculus 2 seminar on Fubini's Theorem and I need to solve contextualized situations in the area of ​​Engineering that involve this topic. Could anyone help me with 3 practical examples, applied to Engineering, using Fubini's Theorem, with detailed resolution? Thank you very much for the help!

1 Comment
2024/11/10
16:42 UTC

2

Defining list mentioning other function as part of output not allowed?

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

f[x_Integer] := x + 108 
h[x_Integer] :=x + 77

SetAttributes[f, Listable] 
f[x_List] := h/@x 
f[{44,444}] 

 Given I have referred h function here: f[x_List] := h/@x , I expected the output of f[{44,444}]  to be 121 (77 + 44) and 521 (77 + 444). So my query is how even after inclusion of h, the output of list still referring to f. Is it then wrong to code:

f[x_List] := h/@x 

And what is the implication or utility of mentioning h (as part h/@x) when anyway it will be g/@x.

3 Comments
2024/11/10
12:20 UTC

1

Map and Prefix: Relevance of prefix when the function is listable by default

Continuing with my earlier post Difference between prefix and map and why they produce the same output in this code, it will hep if someone can clarify the difference between these 3 codes giving the same output:

https://preview.redd.it/fioimzv5e00e1.png?width=1024&format=png&auto=webp&s=94669268efc9ce1e3ee4fc0c9a689e2c6d67b6ba

The first one is the most intuitive and this is the way till now I have been using functions most of the time:

StringLength[StringSplit["A long time ago, in a galaxy far, far away", {",", " "}]] 

If I understand correctly, the second one and third ones are giving the same output as StringLength function has listable attribute added by default.

StringLength@StringSplit["A long time ago, in a galaxy far, far away", {",", " "}] 

StringLength/@StringSplit["A long time ago, in a galaxy far, far away", {",", " "}] 

If listable attribute were not added by default to the StringLength function, then mapping was needed (by using /@).

This now brings the need to use prefix (by using @) when even without the use of prefix, there is the same output as in the first code.

2 Comments
2024/11/10
05:29 UTC

0

Difference between prefix and map and why they produce the same output in this code

Running the two operations produces same result for these codes:

StringLength /@ StringSplit["A long time ago, in a galaxy far, far away", {",", " "}]
    
    Output:
    
        {1,4,4,3,0,2,1,6,3,0,3,4} 

StringLength@StringSplit["A long time ago, in a galaxy far, far away", {",", " "}] 

    Output:
        {1,4,4,3,0,2,1,6,3,0,3,4} 

On further check, it appears first one performs map operation while the second one is called prefiix. Both are meant to do different things apparently.

3 Comments
2024/11/09
16:52 UTC

1

pls help

how i found the positive inverse of x^2 +2 in mathematica? i tried using

f[x_] := x^2 + 2

Solve[y == f[x] && x >= 0, x]

but it doesnt work

1 Comment
2024/11/09
09:55 UTC

0

Correct usage of StringSplit that takes into account adjusting comma

BarChart[StringLength[StringSplit["A long time ago, in a galaxy far,far away"]]] 

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

The above code seems counting ago, as a word of length 4 instead of 3 due to comma.

Requesting help for correct usage of StringSplit function that takes into account adjusting comma (or other punctuations).

5 Comments
2024/11/09
06:53 UTC

0

What is wrong with this ImageAdd and Negate function

ImageAdd[
    Negate[EdgeDetect[Import["https://wolfr.am/EIWL-SW-Image"]]], 
    Import["https://wolfr.am/EIWL-SW-Image"]
]

https://preview.redd.it/itdlaw68omzd1.png?width=1024&format=png&auto=webp&s=5f0258f3205d54edbabb602c2c16dbb2cb532db2

4 Comments
2024/11/08
07:13 UTC

1

Looking for specific Graph Automorphism?

I have a family of graphs, and I only need to see that an automorphism exists which contains a specific single vertex mapping, for example [1->96], to see that the entire graph is vertex-transitive. Is there a way to restrict the search based on this? I’ve tried somethings but nothing has run faster than just checking with VertexTransitiveGraphQ.

4 Comments
2024/11/07
23:59 UTC

Back To Top