Difference between revisions of "File:AsinplotT.png"

From TORI
Jump to navigation Jump to search
(Importing image file)
 
 
Line 1: Line 1:
  +
[[Explicit plot]] of function [[ArcSin]];
Importing image file
 
  +
  +
: $y=\mathrm{arcsin}(x)$
  +
  +
is shown with dark blue line.
  +
  +
==C++ geneator of curve==
  +
File [[ado.cin]] should be loaded to the working directory for compilation of the [[C++]] code below:
  +
  +
#include <math.h>
  +
#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 complex<double> z_type;
  +
#define Re(x) x.real()
  +
#define Im(x) x.imag()
  +
#define I z_type(0.,1.)
  +
#include "ado.cin"
  +
  +
z_type acos(z_type z){
  +
if(Im(z)<0){if(Re(z)>=0){return I*log( z + sqrt(z*z-1.) );}
  +
else{return I*log( z - sqrt(z*z-1.) );}}
  +
if(Re(z)>=0){return -I*log( z + sqrt(z*z-1.) );}
  +
else {return -I*log( z - sqrt(z*z-1.) );} }
  +
  +
z_type asin(z_type z){
  +
if(Im(z)<0){if(Re(z)>=0){return M_PI/2.-I*log( z + sqrt(z*z-1.) );}
  +
else {return M_PI/2.-I*log( z - sqrt(z*z-1.) );}}
  +
if(Re(z)>=0){return M_PI/2.+I*log( z + sqrt(z*z-1.) );}
  +
else {return M_PI/2.+I*log( z - sqrt(z*z-1.) );} }
  +
  +
#define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+(x),0.+(y));
  +
#define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+(x),0.+(y));
  +
#define S(x,y) fprintf(o,"S\n",);
  +
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d;
  +
FILE *o;o=fopen("asinplot.eps","w");ado(o,220,330);
  +
fprintf(o,"110 170 translate\n 100 100 scale\n");
  +
for(m=-1;m<2;m++){M(m,-1.5)L(m,1.5)}
  +
for(n=-1;n<2;n++){M(-1,n)L(1,n)}
  +
fprintf(o,"2 setlinecap .008 W 0 0 0 RGB S\n");
  +
for(m=-1;m<2;m++){M(.5*m,-1.5)L(.5*m,1.5)}
  +
DO(n,4){M(-1,-1.5+n)L(1,-1.5+n)}
  +
fprintf(o,"2 setlinecap .005 W 0 0 0 RGB S\n");
  +
DO(m,2001){ x=-1.+.001*m; z=x; y=Re(asin(z)); if(m==0)M(x,y) else L(x,y) }
  +
fprintf(o,"1 setlinejoin 1 setlinecap .02 W 0 0 .6 RGB S\n"); p=1.8;q=.7;
  +
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
  +
system("epstopdf asinplot.eps");
  +
system( "open asinplot.pdf");
  +
getchar(); system("killall Preview");//for mac
  +
}
  +
  +
==Latex generator of labels==
  +
  +
The input file [[asinplot.pdf]] should be generated with the code above in order to compile the [[Latex]] document below.
  +
  +
%<nowiki>
  +
% Copyleft 2012 by Dmitrii Kouznetsov % <br>
  +
\documentclass[12pt]{article} % <br>
  +
\usepackage{geometry} % <br>
  +
\usepackage{graphicx} % <br>
  +
\usepackage{rotating} % <br>
  +
\paperwidth 432pt % <br>
  +
\paperheight 665pt % <br>
  +
\topmargin -90pt % <br>
  +
\oddsidemargin -80pt % <br>
  +
\textwidth 900pt % <br>
  +
\textheight 900pt % <br>
  +
\pagestyle {empty} % <br>
  +
\newcommand \sx {\scalebox} % <br>
  +
\newcommand \rot {\begin{rotate}} % <br>
  +
\newcommand \ero {\end{rotate}} % <br>
  +
\newcommand \ing {\includegraphics} % <br>
  +
\begin{document} % <br>
  +
\parindent 0pt \sx{2}{ \begin{picture}(220,321) % <br>
  +
\put(4,0){\ing{asinplot}} % <br>
  +
\put(2,320){\sx{1.7}{$y$}} % <br>
  +
\put(2,264){\sx{1.6}{$1$}} % <br>
  +
\put(2,164){\sx{1.6}{$0$}} % <br>
  +
\put(-6, 64){\sx{1.6}{$-\!1$}} % <br>
  +
\put(1, 0){\sx{1.6}{$-\!1$}} % <br>
  +
\put(44, 0){\sx{1.6}{$-\!0.5$}} % <br>
  +
\put(110, 0){\sx{1.6}{$0$}} % <br>
  +
\put(154, 0){\sx{1.6}{$0.5$}} % <br>
  +
\put(205, 0){\sx{1.7}{$x$}} % <br>
  +
\put(124,187){\sx{1.6}{\rot{48}$y\!=\!\mathrm{asin}(x)$\ero}} \end{picture} % <br>
  +
} % <br>
  +
