diff options
author | siddhu8990 | 2017-04-19 14:57:49 +0530 |
---|---|---|
committer | siddhu8990 | 2017-04-19 14:57:49 +0530 |
commit | 1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f (patch) | |
tree | 34e52b33707a829c1d8484428c96d3f1f6ce2b3a /src/c/elementaryFunctions/Trigonometry | |
parent | 9e506f48291533cba7b4c555b0d2e98f234bfbe3 (diff) | |
download | Scilab2C_fossee_old-1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f.tar.gz Scilab2C_fossee_old-1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f.tar.bz2 Scilab2C_fossee_old-1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f.zip |
Merged Shamik's work
Diffstat (limited to 'src/c/elementaryFunctions/Trigonometry')
60 files changed, 720 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c b/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c new file mode 100644 index 0000000..b48876e --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c @@ -0,0 +1,14 @@ +#include "cosd.h" +#include <math.h> + +void dcosda(double* in,int size,double* out) +{ + double val=0.0; + val =3.14159265/180.0; + int i=0; + for (i=0;i<size;i++) + { + out[i] = cos(in[i]*val); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c b/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c new file mode 100644 index 0000000..4550757 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c @@ -0,0 +1,11 @@ +#include <math.h> +#include "cos.h" +#include "cosd.h" + +double dcosds(double in) +{ + if(cos((M_PI/180.0)*in)==0.0) + return 0.0; + else + return (cos((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c b/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c new file mode 100644 index 0000000..5224899 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c @@ -0,0 +1,9 @@ +#include "cos.h" +#include "cosd.h" + +void scosda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scosds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c b/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c new file mode 100644 index 0000000..e99a195 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c @@ -0,0 +1,11 @@ +#include <math.h> +#include "cosd.h" +#include "cos.h" + +float scosds(float in) +{ + if(cosf((M_PI/180.0)*in)==0.0) + return 0.0; + else + return (cosf((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c b/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c new file mode 100644 index 0000000..3cf032a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c @@ -0,0 +1,16 @@ +#include "cotd.h" +#include <math.h> +#define PI 3.14159265 + +void dcotda(double* in,int size,double* out) +{ + double val; + int i=0; + val = PI / 180.0; + for(i=0;i<size;i++) + { + out[i]=1/tan(in[i]*val); + /*printf("The cotangent of %lf degrees is %lf \n", in[i], out[i]);*/ + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c b/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c new file mode 100644 index 0000000..4ba95b8 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c @@ -0,0 +1,9 @@ +#include <math.h> +#include "cotd.h" + +double dcotds(double in) +{ +if(in==0) +printf("Inf\n"); + return (1/tan((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c b/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c new file mode 100644 index 0000000..fd5a1e1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c @@ -0,0 +1,9 @@ + +#include "cotd.h" + +void scotda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scosds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c b/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c new file mode 100644 index 0000000..d635dbc --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "cotd.h" + +float scotds(float in) +{ + return (1/tanf((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c b/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c new file mode 100644 index 0000000..4e79451 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c @@ -0,0 +1,12 @@ +#include "coth.h" +#include <math.h> + +void ccotha(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccoths(in[i]); + } + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c b/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c new file mode 100644 index 0000000..564b8e6 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c @@ -0,0 +1,14 @@ +#include <math.h> +#include "coth.h" +#include <math.h> +#include "tanh.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex ccoths(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0), ctanhs(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c b/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c new file mode 100644 index 0000000..f6304f5 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c @@ -0,0 +1,14 @@ +#include "coth.h" +#include <math.h> + +void dcotha(double* in,int size,double* out) +{ + double val; + int i=0; + for(i=0;i<size;i++) + { + out[i]=cosh(in[i])/sinh(in[i]); + /*printf("The cotangent of %lf is %lf\n", in[i], out[i]);*/ + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c b/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c new file mode 100644 index 0000000..bf6bb78 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "coth.h" +#include "cosh.h" +#include "cos.h" +#include "sinh.h" +#include "sin.h" + +double dcoths(double in) { + return (cosh(in)/sinh(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/scotha.c b/src/c/elementaryFunctions/Trigonometry/coth/scotha.c new file mode 100644 index 0000000..3fdf37f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/scotha.c @@ -0,0 +1,14 @@ +#include "coth.h" +#include <math.h> + +void scotha(float* in,int size,float* out) +{ + float val; + int i=0; + for(i=0;i<size;i++) + { + out[i]=cosh(in[i])/sinh(in[i]); + /*printf("The cotangent of %lf is %lf\n", in[i], out[i]);*/ + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/coth/scoths.c b/src/c/elementaryFunctions/Trigonometry/coth/scoths.c new file mode 100644 index 0000000..107945e --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/scoths.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "coth.h" +#include "cosh.h" +#include "cos.h" +#include "sinh.h" +#include "sin.h" + +float scoths(float in) { + return (cosh(in)/sinh(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c b/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c new file mode 100644 index 0000000..dcbb284 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c @@ -0,0 +1,11 @@ +#include "coth.h" +#include <math.h> + +void zcotha(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcoths(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c b/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c new file mode 100644 index 0000000..2eed86b --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c @@ -0,0 +1,14 @@ +#include "coth.h" +#include "tanh.h" +#include "tan.h" +#include <math.h> +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcoths(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),ztanhs(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c b/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c new file mode 100644 index 0000000..5f5504a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c @@ -0,0 +1,11 @@ +#include "csc.h" +#include <math.h> + +void ccsca(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccscs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c b/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c new file mode 100644 index 0000000..af8b3eb --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c @@ -0,0 +1,16 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex ccscs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),csins(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c b/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c new file mode 100644 index 0000000..eeedea5 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c @@ -0,0 +1,10 @@ +#include "csc.h" + +void dcsca(double* in,int size,double* out) +{ + int i = 0; + for (i = 0;i<size;++i) + { + out[i] = dcscs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c b/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c new file mode 100644 index 0000000..31a6944 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c @@ -0,0 +1,9 @@ +#include "csc.h" +#include <math.h> + +double dcscs(double in) +{ + double out; + out=1/sin(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/scsca.c b/src/c/elementaryFunctions/Trigonometry/csc/scsca.c new file mode 100644 index 0000000..3e6963a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/scsca.c @@ -0,0 +1,10 @@ +#include "csc.h" + +void scsca(float* in,int size,float* out) +{ + int i = 0; + for (i = 0;i<size;++i) + { + out[i] = scscs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/scscs.c b/src/c/elementaryFunctions/Trigonometry/csc/scscs.c new file mode 100644 index 0000000..6d1b1b7 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/scscs.c @@ -0,0 +1,9 @@ +#include "csc.h" +#include <math.h> + +float scscs(float in) +{ + float out; + out=1/sin(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c b/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c new file mode 100644 index 0000000..4b8cdad --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c @@ -0,0 +1,11 @@ +#include "csc.h" +#include <math.h> + +void zcsca(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcscs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c b/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c new file mode 100644 index 0000000..c0b692d --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c @@ -0,0 +1,19 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcscs(doubleComplex z) +{ + doubleComplex out; + //out = zrdivs(DoubleComplex(1,0),zsins(z)); + double real = zreals(z); + double imag = zimags(z); + printf("%d , %d",real,imag); +return zrdivs(1+0*%i,(DoubleComplex(dsins(real) * dcoshs(imag), dcoss(real) * dsinhs(imag)))); + //return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c new file mode 100644 index 0000000..d18d3c7 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c @@ -0,0 +1,12 @@ +#include "csc.h" +#include "cscd.h" +#include <math.h> + +void ccscda(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccscds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c new file mode 100644 index 0000000..8f1f9f7 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c @@ -0,0 +1,17 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "cscd.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex ccscds(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),csins(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c new file mode 100644 index 0000000..43e0043 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c @@ -0,0 +1,15 @@ +#include "cscd.h" +#include <math.h> +#define PI 3.14159265 + +void dcscda(double* in,int size,double* out) +{ + double val; + int i=0; + val = PI / 180.0; + for(i=0;i<size;i++) + { + out[i]=1/sin(in[i]*val); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c new file mode 100644 index 0000000..d9a0df9 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c @@ -0,0 +1,11 @@ +#include "cscd.h" +#include <math.h> + +double dcscds(double in) +{ + double val; + val = (M_PI) / 180.0; + double out; + out=1/sin(in*val); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c new file mode 100644 index 0000000..761d941 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c @@ -0,0 +1,10 @@ +#include "cscd.h" + +void scscda(float* in,int size,float* out) +{ + int i = 0; + for (i = 0;i<size;++i) + { + out[i] = scscds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c new file mode 100644 index 0000000..d434854 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c @@ -0,0 +1,10 @@ +#include "cscd.h" +#include <math.h> + +float scscds(float in) +{ + float out,val; + val=(M_PI)/180.0; + out=1/sin(in*val); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c new file mode 100644 index 0000000..02f9e3b --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c @@ -0,0 +1,12 @@ +#include "csc.h" +#include "cscd.h" +#include <math.h> + +void zcscda(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcscds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c new file mode 100644 index 0000000..351c8ff --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c @@ -0,0 +1,17 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "cscd.h" +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcscds(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zsins(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c b/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c new file mode 100644 index 0000000..02a9ec1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c @@ -0,0 +1,11 @@ +#include "csch.h" +#include <math.h> + +void ccscha(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccschs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c b/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c new file mode 100644 index 0000000..177a9fa --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c @@ -0,0 +1,14 @@ +#include "csch.h" +#include "sinh.h" +#include "sin.h" +#include <math.h> +#include "floatComplex.h" +#include "division.h" + +floatComplex ccschs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),csinhs(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c b/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c new file mode 100644 index 0000000..ce87b6f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c @@ -0,0 +1,8 @@ +#include "csch.h" + +void dcscha(double* in, int size, double* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = dcschs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c b/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c new file mode 100644 index 0000000..3b22544 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c @@ -0,0 +1,9 @@ +#include "csch.h" +#include <math.h> + +double dcschs(double in) +{ + double out; + out=1/sinh(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/scscha.c b/src/c/elementaryFunctions/Trigonometry/csch/scscha.c new file mode 100644 index 0000000..880ffaa --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/scscha.c @@ -0,0 +1,8 @@ +#include "csch.h" + +void scscha(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scschs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/scschs.c b/src/c/elementaryFunctions/Trigonometry/csch/scschs.c new file mode 100644 index 0000000..8cd4e62 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/scschs.c @@ -0,0 +1,9 @@ +#include "csch.h" +#include <math.h> + +float scschs(float in) +{ + float out; + out=1/sinh(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c b/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c new file mode 100644 index 0000000..ae659de --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c @@ -0,0 +1,11 @@ +#include "csch.h" +#include <math.h> + +void zcscha(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcschs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c b/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c new file mode 100644 index 0000000..f3a9b22 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c @@ -0,0 +1,14 @@ +#include "csch.h" +#include "sinh.h" +#include "sin.h" +#include <math.h> +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcschs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zsinhs(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/cseca.c b/src/c/elementaryFunctions/Trigonometry/sec/cseca.c new file mode 100644 index 0000000..139360a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/cseca.c @@ -0,0 +1,11 @@ +#include "sec.h" +#include <math.h> + +void cseca(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = csecs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/csecs.c b/src/c/elementaryFunctions/Trigonometry/sec/csecs.c new file mode 100644 index 0000000..51ea224 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/csecs.c @@ -0,0 +1,13 @@ +#include "sec.h" +#include "cos.h" +#include <math.h> +#include "floatComplex.h" +#include "division.h" + +floatComplex csecs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),ccoss(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/dseca.c b/src/c/elementaryFunctions/Trigonometry/sec/dseca.c new file mode 100644 index 0000000..986b52f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/dseca.c @@ -0,0 +1,11 @@ +#include "sec.h" +#include <math.h> + +void dseca(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=1/cos(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c b/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c new file mode 100644 index 0000000..9135ad1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "sec.h" + +double dsecs(double in) +{ + return (1/cos(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/sseca.c b/src/c/elementaryFunctions/Trigonometry/sec/sseca.c new file mode 100644 index 0000000..f5fd81b --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/sseca.c @@ -0,0 +1,8 @@ +#include "sec.h" + +void sseca(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = ssecs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c b/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c new file mode 100644 index 0000000..2c9e018 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "sec.h" + +float ssecs(float in) +{ + return (1/cos(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/zseca.c b/src/c/elementaryFunctions/Trigonometry/sec/zseca.c new file mode 100644 index 0000000..7a80291 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/zseca.c @@ -0,0 +1,11 @@ +#include "sec.h" +#include <math.h> + +void zseca(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zsecs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c b/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c new file mode 100644 index 0000000..b5468db --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c @@ -0,0 +1,57 @@ +/*//#include "sec.h" +//#include "cos.h" +//#include <math.h> +//#include "doubleComplex.h" +//#include "division.h" +*/ + +/*#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "division.h" +*/ +#include <complex.h> +#include <stdio.h> + +/*doubleComplex zsecs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zcoss(z)); + return out; +} +*/ +void zsecs(double complex z) +{ + + //double complex out; + /*out = zrdivs(DoubleComplex(1,0),zcoss(z)); + return out; +}*/ + + double complex out = 1.0/(ccos(z)); + if(cimag(out)==0.0) + { + printf("%.7lf\n",creal(out)); + //out=creal(out); + } + else if(creal(out)==0.0) + { + printf("%.7lfi\n",cimag(out)); + //out=cimag(out); + } + else if(creal(out)!=0.0 && cimag(out)<0.0) + { + printf("%.7lf %.7lfi\n",creal(out),cimag(out)); + //out=x; + } + else + { + printf("%.7lf + %.7lfi\n", creal(out), cimag(out)); + //out=x; + } + //return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c b/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c new file mode 100644 index 0000000..028595c --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c @@ -0,0 +1,11 @@ +#include "secd.h" +#include <math.h> + +void dsecda(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dsecds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c b/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c new file mode 100644 index 0000000..7b08a46 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c @@ -0,0 +1,8 @@ +#include <math.h> +#include "sec.h" +#include "secd.h" + +double dsecds(double in) +{ + return (1/cos((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c b/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c new file mode 100644 index 0000000..6267f94 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c @@ -0,0 +1,9 @@ +#include "sec.h" +#include "secd.h" + +void ssecda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = ssecds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c b/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c new file mode 100644 index 0000000..3fabb22 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "secd.h" +#include "sec.h" + +float ssecds(float in) { + return (1/cos((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/csecha.c b/src/c/elementaryFunctions/Trigonometry/sech/csecha.c new file mode 100644 index 0000000..dcd76d5 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/csecha.c @@ -0,0 +1,11 @@ +#include "sech.h" +#include <math.h> + +void csecha(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = csechs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/csechs.c b/src/c/elementaryFunctions/Trigonometry/sech/csechs.c new file mode 100644 index 0000000..37ba6d9 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/csechs.c @@ -0,0 +1,15 @@ +#include "sech.h" +#include "sec.h" +#include <math.h> +#include "cos.h" +#include "cosh.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex csechs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),ccoshs(z)); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c b/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c new file mode 100644 index 0000000..cfab81f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c @@ -0,0 +1,10 @@ +#include "sech.h" +#include <math.h> +void dsecha(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dsechs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c b/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c new file mode 100644 index 0000000..10ca392 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "sech.h" +#include "cosh.h" +#include "cos.h" + + +double dsechs(double in) +{ + return (1/cosh(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c b/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c new file mode 100644 index 0000000..1d26563 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c @@ -0,0 +1,10 @@ +#include "sech.h" +#include <math.h> +void ssecha(float* in,int size,float* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=ssechs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c b/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c new file mode 100644 index 0000000..f582fd7 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "sech.h" +#include "cosh.h" +#include "cos.h" + + +float ssechs(float in) +{ + return (1/cosh(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c b/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c new file mode 100644 index 0000000..c48f8da --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c @@ -0,0 +1,11 @@ +#include "sech.h" +#include <math.h> + +void zsecha(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zsechs(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c b/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c new file mode 100644 index 0000000..93c95b3 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c @@ -0,0 +1,15 @@ +#include "sech.h" +#include "sec.h" +#include <math.h> +#include "cos.h" +#include "cosh.h" +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zsechs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zcoshs(z)); + return out; +} |