/r/Mathematica

Photograph via snooOG

For information and tips about Mathematica features.


related reddits:

/r/Mathematica

10,253 Subscribers

1

My friend and I are both having the same problem. My microphone works fine in all other apps, except Mathematica can't detect any input devices.

Has anyone found a solution to this?

AudioCapture[] returns...

https://preview.redd.it/rntexvd5qavc1.png?width=557&format=png&auto=webp&s=dae388ee1aef5b0fb017eedebcf1dfa1586926d1

$AudioInputDevices returns...

Lookup[FFmpegTools`Audio`AudioDevices[], "InputDevice"]

0 Comments
2024/04/18
20:17 UTC

2

Any Project Ideas

I have recently started playing around with wolfram notebooks on the Wolfram Cloud(free tier) and was wondering if you guys have any simple project ideas I can make with it.

3 Comments
2024/04/17
20:54 UTC

1

Confused over the symbolic solver

Basically the symbolic solver is outputting some "1." symbols that i don't know what they mean. Is this a weird multiplication thing?

Example: 1.25 - 1. x^2 - 1. y^2 + x sin[0.1]

3 Comments
2024/04/17
17:47 UTC

1

12 Best Apps for Mental Health Support for Students

1 Comment
2024/04/17
12:37 UTC

2

Equivalent in Python or Maple

Source: https://oeis.org/A333926

See comment below for the Python code that only works up to 255. Python output differs at 256, 768, 1280, 1792, etc. I'm entirely not clear why it would matter that the exponent is, or is not, cube-free.

Mathematica:

