MultiProcessing for Simple Equations

49 views
Skip to first unread message

docstar77 .

unread,
May 9, 2017, 6:43:15 PM5/9/17
to sy...@googlegroups.com
Im wondering if anyone cant tell me if multiprocessing can be used to speed
up equation solving for calculating really large numbers without having to use a
user defined function?  Im trying to run a routine either in python 3.4 IDLE or as a simple script.  The below takes an average of about 10 seconds to perform...
Id like to speed this up as much  as possible.  If I import multiprocessessing 
and if I use a pool ( I have two CPUS on my system), it seems the only thing
that  all the docs refer to is using this via a function (def), is there a way  to 
dump the below to multiprocessing with out having  to do that?  If  I cant do that
- can someone give me a code tip on how to wrap the below in a function statement that  will work in idle or as a script?  Am new to python and also to Sympy.....  thanks  for any feedback you can offer.  See code below ;

..............................

import sys
from sympy import mpmath
from mpmath import *
mpmath.mp.dps = 20000

import time
e0=time.time()
c0=time.clock()

xxx = mpmath.power(1.41, 0.249429034 * 4500)
xy1 = xxx * 110.4807667
result1a = '%.2f'%((xy1) % 1080)
print(result1a)

elapsed_time=time.time() -e0
cpu_time=time.clock() -c0
print(cpu_time)
Reply all
Reply to author
Forward
0 new messages