2002-09-11 09:14:57 +00:00
|
|
|
|
2001-12-05 08:04:20 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-11-07 13:15:59 +00:00
|
|
|
#include "math_exfuncinset.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
#include "math_support.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2001-12-05 08:04:20 +00:00
|
|
|
#include "math_streamstr.h"
|
2001-11-07 13:15:59 +00:00
|
|
|
|
|
|
|
|
2001-11-13 18:33:48 +00:00
|
|
|
MathExFuncInset::MathExFuncInset(string const & name)
|
2001-11-07 13:15:59 +00:00
|
|
|
: MathNestInset(1), name_(name)
|
2001-11-13 18:33:48 +00:00
|
|
|
{}
|
2001-11-07 13:15:59 +00:00
|
|
|
|
|
|
|
|
2002-06-25 13:19:50 +00:00
|
|
|
MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
|
|
|
|
: MathNestInset(1), name_(name)
|
|
|
|
{
|
|
|
|
cell(0) = ar;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-07 13:15:59 +00:00
|
|
|
MathInset * MathExFuncInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathExFuncInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathExFuncInset::metrics(MathMetricsInfo & mi) const
|
2001-11-07 13:15:59 +00:00
|
|
|
{
|
2002-07-11 11:27:24 +00:00
|
|
|
mathed_string_dim(mi.base.font, name_, dim_);
|
2001-11-09 12:01:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-05-30 07:09:54 +00:00
|
|
|
drawStrBlack(pi, x, y, name_);
|
2001-11-07 13:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-05 07:09:11 +00:00
|
|
|
string MathExFuncInset::name() const
|
2001-11-07 13:15:59 +00:00
|
|
|
{
|
2002-08-05 07:09:11 +00:00
|
|
|
return name_;
|
2001-11-07 13:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
void MathExFuncInset::maple(MapleStream & os) const
|
2001-11-07 13:15:59 +00:00
|
|
|
{
|
2002-06-25 13:49:29 +00:00
|
|
|
if (name_ == "det")
|
|
|
|
os << "linalg[det](" << cell(0) << ')';
|
|
|
|
else
|
|
|
|
os << name_ << '(' << cell(0) << ')';
|
2001-11-07 13:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
void MathExFuncInset::maxima(MaximaStream & os) const
|
2002-10-28 17:15:19 +00:00
|
|
|
{
|
|
|
|
if (name_ == "det")
|
|
|
|
os << "determinant(" << cell(0) << ')';
|
|
|
|
else
|
|
|
|
os << name_ << '(' << cell(0) << ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-01 11:17:14 +00:00
|
|
|
string asMathematicaName(string const & name)
|
|
|
|
{
|
|
|
|
if (name == "sin") return "Sin";
|
|
|
|
if (name == "sinh") return "Sinh";
|
|
|
|
if (name == "arcsin") return "ArcSin";
|
|
|
|
if (name == "cos") return "Cos";
|
|
|
|
if (name == "cosh") return "Cosh";
|
|
|
|
if (name == "arcos") return "ArcCos";
|
|
|
|
if (name == "tan") return "Tan";
|
|
|
|
if (name == "tanh") return "Tanh";
|
|
|
|
if (name == "arctan") return "ArcTan";
|
|
|
|
if (name == "cot") return "Cot";
|
|
|
|
if (name == "coth") return "Coth";
|
|
|
|
if (name == "csc") return "Csc";
|
|
|
|
if (name == "sec") return "Sec";
|
|
|
|
if (name == "exp") return "Exp";
|
|
|
|
if (name == "log") return "Log";
|
|
|
|
if (name == "ln" ) return "Log";
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
void MathExFuncInset::mathematica(MathematicaStream & os) const
|
2002-07-01 11:17:14 +00:00
|
|
|
{
|
|
|
|
os << asMathematicaName(name_) << '[' << cell(0) << ']';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 12:01:10 +00:00
|
|
|
void MathExFuncInset::mathmlize(MathMLStream & os) const
|
|
|
|
{
|
|
|
|
os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
|
2001-11-07 13:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
void MathExFuncInset::octave(OctaveStream & os) const
|
2001-11-07 13:15:59 +00:00
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
os << name_ << '(' << cell(0) << ')';
|
2001-11-07 13:15:59 +00:00
|
|
|
}
|