AI: Circle fill

This Tutorial will show you How to Fill Your Design with Random Objects and Color using Script in Adobe Illustrator. Welcome Again, In this video, I will show you how to use three useful illustrator scripts to fill your design with objects or colors randomly. here is the script.

Place scripts in folder: C:\Program Files\Adobe\Adobe Illustrator CC 2019\Presets\en_GB\Scripts

1. Circle Fill The script fills outline shapes with packed circles. Script Link:…

2. Replace with Symbol This script can exchange several objects with a symbol selected from the symbol panel in Illustrator. Script Link:…

3. Random Swatches Fill fill your artwork with random color Script Link :… Mock Up in The Video…

Hope you enjoy this tutorial, Don’t forget to leave a like and comment. Share this tutorial if you think this tutorial useful. About me – Website – Instagram – Facebook – Background Music by LAKEY INSPIRED – That Girl… LAKEY INSPIRED channel…

Accuracy of Bessel Functions in MATLAB


Contents [hide]


In previous posts we studied accuracy of computation of modified Bessel functions: K1(x)K0(x)I0(x) and I1(x). In spite of the fact that modified Bessel functions are easy to compute (they are monotonous and do not cross x-axis) we saw that MATLAB provides accuracy much lower than expected for double precision. Please refer to the pages for more details.

Today we will investigate how accurately MATLAB computes Bessel functions of the first and second kind Yn(x) and Jn(x) in double precision. Along the way, we will also check accuracy of the commonly used open source libraries.

BesselJ Functions (1st Kind, n=0,1,2)

Having extended precision routines, accuracy check of any function needs only few commands:

% Check accuracy of sine using 1M random points on (0, 16]
>> mp.Digits(34);
>> x = 16*(rand(1000000,1));
>> f = sin(x);       % call built-in function for double precision sine
>> y = sin(mp(x));   % compute sine values in quadruple precision
>> z = abs(1-f./y);  % element-wise relative error
>> max(z./eps)       % max. relative error in terms of 'eps'
ans = 
>> -log10(max(z))    % number of correct decimal digits in result
ans = 

Computed sine values have ~15.9 correct decimal places and differ from ‘true’ function values by ~0.5eps. This is the highest accuracy we can expect from double precision floating-point arithmetic.

The recent revision of IEEE 754 standard[1] recommends all elementary functions to have such highest accuracy and be correctly rounded: the result should be as if the calculation had been performed in infinite precision, and then rounded (see Table 9.1 of the standard). Computing elementary functions with correct rounding is a fascinating topic on its own, please refer to pioneering works of Gal[23], Ziv[4], recent developments by Lefèvre, Muller, Zimmermann, et al.[58] and excellent handbooks on the subject[911].

Most modern programming languages follow the IEEE 754-2008 recommendation and their standard libraries[12,13,14] compute elementary functions with correct rounding and guaranteed accuracy as we see in test above.

However special functions are not covered by the standard and software libraries for its computations are considered to be faithfully-accurate. Here we study what libraries in fact can be trusted in computing Bessel functions in double precision.

MATLAB 2016a

Basic accuracy check applied for Bessel function of the second kind – Y0(x):

% Check accuracy of bessely(0,x) using 1M random points on (0, 16]
>> f = bessely(0,x);     % built-in double precision routine
>> y = bessely(0,mp(x)); % 'true' values computed using quadruple precision
>> z = abs(1-f./y);
>> max(z./eps)           % max. relative error in terms of 'eps'
ans = 
>> -log10(max(z))        % number of correct decimal digits in result
ans = 

The problematic areas can be located using error scatter plot. Red lines show the expected limits of relative error (for convenience, we added another interval to cover whole x axis):

The spikes of error clearly coincide with zeros of Bessel function (0.8935, 3.9576, 7.0860, ... ). To test accuracy near zeros in more detail we use the following function:

