Menu

#4 Enable EQC to find values indirectly

Future_release
open
Internal (4)
5
2014-10-10
2012-03-26
No

Example: z=x+y, I don't have x or y value, but I know that x+y=5, can iMath know that z=5 in this case?

Discussion

  • zeon_account_will_be_deleted

    Hello.

    This would be a very useful feature!

    Especially when the computing algorithm contains a lot of equations like this:
    FUNCTION ({none}, f, x)
    EQDEF y = (G - df/dx) + f(x_1)
    EQDEF f(x_1) = 5
    EQDEF df/dx = DIFFERENTIATE ([a + b exp(sqrt{1 + x^2})], x, 1)

    As the VAL() function can't return the value of y now, it's necessary to do use SUBST() a lot.

     

    Last edit: zeon_account_will_be_deleted 2014-09-04
  • Jan Rheinlaender

    Hi zeon,

    I'm not sure what your desired result is in this example. VAL() has the purpose of finding numerical values. Or at least to reduce complex equations to more simple equations. But it doesn't have the goal of substituting all possible equations. For this case I would prefer a new keyword like SUBSTALL. But then the result would depend very much on what equations have been defined before and if there are a lot of equations, the result might be quite unpredictable.

     
  • zeon_account_will_be_deleted

    Hi, Jan

    When we print VAL(y), we expect to get it's value. VAL() tries to do a numerical calculation as far as possible.
    So, VAL(y) returns "y = (50 - df/dx) + f(x_1)" now. It can't evaluate df/dx, because it is not a variable, it is an expression. It can't evaluate df or dx separately (this is reasonable!). And it can't evaluate f(x_1), because the equation f(x)=... doen't exist.

    Add a=7, b=3 and x=100 and we actually have everything to find numerical value of y. But iMath (or GiNaC) doesn't see it yet.
    It would be good if VAL() function could find numerical value of y at least if it's possible.

    Also I noticed, that VAL() works much faster then combinations of VAL() and SUBST(). I'll create some test files and post them soon.

     

    Last edit: zeon_account_will_be_deleted 2014-09-04
  • zeon_account_will_be_deleted

    Hi, Jan.

    I have an idea. Why don't you implement this feature inside the ITERATE() operator at first? I think this is good start. Example:

    @1@ z = x+y + n
    @2@ x+y = n^2 / z
    @3@ n = n + 1
    @result@ ITERATE (@1@;@2@;@3@, 1;1;1, 0;0;0, 100)

    This system has 4 unknown variables and only 3 equations. But "x+y" might be considered as solid variable in this case. And in this case we have a limited list of equations so the result should be quite predictable.

    For non iterative calculations perhaps we need some new operator, which collects several required equations. It might be SUBTALL(), but in this case it's better to do possible calculations after every single substitution to prevent large equations at the end.

    Or you may modify VAL(). Add the optional parameter at the end to let user specify what expressions might be considered as a variable. The same might be done for VALWITH(), NUMVAL() etc. Example:
    @1@ z = x + y + df/dx
    @2@ x + y = 5
    @3@ df/dx = 2 cos(a)
    @4@ VAL(z, df/dx; LHS(@2@))

     
  • Jan Rheinlaender

    Hi Vladislav,

    this is quite difficult to program so I don't think I will do this very soon...

     
  • zeon_account_will_be_deleted

    Okay, maybe we resume it in some future.

     
  • Jan Rheinlaender

    • Group: Next_Release --> Future_release
     

Anonymous
Anonymous

Add attachments
Cancel