package org.matheclipse.core.reflection.system;
import static org.matheclipse.core.expression.F.CN1;
import static org.matheclipse.core.expression.F.Coth;
import static org.matheclipse.core.expression.F.Times;
import org.matheclipse.core.eval.interfaces.AbstractFunctionEvaluator;
import org.matheclipse.core.eval.interfaces.AbstractTrigArg1;
import org.matheclipse.core.eval.interfaces.INumeric;
import org.matheclipse.core.expression.ComplexUtils;
import org.matheclipse.core.expression.ComplexNum;
import org.matheclipse.core.expression.Num;
import org.matheclipse.core.expression.F;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.core.interfaces.ISymbol;
import org.matheclipse.parser.client.SyntaxError;
/**
* Hyperbolic cotangent
*
* See Hyperbolic function
*/
public class Coth extends AbstractTrigArg1 {
public Coth() {
}
@Override
public IExpr evaluateArg1(final IExpr arg1) {
if (AbstractFunctionEvaluator.isNegativeExpression(arg1)) {
return Times(CN1, Coth(Times(CN1, arg1)));
}
IExpr imPart = AbstractFunctionEvaluator.getPureImaginaryPart(arg1);
if (imPart != null) {
return F.Times(F.CNI, F.Cot(imPart));
}
if (arg1.isZero()){
return F.CComplexInfinity;
}
return null;
}
@Override
public void setUp(final ISymbol symbol) throws SyntaxError {
symbol.setAttributes(ISymbol.LISTABLE | ISymbol.NUMERICFUNCTION);
super.setUp(symbol);
}
}
Ads help maintain this website.