eigenmath/expsin.cpp

56 lines
638 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();
}
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 *));
}