function func_accuracy_check(func, x0, near_zero, n)
%func_accuracy_check - Checks accuracy of 'func' near its zero or extremum.
%  1. Routine searches for zero/extremum of 'func' starting from 'x0'
%     Extended precision is used to be sure zero/extremum is accurate. 
%  2. Relative error of 'func' is evaluated using 'n' points in close 
%     vicinity of found zero/extremum. 
%  Parameters:
%   func - function handle 
%   x0 - starting point for zero/extremum search
%   near_zero - true/false, check accuracy near zero/extremum
%   n - number of test points.
%  Usage example. 
%    Find zero of Y0(x) near x = 2 and check accuracy of the MATLAB 
%    function bessely(0,x) near found zero:
%    mp.Digits(34);
%    u = @(x) bessely(0,x);
%    func_accuracy_check(u,mp(2),true,3)
%    Output:
%    Accuracy check near zero, x = 8.9357696627916752e-01:
%    x = 8.9357696627916761e-01	correct digits =   1.5	rel. error = 1.40e+14eps
%    x = 8.9357696627916772e-01	correct digits =   0.5	rel. error = 1.50e+15eps
%    x = 8.9357696627916783e-01	correct digits =   1.0	rel. error = 4.13e+14eps
% Find root/extremum of 'func' using extended precision:
options = optimset('TolX',mp('eps')); 
if near_zero
    r = fzero(func,mp(x0),options);
    fprintf('Accuracy check near zero, x = %.16e:\n',r);    
    %g = @(x) -func(x);    
    r = fminsearch(func,mp(x0),options);
    fprintf('Accuracy check near extremum, x = %.16e:\n',r);    
% Correctly rounded zero/extremum in double precision:
x = double(r); 
for k=1:n
    % Get next floating-point value after x:
    x = nextafter(x);
    f = func(x);      % function value computed by MATLAB's built-in bessely    
    y = func(mp(x));  % 'true' function value computed in extended precision
    z = abs(1-f./y);  % relative accuracy
    fprintf('x = %.16e\tcorrect digits = %4.1f\trel. error = %5.2geps\n',x,-log10(z),z./eps);  

The nextafter(x) function computes next floating-point value just after x[15] towards infinity. We use it to generate test arguments in close neighborhood of given point.

Accuracy of bessely(0,x) near first zero of Y0(x):

>> mp.Digits(34);
>> u = @(x) bessely(0,x);
>> func_accuracy_check(u,mp(2),true,5)
Accuracy check near zero, x = 8.9357696627916752e-01:
x = 8.9357696627916761e-01  correct digits =  1.5  rel. error = 1.4e+14eps
x = 8.9357696627916772e-01  correct digits =  0.5  rel. error = 1.5e+15eps
x = 8.9357696627916783e-01  correct digits =  1.0  rel. error = 4.1e+14eps
x = 8.9357696627916794e-01  correct digits =  2.1  rel. error = 3.5e+13eps
x = 8.9357696627916805e-01  correct digits =  1.4  rel. error = 1.6e+14eps

Accuracy of bessely(0,x) near second extremum of Y0(x):

>> func_accuracy_check(u,mp(3),false,5)
Accuracy check near extremum, x = 5.4296810407941351e+00:
x = 5.4296810407941356e+00  correct digits = 15.6  rel. error =  1.10eps
x = 5.4296810407941365e+00  correct digits = 16.2  rel. error =  0.32eps
x = 5.4296810407941374e+00  correct digits = 16.0  rel. error =  0.42eps
x = 5.4296810407941383e+00  correct digits = 16.0  rel. error =  0.42eps
x = 5.4296810407941392e+00  correct digits = 15.6  rel. error =  1.10eps

MATLAB delivers minimal error near extremum but completely losses accuracy near function zero.

Same analysis can be easily repeated for J0(x):

Accuracy of besselj(0,x) near first zero of J0(x):

>> u = @(x) besselj(0,x);
>> func_accuracy_check(u,mp(2),true,5)
Accuracy check near zero, x = 2.4048255576957728e+00:
x = 2.4048255576957733e+00  correct digits =  0.6  rel. error = 1.2e+15eps
x = 2.4048255576957738e+00  correct digits =  1.0  rel. error = 4.7e+14eps
x = 2.4048255576957742e+00  correct digits =  0.8  rel. error = 7.4e+14eps
x = 2.4048255576957747e+00  correct digits =  1.9  rel. error = 5.9e+13eps
x = 2.4048255576957751e+00  correct digits =  1.4  rel. error = 1.6e+14eps

