Skip to content

gr_poly_integral fails for polynomial over matrix ring #2105

@rburing

Description

@rburing

Example code:

#include <stdio.h>
#include "flint/gr_poly.h"

int main() {
    int status = GR_SUCCESS;

    gr_ctx_t ctx;
    gr_ctx_init_fmpq(ctx);

    gr_ctx_t mat_ctx;
    gr_ctx_init_matrix_ring(mat_ctx, ctx, 2);

    gr_poly_t f;
    gr_poly_init(f, mat_ctx);
    status |= gr_poly_gen(f, mat_ctx);

    printf("f = ");
    gr_poly_print(f, mat_ctx);
    printf("\n");

    status |= gr_poly_integral(f, f, mat_ctx);

    if (status == GR_SUCCESS) {
        printf("integral(f) = ");
        gr_poly_print(f, mat_ctx);
        printf("\n");
    } else {
        printf("failed to calculate integral(f)\n");
    }

    gr_poly_clear(f, mat_ctx);

    gr_ctx_clear(mat_ctx);
    gr_ctx_clear(ctx);

    flint_cleanup_master();

    return 0;
}

Output:

f = [[1, 0],
[0, 1]]*x
failed to calculate integral(f)

The reason is that gr_div_ui fails for elements of a matrix ring. For example:

    gr_ptr res;
    GR_TMP_INIT(res, mat_ctx);
    int my_status = gr_one(res, mat_ctx);
    my_status |= gr_div_ui(res, res, 12, mat_ctx);
    printf("success = %d\n", (my_status == GR_SUCCESS));
    GR_TMP_CLEAR(res, mat_ctx);

outputs success = 0, even though there would be a well-defined result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions