Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

simple example of printing a C version of a SymPy expression:

expr = (Rational(-1, 2) * Z * k * (e**2) / r)
>>> expr
    2
-Z⋅e ⋅k
────────
  2⋅r
>>> ccode(expr)
-1.0/2.0*Z*pow(e, 2)*k/r
>>> from sympy.codegen.ast import real, float80
>>> ccode(expr, assign_to="E", type_aliases={real: float80})
E = -1.0L/2.0L*Z*powl(e, 2)*k/r;
Comment

PREVIOUS NEXT
Code Example
Python :: pandas read csv read all columns except few columns 
Python :: algorithme pour afficher table de multiplication python 
Python :: split() method, sep=i, n=veces aplicado 
Python :: where are spacy models stored 
Python :: download python for windows 7 32 bits 
Python :: Creating sub elements in xml in python with ElementTree 
Python :: how to add a list to a list python 
Python :: how to print a character n times in python 
Python :: python unsigned to signed integer 
Python :: how to make an application using python 
Python :: unique items in a list python 
Python :: python index 
Python :: python polymorphism 
Python :: python code to press a key 
Python :: docker python 3.11 
Python :: python difference 
Python :: list arguments of function python 
Python :: how to plot using pyplot 
Python :: python array use numpy arange 
Python :: runserver coomand in django 
Python :: python re 
Python :: print dataframe name python 
Python :: string functions 
Python :: scaling 
Python :: IndexError: list assignment index out of range 
Python :: python os.walk 
Python :: python if loop 
Python :: eval() function in python 
Python :: Math Module floor() Function in python 
Python :: python loop 3 times 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =