code: public static SameDiff create(SameDiff originalSameDiff) {
          SameDiff ret = SameDiff.builder()
                  .sameDiffFunctionInstances(originalSameDiff.sameDiffFunctionInstances)
                  .build();
          ret.variables.putAll(originalSameDiff.variables);
          //ensuring proper sameDiff reference
          DifferentialFunctionFactory differentialFunctionFactory = new DifferentialFunctionFactory(ret);
          ret.functionFactory = differentialFunctionFactory;
          return ret;
      }
docs: Create a new SameDiff instance from an existing instance.
  Note that state (variables and functions) is shared between the two SameDiff instance
  
  @param originalSameDiff Original SameDiff instance
  @return Copy