Skip to main content

Questions tagged [python]

Questions about interfacing with, or features inspired or demonstrated by Python--a programming language featuring a dynamic type system, automatic memory management, and a comprehensive standard library.

Filter by
Sorted by
Tagged with
0 votes
0 answers
47 views

How can I export giant mathematical equations as python functions?

My symbolic equation takes up 500 mb of memory on Mathematica and I would like to work with it on python, is there an easy way to export this so I don't take a month of my life typing it out? For a ...
cheekylittleduck's user avatar
7 votes
2 answers
542 views

How can I pass a float variable from Python to Wolfram Kernel?

I want to do something like this: ...
Haoen Zhang's user avatar
3 votes
1 answer
92 views

How to Convert WLSymbolFactory to Python String?

I'm trying to simulate with python and Mathematica, Python need to generate and save some pictures to the directory of current mma notebook, I know the function that ...
Yao Li's user avatar
  • 111
0 votes
1 answer
52 views

Export algebraic expression to Python with special functions

I have an enormous algebraic expression in Mathematica that I want to export to Python. The expression per se is not complicated, more like a polynomial, but it contains some special functions defined ...
SNC92's user avatar
  • 63
3 votes
0 answers
33 views

Mathematica call CompiledFunction from Python with Listable and Parrallelization attributes

I have a CompiledFunction e.g. this: ...
Okarin's user avatar
  • 31
1 vote
1 answer
38 views

Using ExternalObjects for python iterators

