Calculator Community > TI-BASIC

Help overcoming Symbolic bug

(1/2) > >>

Giacomo Pigani:
I found a very annoying little bug with Symbolic


--- Code: ---If 1=1:Then
    "X*X^2"→Str1
    "2*3"→Str2
   
    ClrHome
    Disp real(13,Str1)
    Disp real(13,Str2)
End

//Output:
// X^3 : Ok
// X^3 : Not Ok

--- End code ---

Basically, if I want to use the simplify function more than once inside an If statement and the functions I want to simplify are in a string, simplify will refuse to give the correct result. In this case for example, it returns the previous result.

However, if the actual string to simplify is given things seems to work out:


--- Code: ---If 1=1:Then   
    ClrHome
    Disp real(13,"X*X^2")
    Disp real(13,"2*3")
End

//Output:
// X^3 : Ok
// 6   : Ok

--- End code ---

Giacomo Pigani:
Ok, so after about 5 hours of struggling, I was able to find a solution (thanks to Xeda112358, as always :P)


--- Code: ---If 1=1:Then
    "X*X^2"→Str1
    "2*3"→Str2
   
    ClrHome
    Disp real(13,dim(11,0,"DStr1",length(Str1)))
    Disp real(13,dim(11,0,"DStr2",length(Str2)))
End

//Output:
// X^3 : Ok
// 6   : Ok

--- End code ---

Xeda112358:
I'm not sure why that could even be an issue. I don't have symbolic or access to link software, so  could you try this and see if it works :

--- Code: ---If 1=1:Then
    "X*X^2→Str1
    "2*3→Str2
    ClrHome
    Disp real(13,Str1)
    real(13,"X
    Disp real(13,Str2)
End

--- End code ---
Also, for Batlib commands, of you have an argument of 0 before a string, you can omit it. For example:

--- Code: ---
If 1=1:Then
    "X*X^2→Str1
    "2*3→Str2
   
    ClrHome
    Disp real(13,dim(11,"DStr1",length(Str1
    Disp real(13,dim(11,"DStr2",length(Str2
End

--- End code ---
As well, if the last few arguments are zero, you can omit them, too.

Giacomo Pigani:
The suggestion didn't  work sadly. I don't really know where that bug could originate from.
Also, I had to elaborate a cumbersome way to support the case where the string contained two-byte tokens, since length counts a two byte token as just one. Also, I found out that this type of errors happens also when using variables like A-Z, if inside an if

Giacomo Pigani:
So, I came up with a simple and really nice solution, although it can only apply to this specific problem with symbolic.
As a plus, it doesn't need other libraries apart from symbolic


--- Code: ---If 1=1:Then
    "X*X^2"→Str1
    "2*3"→Str2
   
    ClrHome
    Disp real(13,Str1+"+0")
    Disp real(13,Str2+"+0")
End

//Output:
// X^3 : Ok
// 6   : Ok

--- End code ---

I also tested it with the Symbolic's derive and it works too

Navigation

[0] Message Index

[#] Next page

Go to full version