Difference between revisions of "File:Korifit76plot.jpg"

From TORI
Jump to navigation Jump to search
(Importing image file)
 
 
Line 1: Line 1:
  +
Comparison of function [[mori]] implemented through the definition
Importing image file
 
  +
  +
$y_1=\mathrm{mori}(x)=J_0(L_1\,x)/(1\!-\!x^2)$
  +
  +
to the approximation with
  +
  +
$\mathrm{kori76fit}=
  +
\prod_{n=2}^7\! \left(1-\frac{L_1^2}{L_n^2}x\right)~ \frac{1+\sum_{n=1}^6 a_n x^n}{1+\sum_{n=1}^6 b_n x^n}
  +
$
  +
  +
where $L_n=\mathrm{BesselJZero}[0,n]$ and coefficients $a$ and $b$ are:
  +
  +
$a_1=-0.04844698269548584 $<br>
  +
$a_2= 0.0010028289633265202 $<br>
  +
$a_3= -0.000011428855401098336$<br>
  +
$a_4= 7.61813379974462\times 10^{-8}$<br>
  +
$a_5= -2.8376606186641804\times 10^{-10}$<br>
  +
$a_6= 4.651275051439759\times 10^{-13}$
  +
  +
$b_1= 0.03223483760044156$<br>
  +
$b_2= 0.0004974915308429358$<br>
  +
$b_3= 4.7768603073237505\times 10^{-6}$<br>
  +
$b_4= 3.071615607112112\times 10^{-8}$<br>
  +
$b_5= 1.292095753771865\times 10^{-10}$<br>
  +
$b_6= 2.925186494186955\times 10^{-13}$
  +
  +
Approximation is the following:
  +
  +
$\displaystyle
  +
\mathrm{mori}(z) \approx
  +
\mathrm{korifit76}(z^2)$
  +
  +
Let $y_2=\mathrm{kori76fit}(x^2)$
  +
  +
the upper blue curve shows the agreement
  +
  +
$\mathrm{agreeA}(x)= - \log_{10}(|y_1\!-\!y_2|)$
  +
  +
scaled with factor 0.1; id est, $y=\frac{1}{10}\mathrm{agreeA}(x)$
  +
  +
the black intermediate curve shows the agreement
  +
  +
$\displaystyle
  +
\mathrm{agreeB}(x)= - \log_{10}\left(\frac{|y_1-y_2|}{|y_1| +| y_2|}\right)$
  +
  +
scaled with factor 0.1; id est, $y=\frac{1}{10}\mathrm{agreeAB}(x)$.
  +
  +
For example, agreement 10 (level $y=1$ in the graphic) indicates, that of order of 10 significant figures can be achieved with such a fit.
  +
  +
The lower red curve shows the approximated function
  +
  +
$y=\mathrm{mori}(x)$
  +
  +
However, the deviation of the fit from the approximated function is not seen in this curve.
  +
  +
==[[C++]] generator of curves==
  +
<poem><nomathjax><nowiki>
  +
#include <stdio.h>
  +
#include <stdlib.h>
  +
#define DB double
  +
#define DO(x,y) for(x=0;x<y;x++)
  +
//using namespace std;
  +
#include <complex>
  +
typedef std::complex<double> z_type;
  +
#define Re(x) x.real()
  +
#define Im(x) x.imag()
  +
#define I z_type(0.,1.)
  +
#define M(x,y) fprintf(o,"%6.4lf %6.4lf M\n",0.+x,0.+y);
  +
#define L(x,y) fprintf(o,"%6.4lf %6.4lf L\n",0.+x,0.+y);
  +
  +
#include "korifit76.cin"
  +
#include "ado.cin"
  +
  +
DB L1=2.404825557695773;
  +
DB L2=5.5200781102863115;
  +
DB L3=8.653727912911013;
  +
DB L4=11.791534439014281;
  +
DB L5=14.930917708487787;
  +
DB L6=18.071063967910924;
  +
DB L7=21.21163662987926;
  +
DB L8=24.352471530749302;
  +
  +
DB LN[9]={ 0., 2.404825557695773, 5.5200781102863115,
  +
8.653727912911013,11.791534439014281,14.930917708487787,
  +
18.071063967910924,21.21163662987926, 24.352471530749302};
  +
  +
