4,479 questions
0
votes
0
answers
50
views
Parallel Equations Expansion in TFORM
TFORM is considered a great tool for manipulating large and symbolic equations. In this thread, I’d like to share my optimization problem, which concerns a very simple operation — equations expansion.
...
1
vote
1
answer
92
views
Trouble Plotting short term Solution on Maple
I’m trying to solve a problem from Modern Mathematical Methods for Scientists and Engineers using Maple, specifically applying the Fokas method (Unified Transform) to the heat equation on the half-...
0
votes
0
answers
60
views
Evaluation of a function within a function in Mathematica
I apologise if the answer to my question is facile, but I'm new to Mathematica and normally use Matlab.
I have two variables that I define as follows:
delta = Sqrt[u^2 - 4DC(theta - lambda)];
xi = ...
0
votes
0
answers
40
views
Customized Chart Element Function for Box Plots in Mathematica
I am trying to make a box chart for four data sets with the data points shown on each box. This can be done using the Chart Element Function (CEF). I need a custom pointstyling detailed below.
...
0
votes
1
answer
83
views
Legendre function comparison between mpmath and Mathematica
I am working on a project and I would like to make sure I use Legendre function correctly. I've made a simple comparison between mpmath and Mathematica and the results are different:
For mpmath in ...
1
vote
1
answer
55
views
How to store the first parameter of Block in a variable?
Let's say I have a function
MyFunc[x_] := x + y
I can do this:
Block[{y = 1}, MyFunc[1]]
which gives the result 2 correctly.
Now, what to do if I want to save {y = 1} into a variable, something like
...
0
votes
0
answers
98
views
How to solve this complex equation in MATHEMATICA?
I am trying to solve a complex integral equation including an infinite continued fraction.
Continued fraction to order n=50
$Version
(*14.2.0 for Microsoft Windows (64-bit) (December 26, 2024)*)
...
1
vote
0
answers
146
views
How fix error in Mathematica "NDSolve::ndsz: At t == ... step size is effectively zero; singularity or stiff system suspected" when using Manipulate?
I am trying to solve a nonlinear system of differential equations in Wolfram Mathematica using NDSolve and visualize the solution with Manipulate. However, I encounter the following error when running ...
0
votes
1
answer
53
views
Generation of particular combinations
In Mathematica I implemented this simple code:
n = 8;
a0 = Range[0, n - 1];
a1 = Subsets[a0, {2}];
a2 = Subsets[a1, {2}];
a3 = Select[a2, Length[Union[Flatten[#]]] == 4 &];
a4 = Subsets[a3, {n/4}];...
2
votes
1
answer
489
views
Running Wolfram Engine in Visual Studio Code
I downloaded the Wolfram Engine and have verified that it works by running it in the terminal.
I also downloaded a VSC extension for the Wolfram Langauge: https://github.com/WolframResearch/vscode-...
1
vote
0
answers
61
views
Reading and resaving in a file a matrix with the same name but with different dimensions with Mathematica
My main code runs a large program and saves the results in a text-like notebook (Put[...] & Save[...]) that contains result matrices, like e.g.,
tab1 = {{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {...
0
votes
0
answers
51
views
What should be the data format for a neural network with 2 inputs and a scalar output
I have a very simple network model: two named input ports, one summing layer, one linear layer and a scalar output. Despite many attempts, I cannot select a suitable data format that would be accepted ...
0
votes
0
answers
136
views
Getting a Asymptote 3D graph look more like Mathematica's
I am trying to get Mathics3 to produce Asymptote output that more closely matches what Mathematica produces.
Here is an example of Mathematica output for Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}]:
and ...
-1
votes
1
answer
110
views
Solve complicated equation in Mathematica
I have a complicated equation and I wanna solve it with Mathematica. But, Because of the equation form I can't find analytical solution. So I try to solve it numerically. I try some method but can't ...
0
votes
0
answers
50
views
Cannot Clear K[r] with Clear["Global`*"]
Why doesn't the following simple code reset K[r]?
In[1]:=$Context
K[r]=4r;
Clear["Global`*"];
K[r]
Out[1]=Global`
Out[4]=4r
If I use, say, A[r] or B[r] instead of K[r], they get cleared. ...
0
votes
0
answers
28
views
Accessing Mathematica from Python
I am trying to use some of the tools available in Mathematica within a Python program (or jupyter notebook) that I am writing.
I have already done:
pip install wolframclient
on my computer and this ...
0
votes
1
answer
129
views
Sympy running without providing solution given initial conditions
I have 2 differential equations I am trying to solve. Running the code below takes about an hour on my computer before it outputs a very long equation if i do not include the initial conditions. I ...
0
votes
0
answers
65
views
Negative Eigenvalues of the Woods-Saxon Nuclear Potential for Oxygen ND Eigensystem
I am trying to use ND Eigensystem to find the eigenvalues of the Woods-Saxon Potential Schroedinger Equation for Oxygen. I've defined the potential and operator, but I know the functions given are ...
1
vote
1
answer
46
views
How do I get Mathematica not to multiply a vector by a scalar elementwise, but leave it as the scalar times the vector
In Mathematica I have the variable u defined as follows:
u = {1,2,3}
Now I want the product a*u to show as:
a {1,2,3}
but a*u returns this:
{a,2 a,3 a}
I have tried HoldForm and other things, but I ...
3
votes
1
answer
53
views
Number of pixels in perimetric complexity measure is not working in R
I am currently trying to use the EBImage package in R (see article here) to get the perimeters and areas of binary images. Specifically, I'm trying to do this for English and Chinese characters. Below ...
1
vote
1
answer
83
views
How to count the number of words in WordList[] that starts with "q"
This question is from the "Elementary Introduction to the Wolfram Language", when dealing with the String and Text. I think there must be easier ways to solve this. Would you guys give me ...
0
votes
1
answer
70
views
How to solve truth tables in Wolfram Alpha? [closed]
How can I build a truth table out of this formula in Wolfram Alpha:
((A and(if B then C)) or (C and not A))
0
votes
1
answer
134
views
Conjugate function in Wolfram Mathematica does not work for long sums
I need to conjugate some sum of terms. Wolfram Mathematica does this for short sums, but not for long ones.
Click here to see a screenshot of Wolfram Mathematica with formatted code.
Raw code:
Ass = ...
0
votes
1
answer
60
views
Issue Using NIntegrate Function in NDSolve
I am stuck in an attempt to pass an interpolating function that was generated from a PDE solved using NDSolveValue to a second call to NDSolveValue for a solution to a simple ODE. Here is my code for ...
1
vote
1
answer
55
views
Tag list is protected in Mathematica
I am trying to run the following code in Mathematica.
Sol1 = DSolve[{S'[t] == D - Er - Es*S[t], S[0] == 1}, S[t], t]
plots = Table[
Evaluate[
S[t] /. Sol1 /. {D -> d, Er -> er, Es -> es}...
0
votes
1
answer
86
views
Is there a way to specify integer arguments while integrating in Mathematica
I am trying to evaluate the following integral in Mathematica:
Integrate[u ^(m + 1)*Exp[-(u^2)/(2*rho)]*(u^2 - eps)^(j + k/2 - 1) , {u, Sqrt[eps],Infinity}]
I want to specify that for me, m and j are ...
1
vote
0
answers
69
views
Solution to v - discrepencies between sympy and mathematica
I wrote a program:
import sympy as sp
# Define symbols
l, alpha, x, gamma, r, theta, beta, v = sp.symbols('l alpha x gamma r theta beta v')
c = 2.99792458 * 10**8
# Define the equation
lhs = l * sp....
0
votes
1
answer
107
views
Solve a Vector Polynomial Equation
So I am trying to symbolically solve a polynomial equation in mathematica that is described with vectors:
A = {Subscript[a, 0], Subscript[a, 1], Subscript[a, 2]}
B = {Subscript[b, 0], Subscript[b, 1], ...
0
votes
0
answers
85
views
Finding Local/Global Maxima of high-dimensional function in Mathematica
I am trying to find the local/global maxima of a function. This function is computed by taking the trace of a 64x64 matrix and summing over a bunch of indices. With my current implementation I have 90 ...
0
votes
0
answers
77
views
Floating Point Precision Error or Algorithm Error?
I've implemented Fraction and Polynomial classes to simulate the mathematical operations that may be applied to them. The Fraction class was mainly implemented so that numbers like 2 / 3 will be ...
0
votes
0
answers
24
views
GammaMaP package symbolic output
I'm new in Mathematica and I've just installed the GammaMaP package. The problem is that I'm not getting the a symbolic output like in the documentation, for example, if I create a cell with the code ...
0
votes
0
answers
84
views
Different answer for numerical integral from nquad and Mathematica
I am trying to write a function that returns the numerical answer of a very complicated integral. I have the following code
import numpy as np
import scipy as sp
import sympy as smp
import matplotlib....
0
votes
1
answer
129
views
Can you create an array/vector of arbitrary length in Mathematica/Wolfram language?
I am working on a small proof/demonstration of how the least squares method gives us the arithmetic mean.
Wolfram Language 14.0.0 Engine for Microsoft Windows (64-bit)
Copyright 1988-2023 Wolfram ...
2
votes
1
answer
148
views
Efficient scipy sparse array and kronecker product computation
I want to compute the Kronecker product of a long list of small matrices (say, Pauli matrices). I tried to define the small matrices using scipy.sparse.csr_array, and use scipy.sparse.kron to perform ...
0
votes
2
answers
253
views
How to convert output cells to text within Jupyter?
The screenshot shown is a Jupyter notebook running a Wolfram Engine kernel. There are two problems: a) The output cells are images, preventing copying to the clipboard. b) Some expressions within them ...
0
votes
0
answers
73
views
Why does Mathematica says it didn't create a context when Needs was evaluated but it does?
In Mathematica 14.0.0 (MacOS Sonoma 14.4.1) I made a simple package consisting of two "sub packages". One of them is loaded as "private" from with the main package:
The package ...
1
vote
0
answers
46
views
Having problems with diffraction pattern generation in mathematica
I am unsure about the results, but is it possible to generate diffraction pattern like following in the second picture. The following equation is like this added in the first picture for different ...
1
vote
0
answers
45
views
Taking a rectangular region from 3D graphics in mathematica
this feels like an easy question, but I want to specify a 2D "window" on a 3D plot, so it fills the rectangle...
So many options to try (and the underlying image has lots of Graphics3D ...
0
votes
1
answer
98
views
Hypergeometric functions matlab
I want to use the hypergeometric function:
this exists in Mathematica (Wolfram)...
]
...and Python docs link.
I cant find the equivalent in MATLAB, does it exist? If not is there a way to use ...
2
votes
1
answer
91
views
How to Install NetLogo v 6.4.0 Mathematica Link?
EnteringNLStart[ "/Applications/NetLogo 6.4.0/" ]after installing netlogo.m as/Users/my_name/Library/Mathematica/Applications/NetLogo.wl returns the message
NetLogo could not be found in: /...
1
vote
0
answers
39
views
Matlab: bvp5c with inconsistent eigenvalues
I'm trying to solve an boundary value problem with eigenvalues, following the article ( https://doi.org/10.1063/5.0155331 )
equation
where α and At are certain numbers and Q(σ) is a known function, ...
0
votes
3
answers
190
views
Mathematica's Nothing for Python lists, tuples and dictionaries [duplicate]
Mathematica has an object called Nothing that when put into a list automatically disappears.
For example, {a, b, Nothing, c, d, Nothing} automatically evaluates to {a, b, c, d}.
Does something ...
0
votes
2
answers
53
views
type definition of mint in OpenCL seems to be wrong in MacOS
Consider the the following small script running with Mathematica 14.0.0 on Mac OS X ARM (64 bit) 14.4.1 (23E224)
In[155]:= src = "
__kernel void addTwo(__global mint* arry, mint len) {
int ...
0
votes
0
answers
43
views
Why does `Divide` have the higher precedence than `Times` in Wolfram Mathematica 14.0?
I noticed that for the input a*b/c, b/c is evaluated first, and then a*(b/c).
In[1]:=FullForm@Hold[a*b/c]
Out[1]=Hold[Times[a,Times[b,Power[c,-1]]]]
But I don't know why.
Later I found a built-in ...
0
votes
0
answers
93
views
How to convert Mathematica code to Python code
How to convert the following Mathematica code to Python
NDSolve[{1/(1 - f)^2.5*g''''[y] +
G*Sin[\[Alpha]]*((1 - f) + f*(p1*e1)/(p2*e2))*
t'[y] - (((M^2)*A)/(1 + (A*m)^2) + 1/(k*(1 - ...
-2
votes
1
answer
75
views
Long definite integral
I'm trying to compue the following integral on the interval $[0,\pi]$ on the $\theta$ variable.
(1/(4 Sqrt[2] r0^4 (Cos[\[Theta]]^6 + Sin[\[Theta]]^6)^(
13/6)))(5 + 3 Cos[4 \[Theta]])^(
1/6) (4 (Cos[...
0
votes
0
answers
46
views
no simplify option for expression written under Defer[] enviroment
I am new to Mathematica. I have defined following functions
p[k_, j_, n_] :=
9 2^11 2^(6 j) k^6 - 3 2^6 2^(4 j) k^4 + 5 2^2 2^(2 j) k^2 - (n + 1)
q[j_, n_] :=
Defer[1/(24 2^(j - 1) Sqrt[2]) Sqrt[
...
0
votes
1
answer
64
views
I'm trying to plot surfaces in Mathematica withContourPlot3D I'm getting inconsistent results; proably syntax
I frequently can't get it to plot anything and the output is the same as the input.
After messing with it sometimes I'm able to get it to plot but I have no clue what I'm changing. I'm trying to plot ...
0
votes
0
answers
45
views
Difference between Rule and Pattern
Please, explain me the main difference between the Rule and the Pattern in the following examples:
Why we are got the different results for -> and :>?
Another one thing I want to reproduce is ...
0
votes
1
answer
98
views
How to use python imshow, for example, with the irregular data points?
Suppose I have a list of data points of the form (xi, yi, zi) and I want to plot a 2D density plot with it. In mathematica, you just call the function ListDensityPlot function. In python, it seems ...