Skip to content

.solve() doesn't work for variables under certain conditions #261

@exoRift

Description

@exoRift

Description

.solve() doesn't work sometimes

It seems that .solve() doesn't work for certain variables under certain conditions. I think when another unknown variable comes lexically before, it doesn;t work

Steps to Reproduce

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

const ce = new ComputeEngine()

const parsed = ce.parse('b+2a = 3')

console.debug(parsed.solve('b')?.map((r) => r.toLatex()))
// ^ Logs [] (incorrect, expected `3-2a`)
console.debug(parsed.solve('a')?.map((r) => r.toLatex()))
// ^ Logs ['\\frac{3}{2}-\\frac{b}{2}'] (correct)

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