int main(){int m,n,i; double x,y,z,t,u; FILE *o;
  +
  +
//o=fopen("23.eps","w");
  +
o=fopen("korifit76plo.eps","w");
  +
ado(o,920,220);
  +
fprintf(o,"10 10 translate 100 100 scale 2 setlinecap 1 setlinejoin\n");
  +
  +
for(m=0;m<10;m++) {M(m,0 )L(m,1.5)}
  +
for(n=0;n<16;n+=5){M(0,.1*n)L(9,.1*n)}
  +
fprintf(o,"0.01 W S\n");
  +
  +
for(m=2;m<8;m++) { M(LN[m]/L1,0) L(LN[m]/L1,1.5)}
  +
fprintf(o,"0.005 W S\n");
  +
  +
M(0,1.66);
  +
for(n=1;n<4600;n++){x=.002*n; y=j0(L1*x)/(1.-x*x); z=Re(korifit76(x*x)); t=z-y;
  +
u=fabs(t)/(fabs(y)+fabs(z));u=-log(u)/log(10);
  +
printf("%5.2lf %19.16lf %19.16lf %19.16lf %5.2lf\n",x,y,z,t,u);
  +
if(u>0. && u<20.){ L(x,.1*u) }
  +
}
  +
fprintf(o,"0 0 0 RGB .02 W S\n");
  +
  +
M(0,1.66);
  +
for(n=1;n<4600;n++){x=.002*n; y=j0(L1*x)/(1.-x*x); z=Re(korifit76(x*x)); t=z-y;
  +
u=fabs(t);
  +
u=-log(u)/log(10);
  +
if(u>0. && u<30.){ L(x,.1*u) }
  +
}
  +
fprintf(o,"0 0 1 RGB .02 W S\n");
  +
  +
DO(n,92){x=.1*n; y=j0(L1*x)/(1.-x*x);
  +
//z=Re(korifit76(x*x));
  +
if(y>-99 && y<99){ if(n==0) M(x,y) else L(x,y) }
  +
}
  +
fprintf(o,"1 0 0 RGB .02 W S\n");
  +
  +
fprintf(o,"showpage\n%c%cTrailer\n",'%','%'); fclose(o);
  +
system("epstopdf korifit76plo.eps");
  +
system( "open korifit76plo.pdf");
  +
return 0;}
  +
</nowiki></nomathjax></poem>
  +
  +
==[[Latex]] generator of labels==
  +
<poem><nomathjax><nowiki>
  +
\documentclass[12pt]{article}
  +
\usepackage{geometry}
  +
\usepackage{graphics}
  +
\usepackage{rotating}
  +
\paperwidth 923pt
  +
\paperheight 208pt
  +
\textwidth 420pt
  +
\textheight 300pt
  +
\topmargin -108pt
  +
\oddsidemargin -73pt
  +
\newcommand \ds {\displaystyle}
  +
\newcommand \sx {\scalebox}
  +
\newcommand \rme {\mathrm{e}}
  +
\newcommand \rot {\begin{rotate}}
  +
\newcommand \ero {\end{rotate}}
  +
\newcommand \ing {\includegraphics}
  +
\pagestyle{empty}
  +
\parindent 0pt
  +
\begin{document}
  +
\begin{picture}(614,197)
  +
\put(0,0){\ing{korifit76plo}}
  +
\put(1,190){\sx{1.25}{$y$}}
  +
\put(.6,156){\sx{1.4}{$\frac{3}{2}$}}
  +
\put(.6,105){\sx{1.3}{$1$}}
  +
\put(.6,56){\sx{1.4}{$\frac{1}{2}$}}
  +
\put(.6, 5){\sx{1.3}{$0$}}
  +
\put(107,-2){\sx{1.3}{$1$}}
  +
\put(207,-2){\sx{1.3}{$2$}}
  +
\put(233,-3){\sx{1.2}{$\frac{L_2}{L_1}$}}
  +
\put(308,-2){\sx{1.3}{$3$}}
  +
\put(364,-3){\sx{1.2}{$\frac{L_3}{L_1}$}}
  +
\put(408,-2){\sx{1.3}{$4$}}
  +
\put(494,-3){\sx{1.2}{$\frac{L_4}{L_1}$}}
  +
\put(509,-2){\sx{1.3}{$5$}}
  +
\put(609,-2){\sx{1.3}{$6$}}
  +
\put(627,-3){\sx{1.2}{$\frac{L_5}{L_1}$}}
  +
\put(709,-2){\sx{1.3}{$7$}}
  +
\put(759,-3){\sx{1.2}{$\frac{L_6}{L_1}$}}
  +