Iterators are a common pattern in python. A trivial example is: example = iter(("apple", "banana", "cherry")) next(example) (yes, of ...
Joshua Schrier's user avatar
0 votes
0 answers
65 views

How do you rate Mathematica and Python in terms of numerical computation? [duplicate]

I often hear, in the physics community, that python is faster and overall better than mathematica for numeric calculations. But this seems very subjective since code badly written in one language can ...
Felipe's user avatar
  • 499
0 votes
1 answer
40 views

What is the fastest way to change Python environment?

We can see all registered Python environments through FindExternalEvaluators["Python"]. But the user interface will use the last registered one. How to ...
Alexey Golyshev's user avatar
1 vote
1 answer
80 views

Removing notebook cache from ExternalEvaluate

Question While working with Python's ExternalEvaluate the intermediate calculation results with Python are stored in the notebook. (...
Anton Antonov's user avatar
2 votes
1 answer
196 views

Python Code to Mathematica for Classical Map of Kicked Top

I am trying to convert this Python code for Classical map of kicked top to Mathematica. For a single trajectory, I am able to ...
user444's user avatar
  • 2,550
1 vote
0 answers
116 views

Convert a string of Python expression into Mathematica expression within Mathematica

While there are many ways to convert a Mathematica expression into other Languages, I was wondering if there is something reverse for Python. There are some discussions in Python groups, but I am ...
BabaYaga's user avatar
  • 1,897
1 vote
1 answer
184 views

Performance of polynomial functions in Mathematica vs Python [closed]

I am trying to compare the performance of Mathematica vs Python for vectorized operations involving polynomials. The data is floatMatrix which has dimensions (...
mmen's user avatar
  • 163
1 vote
0 answers
28 views

Python external evaluator missing first print

Can you confirm this bug when evaluating Python code in Mathmatica? Type > select Python by clicking on the icon on the left then paste the following code and ...
azerbajdzan's user avatar
  • 19.7k
0 votes
0 answers
24 views

Why is ExternalEvaluate running the command Quantity[471.04`, "Kilobytes"] on RaspberryPi

Raspberry Pi 4B with 32 bit Raspberry Pi OS Full: Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux Mathematica for Raspberry Pi 13.1 The command ...
Rudy Potter's user avatar
  • 2,582
0 votes
0 answers
115 views

Where is the Python distribution pre-installed with Wolfram?

I am using the latest version 13.3, does Wolfram comes preinstalled with a python kernel/distribution? I heard that some of the currently working features like sqlite connectivity uses python code, so ...
user13892's user avatar
  • 9,443
0 votes
0 answers
130 views

Mathematica Client Library for Python sometimes can't communicate with Kernel

I have been using the Mathematica client library for Python, but it errors at random some times when running the program, returning: wolframclient.exception.WolframKernelException: Failed to ...
Vibbbb's user avatar
  • 1
3 votes
1 answer
202 views

How to get matplotlib-type ticks? [closed]

Consider the following plot, obtained with the Python plotting library matplotlib: Is it possible to get the plot ticks to have this same style in a Mathematica ...
sam wolfe's user avatar
  • 4,873
0 votes
0 answers
84 views

How to pass variables from Python to Mathematica?

I have a Mathematica code that I want to run via Python using subprocess. The Mathematica code contains two variables that I want to pass through Python. However, when I tried to do that, I always got ...
j.doe's user avatar
  • 123
10 votes
0 answers
288 views

Mathematica 13.3 breaks old socket code

Edit 1: A support case with the identification [CASE:5059026] was created. Edit 2: This has just been confirmed as a bug by Wolfram Research. I have just heard back from Wolfram Research. They have ...
Shredderroy's user avatar
  • 5,251
6 votes
0 answers
747 views

Code for quasi 1D nozzle flows

The quasi-one-dimensional model describing the flow of compressible gas in rocket nozzles is very common. The corresponding equations have a divergent non dimensional form $ \frac{\partial \mathbf{U}}...
Alex Trounev's user avatar
  • 45.8k
8 votes
3 answers
857 views

How to pass values to Python?

I would like to pass Mathematica variable values to Python. But I found that it was not that trivial. For example, a typical way would be: ...
Satoshi Oota's user avatar
3 votes
0 answers
113 views

Using Mathematica ML models in another application

Using Mathematica, I trained and exported some machine learning models with the suggested file extension .wmlf. However, I noticed that these files are stored in HDF5 format. How can I import these ...
Jeremy L's user avatar
5 votes
2 answers
362 views

Is there a built-in equivalent to numpy's fftfreq?

I recently learned that python's numpy package contains a function called fftfreq (documented at numpy.fft.fftfreq) which is ...
Emilio Pisanty's user avatar
2 votes
0 answers
148 views

Convert Wolfram to Python [closed]

Is there any way for python to generate a list and then find a function based on it just like how FindFit works in Wolfram? Preferably I would like the solution to work on Replit or Google Colab. ...
ABRAMOVICH OZ's user avatar
1 vote
0 answers
101 views

How to import specific Python Libraries using External Evaluate

I want to use specific python libraries via the Mathematica frontend. This is possible as follows ...
Asim's user avatar
  • 1,150
3 votes
0 answers
175 views

Can Mathematica's Minimize() function be called inside Python code using Python data?

Summary: I would like to use the Wolfram Client Library for Python to invoke Mathematica's Minimize function directly from within Python, passing to it Python data structures. Details: I have a Python ...
Neil Fazel's user avatar
1 vote
0 answers
41 views

Python np.gradient in Mathematica [duplicate]

Very quick and dirty question. I'm trying to write a program written in python into mathematica and there is a section that uses the gradient function in the numpty python library, ...
Koji's user avatar
  • 61
1 vote
0 answers
65 views

What are ExternalLanguage cells good for? [closed]

You can type > at the beginning of a cell (or right click and choose "insert new cell" - "ExternalLanguage") and then you can choose the ...
azerbajdzan's user avatar
  • 19.7k
6 votes
1 answer
193 views

Python compatible fortran form for complex numbers

I am trying to use the Mathematica output of a complicated expression as input for python. As suggested in this answer, the FortranForm of an expression already ...
sqrt6's user avatar
  • 63
3 votes
2 answers
416 views

Solving hyperbolic equation with parallelization in python by elucidating Mathematica algorithm [closed]

So! I have what seems like a rather basic hyperbolic equation to be solved written in Mathematica, with an integer input ‘n’, for which I am seeking the First {x,y} Integer solution to satisfy the ...
Travis Arlen McCracken's user avatar
3 votes
1 answer
499 views

How to run Wolfram language using Wolfram Client Library for Python in Google colab?

How to run the Wolfram language using Wolfram Client Library for Python in Google colab?
Mainul Islam's user avatar
3 votes
2 answers
521 views

Use python color scale in mathematica density plot

I have a python code for data analysis, that uses the "seismic" color scale for 2D density plots. However, I also need to do some other plots with Mathematica (because of packages etc), for ...
m137's user avatar
  • 357
2 votes
0 answers
94 views

How can we call Mathematica functions from another server using the `wolframscript` Python library?

How can we use the wolframclient Python library to call Mathematica functions when Mathematica is running in an another server? For example, if we have Mathematica ...
GarouDan's user avatar
  • 1,536
0 votes
0 answers
250 views

How can I call the function NSolve from Mathematica in Python?

I would like to use the NSolve function from Mathematica in a Python code to solve a polynomial system of equations. So my question is, whether there is an option to call this kind of function in a ...
Nils's user avatar
  • 1
3 votes
1 answer
165 views

WolframClient output convert to python complex array

I encountered the following issue with WolframClient. I have a my.function file which contains some function that takes some ...
Morgan's user avatar
  • 525
-1 votes
1 answer
107 views

I have a (4,4,4) dimensional array which are the distribution values. The x, y and z axis range are given. Can you plot 3d heatmap?

...
K.Tamang's user avatar
10 votes
1 answer
694 views

How to use Python functions in Mathematica functions in Python notebooks?

I want to plot things with Mathematica, inside an ipynb Python notebook. I can easily plot functions that are expressed in the Wolfram Language, e.g. with ...
JEM_Mosig's user avatar
  • 3,003
0 votes
0 answers
68 views

Error while using External Evaluator (Python)

In the above screenshot, I've shared the installed and registered version of python. However, when I try to use it, it ends up with an error. ...
user444's user avatar
  • 2,550
1 vote
2 answers
789 views

Mathematica `fourier` get different result with python `np.fft` [closed]

In python,I run fft as below: ...
kittygirl's user avatar
  • 707
7 votes
2 answers
413 views

Calling a Python class function from ExternalEvaluate

I am attempting to use ExternalEvaluate to use some python packages (ARC) to save me some effort in performing the calculations in Mathematica, and for the most part I think it works as intended. The ...
D. Brown's user avatar
  • 304
2 votes
1 answer
259 views

Wolfram Engine beginner's question: how to Sum?

I really like the idea of the Wolfram Engine, and in particular using it via the python client library. However, I've having trouble understanding the syntax for even simple commands: is there some ...
AnotherShruggingPhysicist's user avatar
2 votes
2 answers
242 views

Defining a function recursively

I want to construct polynomials (or just function) $f_n$ from $f_{n-1}$ using mathematica. For some kind of reason, I didn't manage to do this. So basically something like a recurrence table, but for ...
user3397129's user avatar
2 votes
1 answer
138 views

ExternalEvaluate not running the whole Python file

I have the following 'test.py' written in Python: import numpy as np f = open('normals.txt', 'r') content = f.read() print(content) and I want to execute it from ...
tupoliedro's user avatar
4 votes
2 answers
534 views

How to transfer a list as a Python function argument

This issue was already discussed here, but the answer is unclear yet. I use very simple Python function for converting a string list to upper case ...
Konstantin's user avatar
2 votes
0 answers
97 views

How can I import datasets from TensorFlow datasets into mathematica?

TensorFlow datasets are available at https://www.tensorflow.org/datasets. I wonder if there's a way to directly import any of those datasets directly into Mathematica 12. I tried ...
bhopshang's user avatar
  • 739
7 votes
1 answer
222 views

Exactly recreating image NetEncoder output

I need to run an exported NetChain in ONNX, surprisingly the model exports and runs successfully, but there's a discrepancy in the image loading stage (the NetEncoder'ing that must be written manually)...
user5601's user avatar
  • 3,675
4 votes
2 answers
521 views

Knn graph differences: Mathematica and sklearn

I have this data: Data file I made 8-NN graph as follows: ...
sra's user avatar
  • 717
2 votes
1 answer
189 views

Python packages inside Mathematica's notebook: problem with sympy [closed]

With Mathematica's notebook, sometimes I hit the > key at the beginning of a new line and start writing python code. I can call and use the standard package ...
Davi's user avatar
  • 671
3 votes
1 answer
180 views

Problem when translating from LaTeX to Mathematica

I have a code in Python that makes some calculations for different reaction-diffusion equations. I am trying to let the user define the variables and parameters of the system. The problem is that, for ...
edgardeitor's user avatar
3 votes
3 answers
1k views

Read sympy expression in .txt file as Mathematica input

I have a Python file that has a variable defined using sympy. For instance, let us take the following (crazy) example that I could have eventually since I am automatizing a routine: ...
edgardeitor's user avatar

1
2 3 4 5 6