Accuracy of besselj(0,x) near first extremum of J0(x):

>> func_accuracy_check(u,mp(2),false,5)
Accuracy check near extremum, x = 3.8317059702075123e+00:
x = 3.8317059702075129e+00  correct digits = 15.8  rel. error =  0.71eps
x = 3.8317059702075134e+00  correct digits = 15.8  rel. error =  0.71eps
x = 3.8317059702075138e+00  correct digits = 15.5  rel. error =  1.30eps
x = 3.8317059702075142e+00  correct digits = 15.8  rel. error =  0.71eps
x = 3.8317059702075147e+00  correct digits = 15.9  rel. error =  0.53eps

Situation is the same – besselj(0,x) computes J0(x) incorrectly near zeros.

In fact, all routines in MATLAB for computing Bessel functions of integer order suffer from accuracy loss in vicinity of function zeros. Error can be arbitrary high, even to the point when none of the digits are correct.

Below we just show relative error plots with obvious peaks near function zeros – indication of accuracy loss (detailed analysis for every function can be easily done using routine above):

Certainly this situation is absolutely unacceptable, and TMW should re-consider its library for computing Bessel functions.

More surprisingly, the issue is endemic for nearly all libraries for computing Bessel functions in double precision! Below we present error plots for some commonly used open source and commercial libraries. All of them (except one) suffer from the same accuracy loss near function zeros – error may become arbitrary high.

Open Source Libraries


GNU Scientific Library[16]

Boost 1.60.0

Free peer-reviewed portable C++ source libraries[17]

Cephes 2.8

C and C++ language special functions math library[18]

Numeric Recipes, 2007

3rd Edition: The Art of Scientific Computing[19]

Commercial Libraries

NAG Toolbox for MATLAB

Mark 24 – newest version[25]

Microsoft C/C++ Language and Standard Libraries

Part of several generations of MS Visual Studio [21]

Intel Fortran


All tested commercial (MATLAB, NAG, Intel and Microsoft) and open source libraries (GNU GSL, Boost, CEPHES and Numeric Recipes) exhibit severe accuracy degradation near zeros of Bessel functions. In fact, computed function values have no correct digits in close vicinity of zeros.

Intel mathematical library delivers accurate results for Y0(x), Y1(x), J0(x) and J1(x) but suffers from the same accuracy loss for higher orders n=2,3,....

The difficulty of approximating Bessel functions near zeros is well known[22] and efficient algorithms were developed for both cases – double[23] and arbitrary precision[24]. We hope maintainers of the libraries will take this analysis into account and will provide fixes in future releases.