\put(810,-2){\sx{1.3}{$8$}}
  +
\put(889.6,-3){\sx{1.2}{$\frac{L_7}{L_1}$}}
  +
\put(914,-1.6){\sx{1.3}{$x$}}
  +
\put(112,58){\rot{-33}\sx{1.4}{$y\!=\! \mathrm{mori}(x)$}\ero}
  +
\put(778,103){\rot{-16}\sx{1.3}{$y\!=\! \frac{1}{10}\mathrm{agreeA}(x)$}\ero}
  +
\put(766,60){\rot{-16}\sx{1.3}{$y\!=\! \frac{1}{10}\mathrm{agreeB}(x)$}\ero}
  +
\end{picture}\end{document}
  +
</nowiki></nomathjax></poem>
  +
  +
==References==
  +
<references/>
  +
  +
[[Category:Approximation]]
  +
[[Category:Bessel function]]
  +
[[Category:Explicit plot]]
  +
[[Category:Kori function]]
  +
[[Category:Morinaga function]]

Latest revision as of 08:40, 1 December 2018

Comparison of function mori implemented through the definition

$y_1=\mathrm{mori}(x)=J_0(L_1\,x)/(1\!-\!x^2)$

to the approximation with

$\mathrm{kori76fit}= \prod_{n=2}^7\! \left(1-\frac{L_1^2}{L_n^2}x\right)~ \frac{1+\sum_{n=1}^6 a_n x^n}{1+\sum_{n=1}^6 b_n x^n} $

where $L_n=\mathrm{BesselJZero}[0,n]$ and coefficients $a$ and $b$ are:

$a_1=-0.04844698269548584 $
$a_2= 0.0010028289633265202 $
$a_3= -0.000011428855401098336$
$a_4= 7.61813379974462\times 10^{-8}$
$a_5= -2.8376606186641804\times 10^{-10}$
$a_6= 4.651275051439759\times 10^{-13}$

$b_1= 0.03223483760044156$
$b_2= 0.0004974915308429358$
$b_3= 4.7768603073237505\times 10^{-6}$
$b_4= 3.071615607112112\times 10^{-8}$
$b_5= 1.292095753771865\times 10^{-10}$
$b_6= 2.925186494186955\times 10^{-13}$

Approximation is the following:

$\displaystyle \mathrm{mori}(z) \approx \mathrm{korifit76}(z^2)$

Let $y_2=\mathrm{kori76fit}(x^2)$

the upper blue curve shows the agreement

$\mathrm{agreeA}(x)= - \log_{10}(|y_1\!-\!y_2|)$

scaled with factor 0.1; id est, $y=\frac{1}{10}\mathrm{agreeA}(x)$

the black intermediate curve shows the agreement

$\displaystyle \mathrm{agreeB}(x)= - \log_{10}\left(\frac{|y_1-y_2|}{|y_1| +| y_2|}\right)$

scaled with factor 0.1; id est, $y=\frac{1}{10}\mathrm{agreeAB}(x)$.

For example, agreement 10 (level $y=1$ in the graphic) indicates, that of order of 10 significant figures can be achieved with such a fit.

The lower red curve shows the approximated function

$y=\mathrm{mori}(x)$

However, the deviation of the fit from the approximated function is not seen in this curve.

C++ generator of curves


#include <stdio.h>
#include <stdlib.h>
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
//using namespace std;
#include <complex>
typedef std::complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#define M(x,y) fprintf(o,"%6.4lf %6.4lf M\n",0.+x,0.+y);
#define L(x,y) fprintf(o,"%6.4lf %6.4lf L\n",0.+x,0.+y);

#include "korifit76.cin"
#include "ado.cin"

DB L1=2.404825557695773;
DB L2=5.5200781102863115;
DB L3=8.653727912911013;
DB L4=11.791534439014281;
DB L5=14.930917708487787;
DB L6=18.071063967910924;
DB L7=21.21163662987926;
DB L8=24.352471530749302;

DB LN[9]={ 0., 2.404825557695773, 5.5200781102863115,
 8.653727912911013,11.791534439014281,14.930917708487787,
18.071063967910924,21.21163662987926, 24.352471530749302};

