use of org.matheclipse.core.eval.EvalEngine in project symja_android_library by axkr.
the class HMArrayList method mapThreadEvaled.
/**
* {@inheritDoc}
*/
@Override
public final IASTAppendable mapThreadEvaled(EvalEngine engine, IASTAppendable appendAST, final IAST replacement, int position) {
// final Function<IExpr, IExpr> function = Functors.replaceArg(replacement,
// position);
final Function<IExpr, IExpr> function = x -> {
IAST a = replacement.setAtCopy(position, x);
return engine.evaluate(a);
};
IExpr temp;
for (int i = firstIndex + 1; i < lastIndex; i++) {
temp = function.apply(array[i]);
if (temp != null) {
appendAST.append(temp);
}
}
return appendAST;
}
use of org.matheclipse.core.eval.EvalEngine in project symja_android_library by axkr.
the class IntervalSym method cos.
public static IAST cos(final IAST ast) {
EvalEngine engine = EvalEngine.get();
return mutableProcessorConditions(ast, (min, max, result, index) -> {
IAST difference = F.Subtract(max, min);
if (engine.evalGreaterEqual(difference, F.C2Pi)) {
// difference >= 2 * Pi
result.append(index, F.list(F.CN1, F.C1));
} else {
// slope from 1st derivative
double dMin = engine.evalDouble(F.Sin(min).negate());
double dMax = engine.evalDouble(F.Sin(max).negate());
if (engine.evalLessEqual(difference, S.Pi)) {
if (dMin >= 0) {
if (dMax >= 0) {
result.append(index, F.list(F.Cos(min), F.Cos(max)));
} else {
result.append(index, F.list(F.Min(F.Cos(min), F.Cos(max)), F.C1));
}
} else {
if (dMax < 0) {
result.append(index, F.list(F.Cos(max), F.Cos(min)));
} else {
result.append(index, F.list(F.CN1, F.Max(F.Cos(min), F.Cos(max))));
}
}
} else {
// difference between {Pi, 2*Pi}
if (dMin >= 0) {
if (dMax > 0) {
result.append(index, F.list(F.CN1, F.C1));
} else {
result.append(index, F.list(F.Min(F.Cos(min), F.Cos(max)), F.C1));
}
} else {
if (dMax < 0) {
result.append(index, F.list(F.CN1, F.C1));
} else {
result.append(index, F.list(F.CN1, F.Max(F.Cos(min), F.Cos(max))));
}
}
}
}
return true;
});
}
use of org.matheclipse.core.eval.EvalEngine in project symja_android_library by axkr.
the class Symbol method addAttributes.
/**
* {@inheritDoc}
*/
@Override
public final void addAttributes(final int attributes) {
fAttributes |= attributes;
if (isLocked()) {
throw new RuleCreationError(this);
}
EvalEngine engine = EvalEngine.get();
engine.addModifiedVariable(this);
}
use of org.matheclipse.core.eval.EvalEngine in project symja_android_library by axkr.
the class Symbol method clearAttributes.
/**
* {@inheritDoc}
*/
@Override
public void clearAttributes(final int attributes) {
fAttributes &= (0xffffffff ^ attributes);
if (isLocked()) {
throw new RuleCreationError(this);
}
EvalEngine engine = EvalEngine.get();
engine.addModifiedVariable(this);
}
use of org.matheclipse.core.eval.EvalEngine in project symja_android_library by axkr.
the class Symbol method setAttributes.
/**
* {@inheritDoc}
*/
@Override
public void setAttributes(final int attributes) {
fAttributes = attributes;
if (isLocked()) {
throw new RuleCreationError(this);
}
EvalEngine engine = EvalEngine.get();
engine.addModifiedVariable(this);
}
Aggregations