Author Topic: Bugs with script  (Read 6782 times)

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Bugs with script
« on: August 30, 2008, 05:04:28 PM »
Hi!,
Thanks for this great software. I really like it. However, I got an error message :
                                   "Could not execute xcas properly : timeout. It seems as if xcas has hanged"
whenener I try to execute the following scipt
Start of script :
z:=ln(x^2*w+y^2)*sin(x*y+w)/(cos(y+1));
a:=1;da:=0.01;
b:=2;db:=0.02;
c:=3;dc:=0.03;
za:=abs(diff(z,x))*da;
zb:=abs(diff(z,y))*db;
zc:=abs(diff(z,w))*dc;
dz:=za+zb+zc;
zv:=approx(subst(subst(z,x=a,y=b),w=c));
"z=",zv;
"dz=",approx(subst(subst(dz,x=a,y=b),w=c));
End of script
PS: The same script works fine with the freeware "Cas commander v1.1b". But I prefer PocketCas as it is user frendly.

Some other suggestions for future release :
1. Include a on-line help with examples
2. Include the resolution of partial differential equations (PDEs)
3. Include plotting capabilities

By the way, what is the instruction to clear screen, within a script  ?

Thanks

Belaidi

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #1 on: August 31, 2008, 06:20:56 PM »
Code: [Select]
z:=ln(x^2*w+y^2)*sin(x*y+w)/(cos(y+1));
a:=1;da:=0.01;
b:=2;db:=0.02;
c:=3;dc:=0.03;
za:=abs(diff(z,x))*da;
zb:=abs(diff(z,y))*db;
zc:=abs(diff(z,w))*dc;
dz:=za+zb+zc;
zv:=approx(subst(subst(z,x=a,y=b),w=c));
"z=",zv;
"dz=",approx(subst(subst(dz,x=a,y=b),w=c));

PocketCAS only accepts one command per line at the moment, and it can't handle ;'s at the end of the line. More complex script support will be handled later. The timeout might occur also because xcas is working too long on this script, so PocketCAS assumes that the CAS has died.

Quote
PS: The same script works fine with the freeware "Cas commander v1.1b". But I prefer PocketCas as it is user frendly.

Can you give me a link so I can have a look at CAS commander? I can only find russian sites about it.

Quote
Some other suggestions for future release :
1. Include a on-line help with examples
2. Include the resolution of partial differential equations (PDEs)
3. Include plotting capabilities

1. Planned, but may take some time. There is a file aide_cas that is shipped with PocketCAS which already contains a mini-reference. I'm plan to have PocketCAS read out that file to provide you with a reference. But I don't have time to add such a complex feature at the moment, so you may have to wait some weeks or months.
2. support for this depends on xcas, and I don't know whether xcas supports it. You may try the desolve command which at least supports ODEs.
3. Planned, but only as a idea for the very far future.

Quote
By the way, what is the instruction to clear screen, within a script  ?