Until then, please rely on high-accuracy tools, e.g. Advanpix toolbox which is the only way to compute Bessels correctly in MATLAB at the moment.


  1. IEEE Computer Society (2008), IEEE Standard for Binary Floating-Point Arithmetic.
  2. S. Gal. Computing elementary functions: A new approach for achieving high accuracy and good performance. In Accurate Scientific Computations. Lecture Notes in Computer Science, volume 235, pages 1–16. Springer-Verlag, Berlin, 1986.
  3. S. Gal and B. Bachelis. An accurate elementary mathematical library for the IEEE floating point standard. ACM Transactions on Mathematical Software, 17(1):26–45, March 1991.
  4. A. Ziv, Fast Evaluation of Elementary Mathematical Functions with Correctly Rounded Last Bit, ACM Trans. Math. Software, vol. 17, no. 3, pp. 410-423, 1991.
  5. V. Lefevre and J.-M. Muller, Worst Cases for Correct Rounding of the Elementary Functions in Double Precision, Proc. 15th IEEE Symp. Computer Arithmetic (ARITH 15), N. Burgess and L. Ciminiera, eds., pp. 111-118, 2001
  6. D. Defour, G. Hanrot, V. Lefevre, J.-M. Muller, N. Revol, and P. Zimmermann, Proposal for a Standardization of Mathematical Function Implementation in Floating-Point Arithmetic, Numerical Algorithms,vol. 37, nos. 1-4, pp. 367-375, 2004
  7. D. Stehle and P. Zimmermann. Gal’s accurate tables method revisited. In Proceedings of the 17th IEEE Symposium on Computer Arithmetic (ARITH-17). IEEE Computer Society Press, Los Alamitos, CA, 2005.
  8. Catherine Daramy-Loirat, David Defour, Florent de Dinechin, Matthieu Gallet, Nicolas Gast, and Jean-Michel Muller. CR-LIBM: A library of correctly rounded elementary functions in double-precision, February 29, 2009.
  9. P. W. Markstein. IA-64 and Elementary Functions: Speed and Precision. Hewlett Packard Professional Books. Prentice Hall, 2000.
  10. J.-M. Muller. Elementary Functions, Algorithms and Implementation. Birkhäuser Boston, 2nd Edition, 2006
  11. Muller, J.-M., Brisebarre, N., de Dinechin, F., Jeannerod, C.-P., Lefèvre, V., Melquiond, G., Revol, N., Stehlé, D., Torres, S.. Handbook of Floating-Point Arithmetic. Birkhäuser Boston, 2009.
  12. ISO/IEC 14882: Programming Language C++ (Latest revisions).
  13. ISO/IEC 9899: Programming language C (Latest revisions).
  14. JTC1/SC22/WG5: FORTRAN.
  15. Next floating-point number in MATLAB. See also C/C++ standards.
  16. M. Galassi et al, GNU Scientific Library Reference Manual, 3rd Edition (January 2009), ISBN 0954612078. Version 2.1, November 11, 2015.
  17. Boost – free peer-reviewed portable C++ source libraries. Version 1.60.0, December 17th, 2015.
  18. CEPHES C and C++ language special functions math library. Version 2.8, November 4, 2014.
  19. Press, William H. and Teukolsky, Saul A. and Vetterling, William T. and Flannery, Brian P. Numerical Recipes 3rd Edition: The Art of Scientific Computing, 2007, Cambridge University Press, New York, USA.
  20. GNU C Library, February 19, 2016
  21. Microsoft C/C++ Language and Standard Libraries.
  22. J. F. Hart, E. W. Cheney, C. L. Lawson, H. J. Maehly, C. K. Mesztenyi, J. R. Rice, H. G. Thatcher, and C. Witzgall. Computer Approximations. Robert E. Krieger, 1978.
  23. J. Harrison. Fast and Accurate Bessel Function Computation, Proceedings of ARITH19, the 19th IEEE Conference on Computer Arithmetic, IEEE Computer Society Press, 2009, pp. 104-113.
  24. Fousse, G. Hanrot, V. Lefevre, P. Pelissier, and P. Zimmermann, 2007, MPFR: A multiple-precision binary floating-point library with correct rounding, ACM TOMS, 33(2), 13:1–15
  25. The NAG Toolbox for MATLAB, Mark 24 (the newest version).

{ 1 comment… read it below or add one }StefanSeptember 18, 2020 at 6:29 pm

Absolutely amazing work!
This is a serious issue, that I run into with my students, when expanding functions in a Bessel series. I can’t tell you how often I have said “yes, that looks sh*t because Matlab’s Bessel function are sh*t. We have to stop after a few terms in the series”.

Semster days BU