recDivQ[n_, 1] = True;
recDivQ[n_, d_] := recDivQ[n, d] = Divisible[n, d] && AllTrue[FactorInteger[d], recDivQ[IntegerExponent[n, First[#]], Last[#]] &];
recDivs[n_] := Select[Divisors[n], recDivQ[n, #] &];
f[p_, e_] := 1 + Total[p^recDivs[e]];
a[1] = 1;
a[n_] := Times @@ (f @@@ FactorInteger[n]);
Array[a, 100]

5 Comments
2024/04/15
22:08 UTC

0

How to Prepare for an Exam in 3 Days: A Strategic Approach

1 Comment
2024/04/15
12:42 UTC

0

Effective Online Research Techniques for A+ Papers!

2 Comments
2024/04/12
13:20 UTC

1

Mathematica code writer

Hi! I am trying to extend a study that used mathematica to get its results, but the code does not give me any output. I am not into coding, so even if I tried to figure out what to do to make the code work, I don’t think I really have the brains for it. My question is, how do I get someone to write the code for me for a price? Are there actual people who open commissions for this?

7 Comments
2024/04/09
14:07 UTC

0

I know this is obvious for many but for the love of god someone tell me how do I make Mathematica simplify this

I have an expression containing terms of the form (w^(2/3))^3 and would like to convert them to w^2. I honestly don't know how to make this work and I've browsed the internet for hours but nothing works. Neither Simplify, FullSimplify or Refine with Assumptions works. Someone save me please :(

8 Comments
2024/04/09
11:05 UTC

1

Trying to Perform Data Analysis with Results from FlightData Entity

! I am trying to use data collected from the FlightData[] command to analyze departure delay data for a school project.

I am getting as far as using a command to get the data, taking it into a named object, and extracting the values from it, but I am trying to remove the missing values, but DeleteMissing[] doesn't seem to work...

I also am trying to get all of my delays to be in units of minutes without hours, but they are pulled in units of minutes and sometimes mixed radix units...

<|Entity["Flight", "202301010000290517"] -> <|"ArrivalDelay" -> Quantity[MixedMagnitude[{0, 5}], MixedUnit[{"Hours", "Minutes"}]]|>, Entity["Flight", "202301010000323732"] -> <|"ArrivalDelay" -> Quantity[-8, "Minutes"]|>, Entity["Flight", "202301020000152941"] -> <|"ArrivalDelay" -> Quantity[-12, "Minutes"]|>, Entity["Flight", "202301020000257894"] -> <|"ArrivalDelay" -> Quantity[-30, "Minutes"]|>,

Also, I want to do statistical analysis with this data I am collecting, and have plans to track various routes for a year, and would like to make some layered line graphs. I had tried before, but I got a mismatch saying the length of the sets was not the same and this could not be done. Is there a way around this?

I think I am also having an issue with the outputs being ArrivalDelay -> 4 min or 1 hr 5 min, and I can't seem to get the raw numbers away from the ArrivalDelay signifier and I'm afraid this is also causing me issues. I seem to have gotten to a point where I was able to analyze this data, but what I had pulled had only pulled the minutes and not hours and didn't actually convert anything.

I think the biggest hump I am trying to overcome is the data collecting and cleaning. I am newer to wolfram, and have most of my experience in R, but am trying to challenge myself to learn a new skill for school. Wolfram seems incredibly intuitive and powerful once the basics are grasped which I am trying to do here! Any help is appreciated!

I am sure I will have more questions as I work more, but I appreciate any help with this! I have been speaking with my advisor and we are hoping that this project will get more people in the department interested in exploring other tools for data analysis, such as wolfram, because it really seems to be able to make graphics that are a bit more interesting than R!

Is there any general resource for data cleaning/data analysis within wolfram? I am not having the best of luck finding resources about the specific things I am trying to do, unfortunately. Any help is greatly appreciated!

11 Comments
2024/04/08
03:13 UTC

2

FindMinimum struggles

Hi All, I'm relatively new to mathematica but I'm trying to minimise a numerical function with 21 parameters. I think I want FindMinimum[], I've attached much of my code below. I think I have the syntax correct, but when I try and run it, the print statement ( Print[Dimensions[symbolicDynamicalMatrices], rules];) shows that the rules are not being updated with the first guess I put into the function, they show: \[Alpha]->p1,\[Beta]->p2 .... rather than \[Alpha]->25,\[Beta]->22.

Can anyone give me some advice please? I'll paste the notebook at the bottom in case it's helpful. Thanks in advance, I really have no idea what I'm doing...

calculateSquaredResidual[p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_, 
  p10_, p11_, p12_, p13_, p14_, p15_, p16_, p17_, p18_, p19_, p20_, 
  p21_] := Module[{
   parameters, values, observed, expected, residualSquared, 
   numericalDynamicalMatrices
   },
  Print[\[Alpha], \[Beta], \[Mu], \[Nu], \[Lambda], \[Delta], \[Mu]p, \
\[Nu]p, \[Lambda]p, \[Delta]p, \[Mu]pp, \[Lambda]pp, \[Mu]ppp, \
\[Nu]ppp, \[Lambda]ppp, \[Delta]ppp, \[Mu]pppp, \[Nu]pppp, \
\[Lambda]pppp, \[Delta]pppp, \[Gamma]pppp];
  parameters = {\[Alpha], \[Beta], \[Mu], \[Nu], \[Lambda], \[Delta], \
\[Mu]p, \[Nu]p, \[Lambda]p, \[Delta]p, \[Mu]pp, \[Lambda]pp, \
\[Mu]ppp, \[Nu]ppp, \[Lambda]ppp, \[Delta]ppp, \[Mu]pppp, \[Nu]pppp, \
\[Lambda]pppp, \[Delta]pppp, \[Gamma]pppp};
  
  parameters = {\[Alpha], \[Beta], \[Mu], \[Nu], \[Lambda], \[Delta], \
\[Mu]p, \[Nu]p, \[Lambda]p, \[Delta]p, \[Mu]pp, \[Lambda]pp, \
\[Mu]ppp, \[Nu]ppp, \[Lambda]ppp, \[Delta]ppp, \[Mu]pppp, \[Nu]pppp, \
\[Lambda]pppp, \[Delta]pppp, \[Gamma]pppp};
  values = {p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, 
    p14, p15, p16, p17, p18, p19, p20, p21};
  rules = Thread[parameters -> values];
  Print[Dimensions[symbolicDynamicalMatrices], rules];
  observed = 
   Map[Sort, 
    Sqrt[Map[Eigenvalues, symbolicDynamicalMatrices /. rules]]];
  expected = QChemFrequencies;
  (*Print[MatrixForm[(observed - expected)^2/expected]];*)
  residualSquared = Total[Total[(observed - expected)^2/expected]]
  ]


FindMinimum[calculateSquaredResidual[p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, 
  p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, 
  p21],
{{p1, 25}, {p2, 22}, {p3, 1.5}, {p4, 2.7}, {p5, -3.66}, {p6, 
   1.1}, {p7, 
   0.836}, {p8, -0.96}, {p9, -1.86}, {p10, -0.890}, {p11, -0.86}, \
{p12, 1.56}, {p13, 0.86}, {p14, 0.499}, {p15, 3.5}, {p16, 
   1.298}, {p17, 0.233}, {p18, 
   0.293}, {p19, -0.233}, {p20, -0.108}, {p21, 0.146}}, 
 StepMonitor :> Print["running"]]

2 Comments
2024/04/06
16:08 UTC

0

Pre requisite chapters and topics I should know to learn these topics and solve questions on them as a heuristic

Please could any of you provide just enough amount of material on whatever the pre-requisite topics are for the following topic.

Infinite Series: Convergence of series, tests for convergence, power series, Maclaurin's and Taylor's series, Series for exponential, trigonometric and logarithmic functions.

Multivariable Differential Calculus: Limit, continuity and partial derivatives, total derivative and chain rule, Euler's theorem, Maclaurin's and Taylor's series in two variables, Tangent plane and normal line, Maxima and minima of a function of two variables, Method of Lagrange multipliers.

Integral Calculus: Evaluation of definite and improper integrals, Beta and Gamma functions and their properties, Applications of definite integrals to evaluate surface areas and volumes of revolutions.

ps- I didnt study high school math properly barely passed it and now i feel completely lost in my engineering math subject calculus 2 and 3. I always get scared and feel this inability whenever i encounter any problem. And when i start studying it, i don't know how much deep i should go into a concept, how much theory i am supposed to know, i look for perfection in the theory before getting to the question practice because i feel like i should be able to derive all the methods and know the derivation to all the theorems and when i open the book and try to learn and understand i don't understand(because i am not good at math like trig algebra etc. because i have been facing the same problem since high school), end up wasting my time and losing my motivation to study and give up for the next few days.

3 Comments
2024/03/31
17:01 UTC

0

Ignite Your Drive: 13 Practical Tips to Stay Motivated in Your Studies

0 Comments
2024/03/30
10:45 UTC

2

How to delete patterns?

Hi.

I'm working on a project to get time derivatives of position in mathematica. In the beginning I define the functions, but when I differentiate them i get a expression with Pattern^(1,0), for example. I've read that it's because Pattern is kind of a function and Mathematica applies chain rule. The thing is that the results get extremely long because of this and i don't want to delete it every time it appears. Is there a way to tell Mathematica to forget that "function"?

Also, if I get this expression:

\!\(\*OverscriptBox[\(r\), \(\[RightVector]\)]\)[t_] Derivative[1][r][
   t_] + r[t_] 
\!\(\*OverscriptBox[\(\[Theta]\), \(\[RightVector]\)]\)[
   t_] Derivative[1][\[Theta]][t_] + r[t_] Sin[\[Theta][t_]] 
\!\(\*OverscriptBox[\(\[Phi]\), \(\[RightVector]\)]\)[t_] Derivative[
   1][\[Phi]][t_]

Is there a way to make the vectors appear at the end of every term?

13 Comments
2024/03/29
02:27 UTC

0

Mathematica Marvels: The Secrets of Crafting Precision with Online Rulers

As a DIY enthusiast and amateur woodworker, having a real ruler at my disposal has always been essential. There's a certain comfort in the weight of a physical tool in your hand, knowing you can rely on its accuracy for precise measurements.

However, my perspective shifted when I discovered the world of online rulers powered by Mathematica. At first, I was skeptical—how could a virtual tool possibly match the reliability of a real ruler?

The answer lies in the intricate workings of Mathematica, a powerful computational software that brings mathematical precision to digital tools. When I first encountered an online ruler enhanced by Mathematica, I was intrigued by the possibilities.

What struck me immediately was the attention to detail. The online ruler displayed on my screen felt like a real ruler, complete with clear markings and the ability to switch between inches and centimeters. But what truly amazed me was the level of precision it offered.

Behind the scenes, Mathematica works its magic by employing advanced algorithms that ensure the online ruler is true to scale. This means that no matter the screen size or resolution, the measurements remain accurate and consistent.

But the marvels of Mathematica don't stop there. The software also allows for dynamic adjustments to the online ruler, catering to various tasks and needs. Need to measure the dimensions of a room for a home improvement project? The online ruler can handle it with ease. Working on a detailed engineering blueprint? Mathematica ensures every line and angle is precise.

What's more, Mathematica-powered online rulers often come equipped with additional features that go beyond what a real ruler can offer. From the ability to save measurements for future reference to instantly converting units, these tools add a layer of convenience that enhances the overall user experience.

In my own woodworking projects, the online ruler powered by Mathematica has become an invaluable asset. Whether I'm designing furniture pieces or crafting intricate details, I can rely on its accuracy to ensure every cut and measurement is spot-on.

So, while the idea of a virtual ruler may have seemed foreign to me at first, the reality is that Mathematica has unlocked a world of precision and efficiency. It's not about replacing the trusty real ruler—it's about complementing it with a digital tool that offers unmatched accuracy and versatility.

5 Comments
2024/03/25
11:39 UTC

6

How would you use Mathematica to manage a tabletop roleplaying campaign?

I know this may sound like a strange application for Mathematica, but I've already got Mathematica for my self-study and hobby uses, and am fond of the language and notebook interface although I'm quite new to it.

Since I frequently play TTRPGs, I'm wondering if Mathematica could be a helpful virtually-all-in-one solution to run and keep track of a campaign as it unfolds. After all, the notebook could store a lot of formatted text and images about the game world, alongside pre-written code to generate NPCs and quests, compute character stats, calculate effective attack/defence in combat, present data, etc. It could then serve as an interpreter to call those functions, simulate the roll of dice, and do quick calculations.

I see a lot of potential here, but I'm at a loss as to how to design a good notebook/template and workflow for this purpose. Would really appreciate any ideas. Thanks!

3 Comments
2024/03/22
21:48 UTC

3

Which OS works the best with Mathematica?

I've recently started using Mathematica and I love it, however on my Windows desktop it crashes often, especially when using the LLM features. I'm thinking about getting a laptop just for Mathematica use, so I was thinking either getting a M3 Macbook air or a Ubuntu laptop. So for those with experience, do you prefer Linux or macOS with Mathematica?

18 Comments
2024/03/20
11:57 UTC

4

Would Mathematica be the right choice ?

I am an engineering PhD researcher in acoustics and my work is a mix of analytical and numerical calculations. For the numerical calculations, I am using an open-source solver. For the analytical part, I will be dealing with Green's functions and in general, boundary value problems with PDEs. I have looked into Python/MATLAB to check if something like this can be replicated:

I have not found any examples of something like this using Python/MATLAB.

I am wondering if Mathematica could be worth the time. I will be dealing with convolution operations, PDEs, integral transforms and of course, visualizations. I really like the fact that there are dedicated APIs in Mathematica for all these operations.

I spent some time using the Notebooks in Mathematica, but I want to know if the style of scripting that is found in Python/MATLAB can be replicated in Mathematica. To be specific, if I run something in Python/MATLAB I can immediately see a list of variables in the variables explorer. Through the IDEs I can also debug the scripts. While using Notebooks, I found out that dealing with variables was difficult. Some of the errors that I got just straight-up went tangent to my head.

I am not going to write any numerical-heavy solvers and I use Python to post-process the large text files that the open-source solver writes. The most would be numerical evaluation of integrals in the complex plane.

I know the necessary resources to learn Mathematica such as WolframU.

Your comments will be helpful.

6 Comments
2024/03/19
20:06 UTC

6

What is Wolfram One?

I have been looking through the different products offered by Wolfram to find something suitable for a hobbyist programmer.

I understand Mathematica and Wolfram Alpha, and have used both before. However, it is unclear to me exactly what Wolfram One offers.

Is a Wolfram One subscription essentially the same thing as a Mathematica subscription, with the added ability to access/use Mathematica from a web browser?

Thanks for any insight.

10 Comments
2024/03/17
15:53 UTC

3

Setting Physical Constants

New to the software so sorry for the seemingly slow question

I’m doing some physics calculations and I do not want to have to manually enter in universal constants as custom variables all the time.

I want to use the built-in variables for these values

Is there a way to load all of the variables into the work space , similar to the “import” command in python?

The documentation tells me that these functions are already built-in, but whenever I try to call them, they don’t work for me .

Clearly I’m doing something wrong

*Answer from/u/segfault0x001

: h = Entity["PhysicalConstant", "PlanckConstant"]["Value"] is what you're looking for I think.8

5 Comments
2024/03/16
10:07 UTC

1

Help with Debugging a Mathematica Script

Establishing Radial location of tether components and moments of interia around tether CoM. Then constructing Kinetic and Potenitial energy equations

Using LaGrange Equation to Construct Equations of Motion

NDSolve to Solve system of differenatial equations for R, Theta and Psi.

Error messages from above script

Hi guys,

I'm attempting to use mathematica to solve a system of differential equations that describe the motion of an asymmetrical space tether structure in orbit and I'm encountering alot of difficulty with using the NDSolve function.

An example of the error messages given when running the code are given as well.

Any advice on where these errors arise from would be great, thanks in advance.

2 Comments
2024/03/15
17:30 UTC

0

The divisibility rules of every number from 1 to 100

NumberRule
1Any number is a multiple of 1
2The number ends in 0, 2, 4, 6 or 8
3The sum of the digits is a multiple of 3
4The 10s digit is even and the last digit is 0, 4 or 8, or the 10s digit is odd and the last digit is 2 or 6
5The number ends in 0 or 5
6The number is a multiple of 2 and 3 at the same time
7The difference between twice the last digit and the rest of the number is a multiple of 7
8The 100s digit is even and the last 2 digits are a multiple of 8 or the 100s digit is odd and the last 2 digits are 4 times an odd number
9The sum of the digits is a multiple of 9
10The number ends in 0
11The difference between the last digit and the rest of the number is a multiple of 11
12The number is a multiple of 3 and 4 at the same time
13The sum of 4 times the last digit and the rest of the number is a multiple of 13
14The number is a multiple of 2 and 7 at the same time
15The number is a multiple of 3 and 5 at the same time
16The 1,000s digit is even and the last 3 digits are a multiple of 16 or the 1,000s digit is odd and the last 3 digits are 8 times an odd number
17The difference between 5 times the last digit and the rest of the number is a multiple of 17
18The number is a multiple of 2 and 9 at the same time
19The sum of twice the last digit and the rest of the number is a multiple of 19
20The number ends in 00, 20, 40, 60 or 80
21The number is a multiple of 3 and 7 at the same time
22The number is a multiple of 2 and 11 at the same time
23The sum of 7 times the last digit and the rest of the number is a multiple of 23
24The number is a multiple of 3 and 8 at the same time
25The number ends in 00, 25, 50 or 75
26The number is a multiple of 2 and 13 at the same time
27The difference between 8 times the last digit and the rest of the number is a multiple of 27
28The number is a multiple of 4 and 7 at the same time
29The sum of thrice the last digit and the rest of the number is a multiple of 29
30The number is a multiple of 3 and 10 at the same time
31The difference between thrice the last digit and the rest of the number is a multiple of 31
32The 10,000s digit is even and the last 4 digits are a multiple of 32 or the 10,000s digit is odd and the last 4 digits are 16 times an odd number
33The number is a multiple of 3 and 11 at the same time
34The number is a multiple of 2 and 17 at the same time
35The number is a multiple of 5 and 7 at the same time
36The number is a multiple of 4 and 9 at the same time
37The difference between 11 times the last digit and the rest of the number is a multiple of 37
38The number is a multiple of 2 and 19 at the same time
39The number is a multiple of 3 and 13 at the same time
40The 100s digit is even and the last 2 digits are 00, 40 or 80, or the 100s digit is odd and the last 2 digits are 20 or 60
41The difference between 4 times the last digit and the rest of the number is a multiple of 41
42The number is a multiple of 2, 3 and 7 at the same time
43The sum of 13 times the last digit and the rest of the number is a multiple of 43
44The number is a multiple of 4 and 11 at the same time
45The number is a multiple of 5 and 9 at the same time
46The number is a multiple of 2 and 23 at the same time
47The difference between 14 times the last digit and the rest of the number is a multiple of 47
48The number is a multiple of 3 and 16 at the same time
49The sum of 5 times the last digit and the rest of the number is a multiple of 49
50The number ends in 00 or 50
51The number is a multiple of 3 and 17 at the same time
52The number is a multiple of 4 and 13 at the same time
53The sum of 16 times the last digit and the rest of the number is a multiple of 53
54The number is a multiple of 2 and 27 at the same time
55The number is a multiple of 5 and 11 at the same time
56The number is a multiple of 7 and 8 at the same time
57The number is a multiple of 3 and 19 at the same time
58The number is a multiple of 2 and 29 at the same time
59The sum of 6 times the last digit and the rest of the number is a multiple of 59
60The number is a multiple of 3 and 20 at the same time
61The difference between 6 times the last digit and the rest of the number is a multiple of 61
62The number is a multiple of 2 and 31 at the same time
63The number is a multiple of 7 and 9 at the same time
64The 100,000s digit is even and the last 5 digits are a multiple of 64 or the 100,000s digit is odd and the last 5 digits are 32 times an odd number
65The number is a multiple of 5 and 13 at the same time
66The number is a multiple of 2, 3 and 11 at the same time
67The difference between 20 times the last digit and the rest of the number is a multiple of 67
68The number is a multiple of 4 and 17 at the same time
69The number is a multiple of 3 and 23 at the same time
70The number is a multiple of 7 and 10 at the same time
71The difference between 7 times the last digit and the rest of the number is a multiple of 71
72The number is a multiple of 8 and 9 at the same time
73The sum of 22 times the last digit and the rest of the number is a multiple of 73
74The number is a multiple of 2 and 37 at the same time
75The number is a multiple of 3 and 25 at the same time
76The number is a multiple of 4 and 19 at the same time
77The number is a multiple of 7 and 11 at the same time
78The number is a multiple of 2, 3 and 13 at the same time
79The sum of 8 times the last digit and the rest of the number is a multiple of 79
80The 1,000s digit is even and the last 3 digits are a multiple of 80 or the 1,000s digit is odd and the last 3 digits are 40 times an odd number
81The difference between 8 times the last digit and the rest of the number is a multiple of 81
82The number is a multiple of 2 and 41 at the same time
83The sum of 25 times the last digit and the rest of the number is a multiple of 83
84The number is a multiple of 3, 4 and 7 at the same time
85The number is a multiple of 5 and 17 at the same time
86The number is a multiple of 2 and 43 at the same time
87The number is a multiple of 3 and 29 at the same time
88The number is a multiple of 8 and 11 at the same time
89The sum of 9 times the last digit and the rest of the number is a multiple of 89
90The number is a multiple of 9 and 10 at the same time
91The number is a multiple of 7 and 13 at the same time
92The number is a multiple of 4 and 23 at the same time
93The number is a multiple of 3 and 31 at the same time
94The number is a multiple of 2 and 47 at the same time
95The number is a multiple of 5 and 19 at the same time
96The number is a multiple of 3 and 32 at the same time
97The difference between 29 times the last digit and the rest of the number is a multiple of 97
98The number is a multiple of 2 and 49 at the same time
99The number is a multiple of 9 and 11 at the same time
100The number ends in 00

2 Comments
2024/03/15
16:50 UTC

0

Mastering the Art of End-of-Semester Exams: 10 Strategies for Success

0 Comments
2024/03/15
13:41 UTC

3

Looking for fast mex code

The mex of a set is the smallest nonnegative integer not in the set.

I have sorted lists with a half million integers, and my code for the mex (MemberQ inside a whole loop) is the slowest part of my computation. Any suggestions for a faster way to do this?

Mex[A_List] := Module[{k = 0}, While[MemberQ[A, k], k++]; k]
15 Comments
2024/03/12
23:06 UTC

0

Transforming Fast Food into Study Hacks

0 Comments
2024/03/12
13:13 UTC

Back To Top