eigenmath/expsin.cpp

60 lines
660 B
C++
Raw Permalink Normal View History

2004-06-18 01:02:29 +02:00
// Do the exponential sine function.
#include "stdafx.h"
#include "defs.h"
void
eval_expsin(void)
{
push(cadr(p1));
eval();
expsin();
}
void
expsin(void)
{
save();
p1 = pop();
2004-06-25 22:45:15 +02:00
push(imaginaryunit);
2004-06-18 01:02:29 +02:00
push(p1);
multiply();
exponential();
2004-06-25 22:45:15 +02:00
push(imaginaryunit);
2004-06-18 01:02:29 +02:00
divide();
2004-06-18 02:24:34 +02:00
push_rational(1, 2);
multiply();
2004-06-18 01:02:29 +02:00
2004-06-25 22:45:15 +02:00
push(imaginaryunit);
2004-06-18 01:02:29 +02:00
negate();
push(p1);
multiply();
exponential();
2004-06-25 22:45:15 +02:00
push(imaginaryunit);
2004-06-18 01:02:29 +02:00
divide();
2004-06-18 02:24:34 +02:00
push_rational(1, 2);
multiply();
2004-06-18 01:02:29 +02:00
subtract();
restore();
}
2007-05-08 16:57:30 +02:00
#if SELFTEST
2004-06-18 01:02:29 +02:00
static char *s[] = {
"expsin(x)",
"1/2*i*exp(-i*x)-1/2*i*exp(i*x)",
};
void
test_expsin(void)
{
test(__FILE__, s, sizeof s / sizeof (char *));
}
2007-05-08 16:57:30 +02:00
#endif