\end{document}% <br>
  +
%</nowiki>
  +
  +
==Keywords==
  +
[[ArcSin]],
  +
[[ArcCos]],
  +
[[Elementary function]]
  +
[[Inverse function]]
  +
  +
[[Category:ArcSin]]
  +
[[Category:Explicit plot]]
  +
[[Category:Inverse function]]
  +
[[Category:Elementary function]]

Latest revision as of 09:41, 21 June 2013

Explicit plot of function ArcSin;

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

is shown with dark blue line.

C++ geneator of curve

File ado.cin should be loaded to the working directory for compilation of the C++ code below:

#include <math.h> 
#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 complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "ado.cin"
z_type acos(z_type z){
if(Im(z)<0){if(Re(z)>=0){return  I*log( z + sqrt(z*z-1.) );} 
                   else{return  I*log( z - sqrt(z*z-1.) );}}
           if(Re(z)>=0){return -I*log( z + sqrt(z*z-1.) );} 
                  else {return -I*log( z - sqrt(z*z-1.) );} }
z_type asin(z_type z){
if(Im(z)<0){if(Re(z)>=0){return M_PI/2.-I*log( z + sqrt(z*z-1.) );} 
                  else {return M_PI/2.-I*log( z - sqrt(z*z-1.) );}}
          if(Re(z)>=0){return M_PI/2.+I*log( z + sqrt(z*z-1.) );} 
                 else {return M_PI/2.+I*log( z - sqrt(z*z-1.) );} }
#define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+(x),0.+(y));
#define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+(x),0.+(y));
#define S(x,y) fprintf(o,"S\n",);
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d;
FILE *o;o=fopen("asinplot.eps","w");ado(o,220,330);
fprintf(o,"110 170 translate\n 100 100 scale\n");
for(m=-1;m<2;m++){M(m,-1.5)L(m,1.5)}
for(n=-1;n<2;n++){M(-1,n)L(1,n)}
 fprintf(o,"2 setlinecap .008 W 0 0 0 RGB S\n");
for(m=-1;m<2;m++){M(.5*m,-1.5)L(.5*m,1.5)}
DO(n,4){M(-1,-1.5+n)L(1,-1.5+n)}
fprintf(o,"2 setlinecap .005 W 0 0 0 RGB S\n");
DO(m,2001){ x=-1.+.001*m; z=x; y=Re(asin(z)); if(m==0)M(x,y) else L(x,y) }
fprintf(o,"1 setlinejoin 1 setlinecap .02 W 0 0 .6 RGB S\n"); p=1.8;q=.7;
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
     system("epstopdf asinplot.eps");
     system(    "open asinplot.pdf");
     getchar(); system("killall Preview");//for mac
}

Latex generator of labels

The input file asinplot.pdf should be generated with the code above in order to compile the Latex document below.

% % Copyleft 2012 by Dmitrii Kouznetsov % <br> \documentclass[12pt]{article} % <br> \usepackage{geometry} % <br> \usepackage{graphicx} % <br> \usepackage{rotating} % <br> \paperwidth 432pt % <br> \paperheight 665pt % <br> \topmargin -90pt % <br> \oddsidemargin -80pt % <br> \textwidth 900pt % <br> \textheight 900pt % <br> \pagestyle {empty} % <br> \newcommand \sx {\scalebox} % <br> \newcommand \rot {\begin{rotate}} % <br> \newcommand \ero {\end{rotate}} % <br> \newcommand \ing {\includegraphics} % <br> \begin{document} % <br> \parindent 0pt \sx{2}{ \begin{picture}(220,321) % <br> \put(4,0){\ing{asinplot}} % <br> \put(2,320){\sx{1.7}{$y$}} % <br> \put(2,264){\sx{1.6}{$1$}} % <br> \put(2,164){\sx{1.6}{$0$}} % <br> \put(-6, 64){\sx{1.6}{$-\!1$}} % <br> \put(1, 0){\sx{1.6}{$-\!1$}} % <br> \put(44, 0){\sx{1.6}{$-\!0.5$}} % <br> \put(110, 0){\sx{1.6}{$0$}} % <br> \put(154, 0){\sx{1.6}{$0.5$}} % <br> \put(205, 0){\sx{1.7}{$x$}} % <br> \put(124,187){\sx{1.6}{\rot{48}$y\!=\!\mathrm{asin}(x)$\ero}} \end{picture} % <br> } % <br> \end{document}% <br> %

Keywords

ArcSin, ArcCos, Elementary function Inverse function

File history

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

Date/TimeThumbnailDimensionsUserComment
current17:50, 20 June 2013Thumbnail for version as of 17:50, 20 June 2013897 × 1,381 (70 KB)Maintenance script (talk | contribs)Importing image file

The following page uses this file:

Metadata