mathsdk 0.3.1
mathsdk: ^0.3.1 copied to clipboard
Native symbolic math engine (SymEngine-backed) for Flutter via dart:ffi — evaluation, calculus, equation solving, and matrix operations.
Changelog #
0.3.1 #
- Equation steps now read like a student's work. Linear equations, and
quadratics without an
xterm, are solved by applying the same operation to both sides:9*x = 9becomes(9*x)/9 = 9/9and thenx = 1, instead of-9 + 9*x = 0. New rules:subtract_both_sides,add_both_sides,multiply_both_sides(used for fractional and-1coefficients),divide_both_sides,swap_sidesandsquare_root_both_sides. - Those steps carry the new
MathStep.operand, naming what was applied, such as9. - Equation steps write polynomials with the highest power first
(
x**2 - 5*x + 6), as written by hand.
0.3.0 #
- Step-by-step solutions for every operation. Each call now has a
*Stepsvariant returning the same result plus a JSON trace of{before, after, rule}steps, and a typed*WithStepsvariant inMathSdkTypedthat parses the trace intoMathSteps:substitute,derivative,solve(solveRootsWithSteps),solveLinearSystem(solveSystemWithSteps),limit,integral,series,matrixOpandodeSolveSeparable. Rules are stable snake_case names such aspower_rule,chain_rule,quotient_rule,discriminant,quadratic_formula,rational_root_test,cramer_rule,cofactor_expansionanddirect_substitution. The trace is never empty: input outside the detailed rules gets a single step. evaluateSteps/evaluateWithStepsnow trace any expressionevaluateaccepts, including symbols, constants and functions, instead of throwingMATHSDK_STATUS_NOT_IMPLEMENTEDoutside plain arithmetic. Steps that only reorder terms are no longer reported.- Fixed:
solvereturned roots that make a denominator zero, such asx = 1for(x^2 - 1)/(x - 1) = 0. They are now discarded. - Fixed:
seriesincluded the term of the same degree as itsOterm, e.g.exp(x)withorder: 3returned... + (1/6)*x**3 + O(x**3). It now stops below theOterm. solvenow returns exact rational roots for cubic and higher polynomials when every factor has one, e.g.1, 2, 3forx^3 - 6*x^2 + 11*x - 6 = 0instead of nested Cardano radicals.
0.2.1 #
- Fixed:
solveandsolveRootsreported no solution for equations the native solver cannot handle, such assqrt(x) = 3orexp(x) = 1, and dropped roots of products such asx*sqrt(x - 1) = 0. Equations that are not polynomial or rational in the variable now throw aMathSdkExceptionwithMATHSDK_STATUS_NOT_IMPLEMENTED.
0.2.0 #
- Fixed: the package could not build when installed from pub.dev. The
Android build referenced native sources above the package directory, which
the published archive does not contain. Gradle now downloads a prebuilt
libmathsdk.soper ABI from the matching GitHub release, and still builds from source forpath:dependencies on a repository checkout. - Added
armeabi-v7aalongsidearm64-v8aandx86_64. Only the ABIs your build actually targets are downloaded. MathSdk.open()is now a per-isolate singleton instead of loading the library and resolving symbols again on every call.- Added the
MathSdkAsyncextension:evaluateAsync,derivativeAsync,solveAsync,integralAsync,seriesAsync, andmatrixOpAsyncrun on a background isolate so heavy symbolic work does not block the UI isolate. - Added typed accessors so callers stop hand-parsing the native output:
solveRoots,solveSystem,matrix(returningMathMatrix), andevaluateWithSteps(returningMathSteps). The raw-string methods are unchanged. - Documented the
orderlimits onderivative(1-10) andseries(1-20), which the native library enforces. - Documented the measured cost of each operation on
MathSdkAsync, so the choice between the synchronous and background-isolate variants is based on numbers rather than guesswork. - Prebuilt libraries are verified against the
SHA256SUMSpublished with the release. A truncated or altered download now fails the build with a clear message instead of being packaged into the APK and failing at runtime. - Prebuilt libraries are cached under the Gradle home instead of
build/, soflutter cleanno longer forces a re-download on every build. - Fixed
MathSdk.versionreporting0.1.0. The version now comes frompubspec.yamlalone, instead of being repeated in the native CMake build and the Android Gradle build. - A native call that reports success without writing a result now throws
MathSdkExceptioninstead of dereferencing a null pointer. - Documented
MathSdkStatusand each of its values, plus instance lifetime and isolate behaviour.
0.1.1 #
Added dartdoc comments to the public API and shortened the package description. No functional changes.
0.1.0 #
Initial release. Wraps MathSDK's native C ABI (native/include/mathsdk/math_sdk.h)
via dart:ffi:
evaluate,evaluateSteps— exact expression evaluation, with a step-by-step reduction trace for the arithmetic subset.substitute,evaluateNumeric— variable substitution and numeric (double) evaluation.derivative,integral,series,limit— calculus operations, each documented in the native header with its exact coverage and ceiling.solve,solveLinearSystem— equation and linear system solving.matrixOp— determinant, inverse, transpose, add, multiply.odeSolveSeparable— separable first-order ODEs only.
Android only in this version (Gradle externalNativeBuild compiles the
native library from source — no prebuilt binaries are shipped or copied by
hand). iOS/desktop support is tracked separately; see the root MathSDK
repository's README for platform status.