![]() , 0.5 ) n = 15 #n is the number of rays drawn in a cycle h = ( float ( arg ( fz )) + pi ) / ( 2 * pi ) #hue h = ( h - 0.5 ) % 1.0 Phc = PerFract ( h, 1.0 / n, 0.6, 1 ) # set brightness between 0.6 and 1, #in order to avoid too dark colors modul = fabs ( fz ) Logm = log ( modul ) s = 0.9 #saturation Modc = PerFract ( Logm, 2 * pi / n, 0.6, 1 ) v = Modc * Phc return hsv_to_rgb ( h, s, v ) plt. This addition means that the generalized hypergeometric function is finally supported. Previously 2 F 1 (the Gaussian hypergeometric function) was supported see earlier blog posts but not 3 F 2 and higher. ![]() Utility functions: Conversion and printing. As of a recent commit, mpmath can evaluate the analytic continuation of the generalized hypergeometric function p+1 F p for any p. Also, splot can be used to produce 3D surface plots (requires matplotlib). ![]() They work not only for an arbitrarily large or small radius, but for complex values of all parameters. The functions plot and cplot in mpmath can be used to plot functions respectively as x-y graphs and in the complex plane. Until I've figured out the details, I'll share a couple of test plots. The versions in mpmath are fully general. There will probably be a 3D plot function in a future version of mpmath (or two functions for two-variable real, and complex functions), similar in style to the existing matplotlib wrappers plot and cplot. I suspect this is how it has to be done, as colormaps in matplotlib are 1D sequences and the black-white (lightness. Import matplotlib.pyplot as plt from mpmath import * from colorsys import hsv_to_rgb % matplotlib inline pi = 3.1415926535898 def PerFract ( x, t, m, M ): x = x / t return m + ( M - m ) * ( x - floor ( x )) def color_clines ( fz ): # this is the color function that replaces the #default color function implemented in mpmath.cplot if isinf ( fz ): return ( 0, 0, 1.0 ) #hsv code if isnan ( fz ): return ( 0. The Coulomb wave functions are used in quantum physics they solve the radial part of the Schrödinger equation for a particle in a 1/ r potential. The cplot function in the mpmath module does exactly this using matplotlib, but very inefficiently, as it computes the colour of each pixel in the image in hls colour-space and generates the corresponding rgb value directly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |