Simple but significant improvements to the XCAS configuratio

Messages in english

Modérateur : xcasadmin

Répondre
compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Simple but significant improvements to the XCAS configuratio

Message par compsystems » mar. juin 27, 2017 2:32 pm

Hello Bernard

Thinking as a student and not as an expert in GUI handling, the XCAS configuration fields should show list of options instead of the user typing keyword

Please to adhere the fields of simplification
nop
regroup
simplify

Similarly for other fields and for numerical input fields domains verify the input, eg if the maximum number of recursions is 100, do not allow to enter numbers greater than this

Thank you very much, I hope this is easy to improve.

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » mar. juin 27, 2017 2:47 pm

If you want me to change something, you must convince me it's important, for example you should give precise examples of problems that occured to real students. It's indeed easy to make suggestions, but it take much more time to implement them, it's boring and in the end, I'm not certain Xcas will really be used by more students because I spent some time doing that.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » mer. juin 28, 2017 2:05 pm

The following input-outputs deduce step by step the two solutions of the quadratic equation.

If the autosimplify flag is in none (nop), the outputs are exactly as shown below

Code : Tout sélectionner

1:(a*x^2+b*x+c) = 0
a*x^2+b*x+c=0

2: ans(-1)*4*a
(a*x^2+b*x+c)*4*a=0

3: ans(-1)+b^2
(a*x^2+b*x+c)*4*a+b^2=(b^2)

4: expand(ans(-1))
4*a^2*x^2+4*a*b*x+b^2+4*a*c=(b^2)

5: ans(-1)-4*a*c
4*a^2*x^2+4*a*b*x+b^2+4*a*c-4*a*c=(b^2-4*a*c)

6: simplify(ans(-1))
4*a^2*x^2+4*a*b*x+b^2=(-4*a*c+b^2)

7: factor(ans(-1)) 
(2*a*x+b)^2=(-4*a*c+b^2)

8: √(ans(-1))
abs(2*a*x+b)=(√(-4*a*c+b^2))

9: list[subst(ans(-1),'abs','nop'), subst(ans(-1),'abs','neg')] 
list[2*a*x+b=(√(-4*a*c+b^2)),-2*a*x-b=(√(-4*a*c+b^2))]

10: list[ans(-1)[0]-b, ans(-1)[1]+b]
list[2*a*x+b-b=(√(-4*a*c+b^2)-b),-2*a*x-b+b=(√(-4*a*c+b^2)+b)]

11: expand(ans(-1))
list[2*a*x=(-b+√(b^2-4*a*c)),-2*a*x=(b+√(b^2-4*a*c))]

12: list[ ans(-1)[0]/(2*a), ans(-1)[1]/(-2*a)] 
list[2*a*x/(2*a)=((-b+√(b^2-4*a*c))/(2*a)),2*a*x/(2*a)=(-(b+√(b^2-4*a*c))/(2*a))]

13: expand(ans(-1))
list[x=(-b/(2*a)+(√(b^2-4*a*c))/(2*a)),x=(-b/(2*a)-(√(b^2-4*a*c))/(2*a))]
If the autosimplify flag is different from none, the outputs are affected in certain parts

5: ans(-1)-4*a*c
4*a^2*x^2+4*a*b*x+b^2+4*a*c-4*a*c=(b^2-4*a*c)

->
4*a^2*x^2+4*a*b*x+b^2=(-4*a*c+b^2)

Then I tell my students, so that the output is exactly as expected after executing the script, EDIT / EXECUTE WORKSHEET should change the flag to NOP, but many ask me how to do it, I tell them by writing the parameters (nop, regroup, simplify) and many of them are confused. For this reason, instead of writing the parameters, they should be as a menu of options to choose from.

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » mer. juin 28, 2017 3:22 pm

I don't want to put a chooser here, because the user may want to choose his own simplification routine outside of nop, regroup and simplify, but I can replace these three choices by 0, 1 and 2, this should be easier for your students. I mean, you can already enter 0, 1 or 2 but instead of displaying the choice by nop, regroup and simplify, I will display them as 0, 1 or 2.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » mer. juin 28, 2017 7:26 pm

Now I understand why it's a writing field.
Idea: It could display a chooser for default cases [nop, regroup and simplify] and next to it, a write field for additional simplifications.

The above code can see that I have to put LIST[] to treat it as a list, otherwise it will be polynomial, why?

In order not to make many changes between the hp-prime code and another CAS, it is feasible a new ANSWER command that reads the rows as positive numbers

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » jeu. juin 29, 2017 6:09 am