Academic Year 2020/21
Academic Year 2021/22
Nomination DeadlineFri, 29/05/2020Fri, 28/05/2021
Application DeadlineFri, 12/06/2020Fri, 11/06/2021
Arrival DateWed, 16/09/2020Wed, 15/09/2021
Welcome MeetingThu, 17/09/2020Thur, 16/09/2021
International OrientationThu, 17/09/2020Thur, 16/09/2021
Welcome WeekMon, 21/09/2020Mon, 20/09/2021
Latest Module SubmissionWed, 23/09/2020Wed, 22/09/2021
Semester 1 Classes StartMon, 28/09/2020Mon, 27/09/2021
Module Add/Drop Period EndsFri, 09/10/2020Fri, 08/09/2021
Christmas Holidays StartSat, 19/12/2020Sat, 18/12/2021
Semester 1 Exams StartMon, 11/01/2021Mon, 10/01/2022
Semester 1 EndsFri, 22/01/2021Fri, 21/01/2022
Latest Module SubmissionThu, 21/01/2021Thur, 20/01/2022
Semester 2 Classes StartMon, 25/01/2021Mon, 24/01/2022
Easter Holidays StartSat, 27/03/2021Sat, 02/04/2022
Semester 2 ResumesMon, 12/04/2021Mon, 25/04/2022
Farewell MeetingWed, 28/04/2021Wed, 04/05/2022
Semester 2 Exams StartMon, 03/05/2021Mon, 09/05/2022
Semester 2 EndsFri, 28/05/2021Fri, 03/06/2022

Increase wordpress max upload size

1: Theme Functions File

There are cases where we have seen that just by adding the following code in theme’s functions.php file, you can increase the upload size:

123@ini_set( 'upload_max_size' , '64M' );@ini_set( 'post_max_size', '64M');@ini_set( 'max_execution_time', '300' );

2. Create or Edit an existing PHP.INI file

For this method you will need to access your WordPress site’s root folder by using FTP or File Manager app in your hosting account’s cPanel dashboard.

In most cases if you are on a shared host, then you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:

123upload_max_filesize = 64Mpost_max_size = 64Mmax_execution_time = 300

This method is reported to work for many users. Remember if 64 doesn’t work, then try 10MB (sometimes that work).

LIBS 激光诱导解析光谱系统

LIBS 激光诱导解析光谱系统

激光诱导击穿光谱,“Laser Induced Breakdown Spectroscopy, LIBS”,是基于脉冲激光技术、时间分辨高分辨全谱直读技术的一种元素分析方法,广泛应用于物质分析、成份检测、污染及有害物分析、物质鉴定、激光加工过程分析等领域。