None, as there is no real scripting feature in PocketCAS yet. A "clear line" command would be possible, but rather useless as it could appear only once in a script (if you had two commands of that kind, all of those before the last one just wouldn't do anything). Would a feature to hide some commands in the output (e.g. by adding an @ before each line to be hidden) suffice, too?

You may also want to try to disable TeX mode (can be done via the menu), as that may speed up calculation.

Cheers

MrMage

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #2 on: September 01, 2008, 10:43:57 AM »
Thanks Mr. MrMage.   
@ before each line to be hidden would be ok.
Here is the link to Cas Commander :   http://www.hpc.ru/soft

Cheers

Belaidi
« Last Edit: September 01, 2008, 03:36:48 PM by MrMage »

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #3 on: September 01, 2008, 07:13:36 PM »
The following code works with the newest beta of PocketCAS (not released yet):

Code: [Select]
@z:=ln(x^2*w+y^2)*sin(x*y+w)/(cos(y+1))
@a:=1
@da:=0.01
@b:=2
@db:=0.02
@c:=3
@dc:=0.03
@za:=abs(diff(z,x))*da
@zb:=abs(diff(z,y))*db
@zc:=abs(diff(z,w))*dc
@dz:=za+zb+zc
@zv:=approx(subst(subst(z,x=a,y=b),w=c))
"z=",zv
"dz=",approx(subst(subst(dz,x=a,y=b),w=c))

Result is:

Code: [Select]
z=,1.884843
dz=,0.0020879

Is that correct?

But it takes about 35 seconds to execute on my 624 MHz PDA, so I think you don't want to do such heavy scripting on your mobile device. How long did that calculation take with CAS Commander?

I suppose it takes that long because there are very huge terms that have to be evaluated and printed out.

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #4 on: September 03, 2008, 09:19:49 AM »
It only takes 5 seconds to run the script using Cas Commander in my 200 MHz PDA !!

Belaidi

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #5 on: September 03, 2008, 11:34:55 AM »
I am working on a new version of PocketCAS, and I hope that your script will be executed faster with the new version, too.

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #6 on: September 18, 2008, 11:03:56 AM »
Unfortunately version 1.1.0 didn't fix the problems as expected. It still takes about 35 seconds to execute for me. Could you try it out on your device, please?

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #7 on: September 19, 2008, 10:44:50 AM »
I tried it on my PDA, and it is still very slow (compared to Cas Commander)
By the way, the author of Cas Commander pretend to have used a faster version of xcas (2à times faster !!).

Cheers

Belaidi

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #8 on: September 19, 2008, 10:45:58 AM »
I mean 20 times faster than the original xcas !!

Belaidi

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #9 on: September 19, 2008, 06:36:49 PM »
Well, AFAIK the only thing he made faster is loading of the CAS (which isn't necessary each time you want to calculate something anymore by using windows events, but I am using this now, too). I suppose I made something slower, maybe because my compilers are bad. But it's a real PITA to build all that stuff with a different compiler.

What do you mean with "very slow", by the way? Does it at least work now?

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #10 on: September 20, 2008, 07:34:19 AM »
 Well, I do a lot of maths and Physics that require speed. However, your program works perfectly.

Cheers

Belaidi

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #11 on: September 21, 2008, 05:37:15 PM »
How long does the calculation of the problem mentioned above take now on your PDA?

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #12 on: September 22, 2008, 01:17:55 PM »
It takes 43 sec to run the script in my 200 MHz PDA. But only took 5 sec using Cas Commander..
 

Offline MrMage

  • Administrator
  • *****
  • Posts: 475
  • Karma: 7
Re: Bugs with script
« Reply #13 on: September 22, 2008, 01:26:17 PM »
I have spoken to Mr. Parisse. He told me that the abs function has been changed in recent builds of xcas (which I am using, but Cas Commander is using older builds) which slowed things down a lot.

Try this code:

Code: [Select]
@z:=ln(x^2*w+y^2)*sin(x*y+w)/(cos(y+1))
@a:=1
@da:=0.01
@b:=2
@db:=0.02
@c:=3
@dc:=0.03
@za:=diff(z,x)*da
@zb:=diff(z,y)*db
@zc:=diff(z,w)*dc
@dz:=za+zb+zc
@zv:=abs(approx(subst(subst(z,x=a,y=b),w=c)))
"z=",zv
"dz=",abs(approx(subst(subst(dz,x=a,y=b),w=c)))

It executes in less than 2 seconds on my PDA and gives the correct result. Please tell me how long PocketCAS is taking on your device now to compute this. You can get precise estimates by deselecting Menu->Element->Display TeX after calculation.

Offline Belaidi

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Bugs with script
« Reply #14 on: September 23, 2008, 10:56:03 AM »
Hi MrMage,
 Thanks for the quick answer, I really appreciate that.
  Indeed, the script runs much quicker without the abs function. It took only 10 sec to run the script (see above) and only 1.5 sec if I get rid of the last 2 abs functions !!. It's great..
  But How do I use (or replace with) abs fuction in my script ?

Cheers

Belaidi