Author Topic: Help overcoming Symbolic bug  (Read 4800 times)

0 Members and 1 Guest are viewing this topic.

Offline Giacomo Pigani

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Help overcoming Symbolic bug
« on: November 07, 2016, 06:59:00 am »
I found a very annoying little bug with Symbolic

Code: [Select]
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

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: [Select]
If 1=1:Then   
    ClrHome
    Disp real(13,"X*X^2")
    Disp real(13,"2*3")
End

//Output:
// X^3 : Ok
// 6   : Ok
« Last Edit: November 07, 2016, 07:14:57 am by Giacomo Pigani »

Offline Giacomo Pigani

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Re: Help overcoming Symbolic bug
« Reply #1 on: November 07, 2016, 07:14:09 am »
Ok, so after about 5 hours of struggling, I was able to find a solution (thanks to Xeda112358, as always :P)

Code: [Select]
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

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Help overcoming Symbolic bug
« Reply #2 on: November 07, 2016, 03:00:27 pm »
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: [Select]
If 1=1:Then
    "X*X^2→Str1
    "2*3→Str2
    ClrHome
    Disp real(13,Str1)
    real(13,"X
    Disp real(13,Str2)
End
Also, for Batlib commands, of you have an argument of 0 before a string, you can omit it. For example:
Code: [Select]

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
As well, if the last few arguments are zero, you can omit them, too.

Offline Giacomo Pigani

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Re: Help overcoming Symbolic bug
« Reply #3 on: November 10, 2016, 04:18:58 pm »
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

Offline Giacomo Pigani

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Re: Help overcoming Symbolic bug
« Reply #4 on: November 11, 2016, 11:20:50 am »
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: [Select]
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

I also tested it with the Symbolic's derive and it works too
« Last Edit: November 11, 2016, 11:25:39 am by Giacomo Pigani »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Help overcoming Symbolic bug
« Reply #5 on: November 12, 2016, 07:07:13 am »
That's really clever! Is this bug only an issue when Batlib is installed? I'm worried that it might be a bug with Batlib or Batlib+Symbolic.

Offline Giacomo Pigani

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Re: Help overcoming Symbolic bug
« Reply #6 on: November 13, 2016, 05:41:31 pm »
No, don't worry... this is a Symbolic "feature" :-)