Skip to content

Indefinite Integrals Don't evaluate correctly #260

@exoRift

Description

@exoRift

Description

The integration function doesn't seem to function correctly. It can't compute an antiderivative in some cases and in others it's plain wrong

Steps to Reproduce

import { ComputeEngine } from '@cortex-js/compute-engine'

const ce = new ComputeEngine()

console.log(ce.parse('\\int (2x)\' dx').evaluate().toLatex())
// Expected: Something equiv to: 2x
// Actual: \int\!x\mapsto2x^{\prime}\, \mathrm{d}x

console.log(ce.parse('\\int x \\sin(x) dx').evaluate().toLatex())
// Expected: Something equiv to: -x cos(x) + sin(x)
// Actual: \frac{1}{2}(\sin(x)x^2)-x\cos(x)

console.log(ce.parse('\\int 2x dx').evaluate().toLatex())
// Expected: Something equiv to: x^2
// Actual: 3x^2

console.log(ce.parse('\\int 2x^3 dx').evaluate().toLatex())
// Expected: Something equiv to: \frac{1}{4} x^4
// Actual: \frac{5x^4}{2}

Environment

Compute Engine version 0.30.2

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