1.1 LIBS 在本质上是一种原子发射光谱技术。




 1.2 LIBS的具体过程
 短脉冲激光(数十mJ,<10ns)被聚焦到1GW/cm^2量级,入射到样品上(可为固体、液体甚至气体);样品离化成为等离子体;激光加热等离子体,局部*高电子温度可达十万K;激光脉冲中止,等离子体热平衡,平衡温度约为一万K左右;平衡后离子获得足够能量并开始膨胀,等离子体进一步降温;此期间辐射主要是黑体辐射和轫致辐射,其表现为紫外~可见~近红外连续谱,并随时间逐渐红移;约10微秒时间以后,等离子体温度降低,此时辐射以离子与电子复合辐射为主,表现为紫外~可见的分立线谱;此即需要探测的元素发射光谱。 1.3 LIBS对仪器设备的要求
 一台能量足够的、带同步内外触发的纳秒脉冲激光器;延时脉冲发生器;分辨率达到0.1nm及以下,并能全谱直读的光谱仪*;带延时及门控(至少微秒量级)的探测器。对分辨率和覆盖范围的要求,都来自于元素分辨的需求。原子发射光谱非常复杂,要区分不同的元素的相近谱线,需要相当好的分辨率和准确性;同时,通过比对多条谱线(同一元素的不同价态的谱系)来确定一个元素是*准确的方法,因此,光谱覆盖范围要求达到紫外 ~ 可见。 二、LIBS技术优势
 无损或微损检测。LIBS测量中,激光仅仅作用于微米量级的区域,对样品基本无损;基本无需样品制备,避免了样品在制备中的污染;可通过重复测量一个点,对样品表层以下做成分分析,或避免表面污染的影响;可以通过机械结构对样品表面进行扫描,做Mapping分析;适用于几乎任何形态的样品:固体;液体;气体。适用于各种体系的元素分析:化合物、溶液、悬浊与悬浮混合物、合金等;相对于其它原子发射光谱技术,LIBS实验非常快速便捷,通常几秒钟就能出结果;LIBS纯光学技术,这意味着实验装置和样品间只有光学接触,系统可以很方便的跟其它光学装置(望远镜、显微镜、光纤),实现微区测量、远程测量甚至遥测;LIBS系统可仪器化、全固化、小型化及整体化,相对于大型实验室分析设备,有极强的移动性和灵活性,可很方便的用于现场测量;仪器对于供电等配套要求非常简单(无须大功率供电产生射频电磁场),有极强的环境适应能力(无须氧气及氧化剂,对有害气体不敏感,全固化系统可防震、冻、热、尘),因此可适用在极端场合;作为一个典型案例,因为便携式XRF被证明在尘土环境中不适用,因此美国已经用LIBS系统代替XRF系统用于火星表面成份探测; 2.2与其它元素分析方式(XRF)相比,LIBS具备以下优势:
 对轻元素(如氮等)的鉴别能力远远超过XRF;实践中的XRF只能测量纳及更重的元素;测量过程中不使用高能射线,不会穿透样品,对人体无害。 三、应用
 作为一种元素分析技术,LIBS的主要应用包括:1)化学、材料领域,实验室用成份分析;2)冶金工业领域,合金成分分析,杂质成份分析;3)激光加工(脉冲激光切钻焊、脉冲激光冲击强化)科研级应用中,中间过程分析;4)能源及矿产领域:石油、煤炭等成份分析;5)机械动力领域科研级应用:如航空润滑油金属微粒分析;6)地质探矿,地质考古;7)文物古籍鉴定(古铜、铁、瓷、玉鉴定,书画油墨鉴定);8)国防和安全:管制物品(如炸药)检测;生化武器监控;9)建筑:建筑材料(石、砖、瓷、玻璃等)分析;10)刑侦和鉴定:牙齿骨骼头发元素分析;宝石、贵金属元素分析;11)环境分析:RoHS检测:工业及民用产品中有害元素检测;水中污染物监测:重金属离子及总氮(TN)、总磷(TP)含量检测;烟尘及气体排放中有害元素检测;土壤重金属污染检测及总氮检 测;12)农林业:农作物、木材有害成份检测

四、 仪器组成典型的LIBS装置应该由如下部分组成: 

 1、激光:一般用纳秒量级,数十毫焦能量以上的固体激光,1064nm或532nm;2、延时脉冲发生器:在精度在微秒及以下的延时脉冲发生器;3、光搜集装置:透镜+光纤;4、光谱仪和探测器:分辨率在0.1nm及更好的光谱仪;门控在微秒及以下的多通道探测器。 五、相关产品

 1)法国Quantel公司 Brilliant、CFR、Ultra系列激光器,也可选配OPO激光器;1064nm能量从50mJ ~ 850mJ/pulse;Brilliant系列激光器为紧凑型固体Nd:YAG激光器,模块化结构,方便组配多个波长。即插即用型激光器,无须调试,非常适合实验室使用,也可移动使用;CFR/Ultra激光器为按照美国军标生产的紧凑型激光器;其抗震、耐温、耐恶劣环境的特征,及小巧的激光头与电源的体积,使得该类型激光器非常适合移动使用
2)美国DG535/DG645脉冲发生器四通道数字脉冲延时发生器;0-999秒延时可控;5ps延时分辨率,<50ps抖动,<1.5ns 延时精度
3)英国Andor公司Mechelle中阶梯光栅光谱仪唯一的商品化中阶梯光栅光谱仪全谱直读:200nm ~ 975nm光谱覆盖范围,可探测所有元素的原子发射光谱;高分辨率:光谱分辨能力(l/Dl)= 5000(0.1nm @ 500nm);专利设计的分光结构,光学交叉干扰<10-2;自动温度补偿,有效保持波长准确性;
4)英国Andor公司iStar ICCD探测器180nm ~ 850nm响应,覆盖全部元素光谱 2ns门宽,带来精细的时间分辨能力和低占空比信号检出能力;ICCD具备103量级的光增益,系统灵敏度大为提高,非常有利于检出微量、痕量元素组分