function s = sym(x, varargin)
    % 构造函数：创建sympy.Symbol对象
    % 例如创建抽象符号 x = sympy.Symbol('x');
    % 带有条件的抽象符号 x = sympy.Symbol("x", "positive", "real")
    % 浮点数标量变符号 x = sympy.Symbol(1), 会尽可能转化为整数或分数
    % 浮点数矩阵变符号矩阵 x = sympy.Symbol([1 2; 1 3])
    % 创建抽象符号矩阵 x = sympy.Symbol(x, [2 2])
    % 注意，创建符号函数请使用 syms f(x)
    sp = sympy__sp;
    if nargin == 1
        if isstring(x) || ischar(x)
            s = sympy.Symbol(sp.Symbol(x)); return;
        elseif isa(x, "double")
            s = sympy__double2sym(x);
            if length(x) == 1
                s = sympy.Expr(s);
            else
                s = sympy.Matrix(s);
            end
            return;
        end
    end
    if ~(ischar(x) || isstring(x)); error("输入名字必须是字符串"); end

    if nargin == 2
        if isa(varargin{1}, "double")
            s = sympy.Matrix(sympy__creatematrix(x, varargin{1}));
            return;
        end
    end
    if ~all(cellfun(@(x)ischar(x)||isstring(x), varargin))
        error("assumption必须全部是字符串");
    end

    args = cell(1, length(varargin) * 2);
    args(1:2:end) = varargin; args(2:2:end) = true;
    s = sympy.Symbol(sp.Symbol(x, pyargs(args{:})));
end