int main(){int m,n,i; double x,y,z,t,u; FILE *o;

//o=fopen("23.eps","w");
o=fopen("korifit76plo.eps","w");
ado(o,920,220);
fprintf(o,"10 10 translate 100 100 scale 2 setlinecap 1 setlinejoin\n");

for(m=0;m<10;m++) {M(m,0 )L(m,1.5)}
for(n=0;n<16;n+=5){M(0,.1*n)L(9,.1*n)}
fprintf(o,"0.01 W S\n");

for(m=2;m<8;m++) { M(LN[m]/L1,0) L(LN[m]/L1,1.5)}
fprintf(o,"0.005 W S\n");

M(0,1.66);
for(n=1;n<4600;n++){x=.002*n; y=j0(L1*x)/(1.-x*x); z=Re(korifit76(x*x)); t=z-y;
u=fabs(t)/(fabs(y)+fabs(z));u=-log(u)/log(10);
printf("%5.2lf %19.16lf %19.16lf %19.16lf %5.2lf\n",x,y,z,t,u);
 if(u>0. && u<20.){ L(x,.1*u) }
}
fprintf(o,"0 0 0 RGB .02 W S\n");

M(0,1.66);
for(n=1;n<4600;n++){x=.002*n; y=j0(L1*x)/(1.-x*x); z=Re(korifit76(x*x)); t=z-y;
u=fabs(t);
u=-log(u)/log(10);
if(u>0. && u<30.){ L(x,.1*u) }
}
fprintf(o,"0 0 1 RGB .02 W S\n");

DO(n,92){x=.1*n; y=j0(L1*x)/(1.-x*x);
//z=Re(korifit76(x*x));
if(y>-99 && y<99){ if(n==0) M(x,y) else L(x,y) }
}
fprintf(o,"1 0 0 RGB .02 W S\n");

fprintf(o,"showpage\n%c%cTrailer\n",'%','%'); fclose(o);
system("epstopdf korifit76plo.eps");
system( "open korifit76plo.pdf");
return 0;}

Latex generator of labels


\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphics}
\usepackage{rotating}
\paperwidth 923pt
\paperheight 208pt
\textwidth 420pt
\textheight 300pt
\topmargin -108pt
\oddsidemargin -73pt
\newcommand \ds {\displaystyle}
\newcommand \sx {\scalebox}
\newcommand \rme {\mathrm{e}}
\newcommand \rot {\begin{rotate}}
\newcommand \ero {\end{rotate}}
\newcommand \ing {\includegraphics}
\pagestyle{empty}
\parindent 0pt
\begin{document}
\begin{picture}(614,197)
\put(0,0){\ing{korifit76plo}}
\put(1,190){\sx{1.25}{$y$}}
\put(.6,156){\sx{1.4}{$\frac{3}{2}$}}
\put(.6,105){\sx{1.3}{$1$}}
\put(.6,56){\sx{1.4}{$\frac{1}{2}$}}
\put(.6, 5){\sx{1.3}{$0$}}
\put(107,-2){\sx{1.3}{$1$}}
\put(207,-2){\sx{1.3}{$2$}}
\put(233,-3){\sx{1.2}{$\frac{L_2}{L_1}$}}
\put(308,-2){\sx{1.3}{$3$}}
\put(364,-3){\sx{1.2}{$\frac{L_3}{L_1}$}}
\put(408,-2){\sx{1.3}{$4$}}
\put(494,-3){\sx{1.2}{$\frac{L_4}{L_1}$}}
\put(509,-2){\sx{1.3}{$5$}}
\put(609,-2){\sx{1.3}{$6$}}
\put(627,-3){\sx{1.2}{$\frac{L_5}{L_1}$}}
\put(709,-2){\sx{1.3}{$7$}}
\put(759,-3){\sx{1.2}{$\frac{L_6}{L_1}$}}
\put(810,-2){\sx{1.3}{$8$}}
\put(889.6,-3){\sx{1.2}{$\frac{L_7}{L_1}$}}
\put(914,-1.6){\sx{1.3}{$x$}}
\put(112,58){\rot{-33}\sx{1.4}{$y\!=\! \mathrm{mori}(x)$}\ero}
\put(778,103){\rot{-16}\sx{1.3}{$y\!=\! \frac{1}{10}\mathrm{agreeA}(x)$}\ero}
\put(766,60){\rot{-16}\sx{1.3}{$y\!=\! \frac{1}{10}\mathrm{agreeB}(x)$}\ero}
\end{picture}\end{document}

References

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current06:12, 1 December 2018Thumbnail for version as of 06:12, 1 December 20183,831 × 863 (318 KB)Maintenance script (talk | contribs)Importing image file

The following page uses this file:

Metadata