compsystems a écrit :Now I understand why it's a writing field.
Idea: It could display a chooser for default cases [nop, regroup and simplify] and next to it, a write field for additional simplifications.
But that's much more work. I think 0, 1 or 2 is good enough.
The above code can see that I have to put LIST[] to treat it as a list, otherwise it will be polynomial, why?
If you do not precise the subtype with poly1[ or list[ or ..., the system will choose a default action, it might be consider the list as a 1-d polynomial, or a vector, etc.
In order not to make many changes between the hp-prime code and another CAS, it is feasible a new ANSWER command that reads the rows as positive numbers
As explained several times, I won't change ans because I do not want to support it in a GUI, it's a commandline interface command.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » dim. juil. 02, 2017 8:23 pm

Is there command to change the simplification flag?, in this way the previous script would be executed automatically without having to do a manual adjustment of the simplification mode

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » lun. juil. 03, 2017 5:49 am

autosimplify(nop)

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » mer. juil. 05, 2017 8:57 pm

In the onlinehelp I also note autosimplify(factor), please you can put an example showing the utility.

Thanks

I also note that autosimplify(-1) returns the current parameter of configuration, please document it on onlinehelp

With the flag simplify none, I think that the sentences 9=9; evalb(ans(-1));
should be evaluated, because it currently returns the same entry, can be seen in the following screenshot

9=9; evalb(ans(-1)); -> evalb(ans(-1)) :cry: -> true 8)

Image

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » ven. juil. 07, 2017 3:05 pm

Assign identifiers to each line, for do not use the ANS command, also the EVALB operator does not work


evalb(test1) returns evalb(test1)

Code : Tout sélectionner

 1: autosimplify(nop)
    1
 2: list0 := [ y = x^2, y = 2*x + 3 ]
   [y=(x^2),y=(2*x+3)]
 3: expr0 := subst(list0(2),list0(1))
   x^2=(2*x+3)
 4: expr0 := expr0-(2*x + 3) 
   -2*x-3+x^2=(2*x+3-2*x-3)
 5: simplify(expr0)
   x^2-2*x-3=0
 6: expr0 := factor(expr0)
   (x-3)*(x+1)=0
 7: list1 := [ part(left(expr0),1)=0, part(left(expr0),2)=0 ] 
    [(x-3)=0,(x+1)=0]
 8: [list1 := [list1(1)+3, list1(2)-1 ]
    [(x-3+3)=3,x=(-1)]
 9: list1 := simplify(list1)
    [x=3,x=(-1)]
 10: y1 := subst(list0(1),list1(1))
   y=9
 11: y2 := subst(list0(1),list1(2))
   y=1
 12: subst(list0(2),list1(1)) 
   y=9
 13: subst(list0(2),list1(2))  
    y=1
 14: sols := [[list1(1),y1],[list1(2),y2]]
 [[x=3,y=9],[x=-1,y=1]]
 15: test1 := subst(list0(1),[sols(1,1),sols(1,2)])
    9=9
 16: evalb(test1)
    returns evalb(test1)
 17: test1 := subst(list0(1),[sols(2,1),sols(2,2)])
    1=1
 18: evalb(test1)
    returns evalb(test1)

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » ven. juil. 07, 2017 3:16 pm

yes, this is not related to ans, I will fix this.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » ven. juil. 07, 2017 3:43 pm

If evalb returns true or false, the output is more explicit, since at first sight 1 looks like a solution value, I think that xcas should return all the symbolic tests true/false instead of 1 or 0, and the EVAL command, take it to numerical

evalb(9=9) -> true
eval (true) -> 1

Another constant that I want to see is DONE as a value of 1

autosimplify(simplify) -> 1
best
autosimplify(simplify) -> Done
eval (Done) -> 1

Image

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » sam. juil. 08, 2017 4:44 pm

I will modify evalb to return true/false. There is nothing to do to convert them to 1 and 0, since true *is* already 1 (it has a special subtype to be displayed as true but it's value is 1).

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par compsystems » lun. juil. 10, 2017 4:11 pm

Thanks BP, waiting for a Xcas compiled version to test

A utility

Eng: Check that the number 496 is a perfect number, ie the sum of all divisors is double of 496

Spn: Compruebe que el numero 496 es un numero perfecto, es decir la suma de todos los divisores es el doble de 496

test:=496*2=sum(idivis(496)) returns
992=992

evalb(test) returns
true

---------------

A question with autosimplify(nop), ¿why in the line #8, has simplified the expression x+1-1=-1 to x=-1? Should be similar x-3+3=3

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Simple but significant improvements to the XCAS configur

Message par parisse » lun. juil. 10, 2017 5:41 pm

There is specific code for +1 and -1 because it happens frequently when switching from 0-based indexes to 1-based indexes.

Répondre