Enhancement: solve(a,b) function

Issue #257 new
Former user created an issue

Originally reported on Google Code with ID 257

I have a suggestion for an enhancement:
A solve(a;b) function should be implemented.

This function would accept:
   a: an equation including variables (initialized and uninitialized),
functions, and numbers
   b: a variable to solve the equation for

This function would return:

either a number, or a mixture of numbers and uninitialized variables


Test Case:

solve(1=sin(x);x) returns 1.57079633...

solve(x^2 + x + 1 = 3;x) returns 1 and -2

solve( 2x = 3y,x) returns 3y/2 (y is not initialized)


The real difficulty in creating this function would be the different
outputs that can come from solving some equations, for instance multiple
answers, complex answers, catching when equations cannot be solved, and
dealing with uninitialized variables, and including uninitialized variables
in the output. This more complex function may break too many of the
conventions of speedcrunch (returning only a number, using uninitialized
variables).

A scaled down version could return error in all cases where the answer
would not be strictly a single numeric result and when a user tries to pass
the function an uninitialized variable, until concepts such as complex
numbers can be added to speedcrunch. (This would be an error just like
trying to sqrt(-1) currently throws an error).

The idea for this function was shamelessly stolen from the solve function
of the ti-89. It saves a lot of time simplifying equations for us lazy
folk, but the ti-89 is expensive and slow.

Reported by onlngenius on 2009-02-20 01:20:02

Comments (3)

  1. Former user Account Deleted
    +1 I expected speedcrunch to already have a solver.
    

    Reported by john.t.bullock on 2014-10-23 20:31:39

  2. Former user Account Deleted

    Reported by helder.pereira.correia on 2014-11-28 17:30:00 - Labels added: Type-Enhancement

  3. Log in to comment