So... what if instead of concrete values, we could have elements of groups, fields and rings? Like
public abstract class Group
{
public abstract ElementOfRing Add(ElementOfRing left, ElementOfRing right);
public abstract Zero();
// etc
}
public abstract class Ring : Group
{
public abstract ElementOfRing Multiply(ElementOfRing left, ElementOfRing right);
// etc
}
public abstract class Field : Ring
{
}
public abstract class ElementOfRing
{
// etc
}
And for sample, there will be
public static ElementOfRing Multiply(ElementOfGroup a, ElementOfGroup b)
=> (a, b) switch
{
(ElementOfField ea, ElementOfField eb) => field.Add(ea, eb)
_ => ...
}
There should be definitely more thoughts on it. We need to check how, say, SymPy does it.
So... what if instead of concrete values, we could have elements of groups, fields and rings? Like
And for sample, there will be
There should be definitely more thoughts on it. We need to check how, say, SymPy does it.