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.

Useful Links:

  • Pythonika package providing a Python Interpreter Interface for Mathematica
  • SymPy, a Python library for symbolic mathematics.
251 questions
7
votes
2 answers

Convert python Code To Mathematica?

Is there a way to convert simple python code to Mathematica code
Ali_Ali
  • 87
  • 5
7
votes
3 answers

Run Python with package NumPy in Mathematica

For example, if I have a Python script called simple.py that contains code as simple as a=1 print(a) then RunProcess[{"python", "E:\\w\\simple.py"}] is OK and gives <|"ExitCode" -> 0, "StandardOutput" -> "1 ", "StandardError" -> ""|> However,…
matheorem
  • 17,132
  • 8
  • 45
  • 115
5
votes
1 answer

ExternalEvaluate of Python do not work (Anaconda)

I cannot get the ExternalEvaluate work for my Python. It says "missing dependencies" for the registration status. I have attached screenshots from Mathematica and Terminal. From the terminal screenshot you can see that I already have "pyzmq"…
baker
  • 453
  • 3
  • 6
5
votes
1 answer

Equivalent of "for X in [list]" or "foreach"

In Python, we can evaluate an expression over specific values of x in a list. Example: a = [4,5,6] # this is a list x = range(len(a)) # this is pointer for i in x: print a[i] # should print a[] elements Many other languages call this operation…
Rene Duchamp
  • 1,419
  • 10
  • 20
5
votes
0 answers

A general question about integrating MMA objects into a python workflow

I recently built a classifier using the built-in Classify command in MMA v11.01. We are exploring the feasibility of using python-based workflow (to be consistent with our company practice) that would allow us to use this model (a neural net) to…
MSC02476
  • 699
  • 4
  • 12
4
votes
1 answer

apply python's sympy function in mathematica

I recently try this $$\int\frac{\mathop{\rm Si}(x)}x\,dx$$ Mathematica failed to calculate it. Integrate[SinIntegral[x]/x, x] Mma 11.3 failed,but 12.0 can do it. Sympy gives the answer from sympy import * x = symbols("x") print(integrate(Si(x)/x,…
AsukaMinato
  • 9,758
  • 1
  • 14
  • 40
4
votes
0 answers

Convert Mathematica Code To Python

Is there a way to convert Mathematica code to run in Python without running a Mathematica kernel in 2019? I have a long complicated code in Mathematica I would like to run in Python. However due to licensing I won't have access to Mathematica for…
Topology21
  • 41
  • 2
4
votes
0 answers

Why do Python modules load differently via Mathematica?

It's a steep learning curve trying to integrate Mathematica with Python's modules/library. I am using a Raspberry Pi 3 with Mathematica's Wolfram command line. I know little about both platforms (so clearly Wolfram's genius/strategy is working on…
berrynice
  • 163
  • 6
3
votes
0 answers

How add channel for wolframclient using conda?

I want to use the wolframclient Python package in Mathematica. The docs suggest using pip install wolframclient. However, my main Python installation is within conda, so I do not want to use pip, but instead a standard conda install wolframclient.…
murray
  • 11,888
  • 2
  • 26
  • 50
2
votes
1 answer

Python's ':' equivalent in mathematica

I need to translate these two lines to mathematica from python gamma = np.array([u/np.linalg.norm(u) for u in x[:y]]) beta = np.array([u/np.linalg.norm(u) for u in x[y:]]) where y is a number.
abc
  • 31
  • 1
2
votes
1 answer

How to run Python script with an argument?

I want to run Python script with argument 'arg' > python app.py arg Without 'arg' it works like session = StartExternalSession["Python"]; ExternalEvaluate[session, File["app.py"]]; but I don't understend how to add 'arg'.
Rodion Stepanov
  • 815
  • 5
  • 10
1
vote
0 answers

ExternalEvaluate not working for Python

I tried installing the necessary packages and apparently anaconda already had it. When I ran the FindExternalEvaluator command I got But when I ran ExternalEvaluate["Python", "2+2"], it said "No Wolfram Language translation found." What am I doing…
Dan
  • 105
  • 5
1
vote
0 answers

Listing variable attributes and methods (python dir() function translation)

Is it possible to list the attributes/methods available to variables in mathematica in a similar way that python does? For instance in python I can run my_var = "some string" print(dir(my_var)) and see printed: ['__add__', '__class__',…
Reedinationer
  • 255
  • 1
  • 10
1
vote
0 answers

Mathematica and Python integration?

Possible Duplicate: Is there a way to run Python from within Mathematica? I do see the latest version has R-link: http://www.wolfram.co.uk/mathematica/new-in-9/built-in-integration-with-r/ Is it possible to integrate with Python as I have not…
sebastian c.
  • 1,973
  • 2
  • 18
  • 27
0
votes
1 answer

Convert Mathematica expression to Python expression

I really need to convert this expression to python language, however I am having trouble converting Bessel function (Actually I have several similar expression and to know how to convert really would help me )
1
2