/r/Mathematica
For information and tips about Mathematica features.
related reddits:
/r/Mathematica
Has anyone found a solution to this?
AudioCapture[] returns...
$AudioInputDevices returns...
Lookup[FFmpegTools`Audio`AudioDevices[], "InputDevice"]
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.
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]
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]
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?
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 :(
! 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!
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"]]
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.
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?
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.
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!
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?
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.
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.
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
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.
Number | Rule |
---|---|
1 | Any number is a multiple of 1 |
2 | The number ends in 0, 2, 4, 6 or 8 |
3 | The sum of the digits is a multiple of 3 |
4 | The 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 |
5 | The number ends in 0 or 5 |
6 | The number is a multiple of 2 and 3 at the same time |
7 | The difference between twice the last digit and the rest of the number is a multiple of 7 |
8 | The 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 |
9 | The sum of the digits is a multiple of 9 |
10 | The number ends in 0 |
11 | The difference between the last digit and the rest of the number is a multiple of 11 |
12 | The number is a multiple of 3 and 4 at the same time |
13 | The sum of 4 times the last digit and the rest of the number is a multiple of 13 |
14 | The number is a multiple of 2 and 7 at the same time |
15 | The number is a multiple of 3 and 5 at the same time |
16 | The 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 |
17 | The difference between 5 times the last digit and the rest of the number is a multiple of 17 |
18 | The number is a multiple of 2 and 9 at the same time |
19 | The sum of twice the last digit and the rest of the number is a multiple of 19 |
20 | The number ends in 00, 20, 40, 60 or 80 |
21 | The number is a multiple of 3 and 7 at the same time |
22 | The number is a multiple of 2 and 11 at the same time |
23 | The sum of 7 times the last digit and the rest of the number is a multiple of 23 |
24 | The number is a multiple of 3 and 8 at the same time |
25 | The number ends in 00, 25, 50 or 75 |
26 | The number is a multiple of 2 and 13 at the same time |
27 | The difference between 8 times the last digit and the rest of the number is a multiple of 27 |
28 | The number is a multiple of 4 and 7 at the same time |
29 | The sum of thrice the last digit and the rest of the number is a multiple of 29 |
30 | The number is a multiple of 3 and 10 at the same time |
31 | The difference between thrice the last digit and the rest of the number is a multiple of 31 |
32 | The 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 |
33 | The number is a multiple of 3 and 11 at the same time |
34 | The number is a multiple of 2 and 17 at the same time |
35 | The number is a multiple of 5 and 7 at the same time |
36 | The number is a multiple of 4 and 9 at the same time |
37 | The difference between 11 times the last digit and the rest of the number is a multiple of 37 |
38 | The number is a multiple of 2 and 19 at the same time |
39 | The number is a multiple of 3 and 13 at the same time |
40 | The 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 |
41 | The difference between 4 times the last digit and the rest of the number is a multiple of 41 |
42 | The number is a multiple of 2, 3 and 7 at the same time |
43 | The sum of 13 times the last digit and the rest of the number is a multiple of 43 |
44 | The number is a multiple of 4 and 11 at the same time |
45 | The number is a multiple of 5 and 9 at the same time |
46 | The number is a multiple of 2 and 23 at the same time |
47 | The difference between 14 times the last digit and the rest of the number is a multiple of 47 |
48 | The number is a multiple of 3 and 16 at the same time |
49 | The sum of 5 times the last digit and the rest of the number is a multiple of 49 |
50 | The number ends in 00 or 50 |
51 | The number is a multiple of 3 and 17 at the same time |
52 | The number is a multiple of 4 and 13 at the same time |
53 | The sum of 16 times the last digit and the rest of the number is a multiple of 53 |
54 | The number is a multiple of 2 and 27 at the same time |
55 | The number is a multiple of 5 and 11 at the same time |
56 | The number is a multiple of 7 and 8 at the same time |
57 | The number is a multiple of 3 and 19 at the same time |
58 | The number is a multiple of 2 and 29 at the same time |
59 | The sum of 6 times the last digit and the rest of the number is a multiple of 59 |
60 | The number is a multiple of 3 and 20 at the same time |
61 | The difference between 6 times the last digit and the rest of the number is a multiple of 61 |
62 | The number is a multiple of 2 and 31 at the same time |
63 | The number is a multiple of 7 and 9 at the same time |
64 | The 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 |
65 | The number is a multiple of 5 and 13 at the same time |
66 | The number is a multiple of 2, 3 and 11 at the same time |
67 | The difference between 20 times the last digit and the rest of the number is a multiple of 67 |
68 | The number is a multiple of 4 and 17 at the same time |
69 | The number is a multiple of 3 and 23 at the same time |
70 | The number is a multiple of 7 and 10 at the same time |
71 | The difference between 7 times the last digit and the rest of the number is a multiple of 71 |
72 | The number is a multiple of 8 and 9 at the same time |
73 | The sum of 22 times the last digit and the rest of the number is a multiple of 73 |
74 | The number is a multiple of 2 and 37 at the same time |
75 | The number is a multiple of 3 and 25 at the same time |
76 | The number is a multiple of 4 and 19 at the same time |
77 | The number is a multiple of 7 and 11 at the same time |
78 | The number is a multiple of 2, 3 and 13 at the same time |
79 | The sum of 8 times the last digit and the rest of the number is a multiple of 79 |
80 | The 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 |
81 | The difference between 8 times the last digit and the rest of the number is a multiple of 81 |
82 | The number is a multiple of 2 and 41 at the same time |
83 | The sum of 25 times the last digit and the rest of the number is a multiple of 83 |
84 | The number is a multiple of 3, 4 and 7 at the same time |
85 | The number is a multiple of 5 and 17 at the same time |
86 | The number is a multiple of 2 and 43 at the same time |
87 | The number is a multiple of 3 and 29 at the same time |
88 | The number is a multiple of 8 and 11 at the same time |
89 | The sum of 9 times the last digit and the rest of the number is a multiple of 89 |
90 | The number is a multiple of 9 and 10 at the same time |
91 | The number is a multiple of 7 and 13 at the same time |
92 | The number is a multiple of 4 and 23 at the same time |
93 | The number is a multiple of 3 and 31 at the same time |
94 | The number is a multiple of 2 and 47 at the same time |
95 | The number is a multiple of 5 and 19 at the same time |
96 | The number is a multiple of 3 and 32 at the same time |
97 | The difference between 29 times the last digit and the rest of the number is a multiple of 97 |
98 | The number is a multiple of 2 and 49 at the same time |
99 | The number is a multiple of 9 and 11 at the same time |
100 | The number ends in 00 |
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]