public static void RegisterTheorems(ILibrary library) { Analysis.DerivativeTransformation.Provider.Add( new Analysis.DerivativeTransformation(_entityId, delegate(Port port, SignalSet manipulatedInputs, Signal variable, bool hasManipulatedInputs) { Signal[] outputs = new Signal[manipulatedInputs.Count]; ReadOnlySignalSet sines = StdBuilder.Sine(port.InputSignals); for (int i = 0; i < outputs.Length; i++) { outputs[i] = sines[i] * manipulatedInputs[i]; } return(StdBuilder.Negate(outputs)); })); }
public static void RegisterTheorems(ILibrary library) { Analysis.DerivativeTransformation.Provider.Add( new Analysis.DerivativeTransformation(_entityId, delegate(Port port, SignalSet manipulatedInputs, Signal variable, bool hasManipulatedInputs) { Signal[] outputs = new Signal[manipulatedInputs.Count]; ReadOnlySignalSet squares = StdBuilder.Square(port.OutputSignals); Signal one = IntegerValue.ConstantOne; for (int i = 0; i < outputs.Length; i++) { outputs[i] = (one + squares[i]) * manipulatedInputs[i]; } return(StdBuilder.Negate(outputs)); })); MathIdentifier typeId = new MathIdentifier("TrigonometricSubstitute", "Std"); ITheoremProvider basicProvider; if (!library.TryLookupTheoremType(typeId, out basicProvider)) { basicProvider = Binder.GetInstance <ITransformationTheoremProvider, MathIdentifier>(typeId); library.AddTheoremType(basicProvider); } ((ITransformationTheoremProvider)basicProvider).Add( new BasicTransformation(_entityId.DerivePostfix("TrigonometricSubstitute"), typeId, delegate() { return(new Pattern(new EntityCondition(_entityId))); }, delegate(Port port) { return(ManipulationPlan.DoAlter); }, delegate(Port port, SignalSet transformedInputs, bool hasTransformedInputs) { Signal[] ret = new Signal[transformedInputs.Count]; for (int i = 0; i < ret.Length; i++) { ret[i] = StdBuilder.Cosine(transformedInputs[i]) / StdBuilder.Sine(transformedInputs[i]); } return(ret); })); }
public static void RegisterTheorems(ILibrary library) { Analysis.DerivativeTransformation.Provider.Add( new Analysis.DerivativeTransformation(_entityId, delegate(Port port, SignalSet manipulatedInputs, Signal variable, bool hasManipulatedInputs) { return(StdBuilder.Negate(manipulatedInputs)); })); Algebra.AutoSimplifyTransformation.Provider.Add( new Algebra.AutoSimplifyTransformation(_entityId, delegate(Port port) { // TODO return(ManipulationPlan.DoAlter); }, delegate(Port port, SignalSet manipulatedInputs, bool hasManipulatedInputs) { if (manipulatedInputs.Count == 0) { return(new SignalSet(IntegerValue.ConstantAdditiveIdentity)); } if (manipulatedInputs.Count == 1) { Signal s = manipulatedInputs[0]; if (Std.IsConstantAdditiveIdentity(s)) { return(new SignalSet(s)); } return(new SignalSet(Std.Negate(s))); } if (hasManipulatedInputs) { return(new SignalSet(StdBuilder.Negate(manipulatedInputs))); } return(port.OutputSignals); })); }
protected override MathNet.Symbolics.Signal NegateSignalCore() { return(StdBuilder.Negate(this)); }