π
<-
Chat plein-écran
[^]

Challenge: XCAS code to anothers CAS

Pour le TI-Basic sur Nspire

Challenge: XCAS code to anothers CAS

Unread postby compsystems » 21 Mar 2018, 20:47

Challenge: Port the following code written in XCAS in tibasic, lua, etc on a calculator of texas instruments, casio, ..., as well as in other CAS (Mathematica, Maple, Symbolic toolbox (matlab), etc

Terms:
You can not use text strings to form expressions, only CAS commands


The following code, shows an exercise of the solution of a system step by step
Code: Select all
testCAS():={
   local y,x,list0,expr0,lsolx,y1,y2,sols,test1;
   purge(x,y);
   autosimplify(nop); autosimplify();
   approx_mode(0); approx_mode();
   DispG; ClrIO; printf("Solving a system of two equations"); printf("Solve the following system:");
   list0 := [ y = x^2, y = 2*x + 3 ]; printf(list0);
   printf("substitute y = x² in y = 2x + 3:");
   expr0 := subst(list0(2),list0(1)); printf(expr0);
   printf("substract 2x + 3:");
   expr0 := expr0-(2*x + 3); printf(expr0);
   printf("simplify:");
   expr0 := simplify(expr0); printf(expr0);
   printf("factor:");
   expr0 := factor(expr0); printf(expr0);
   printf("zero factor theorem:");
   lsolx := [ part(left(expr0),1)=0, part(left(expr0),2)=0 ]; printf(lsolx);
   printf("First factor plus 3, second minus 1:");
   lsolx := [lsolx(1)+3, lsolx(2)-1 ]; printf(eval(lsolx,1));
   printf("simplify"); printf("x values:");
   lsolx := simplify(lsolx); printf(lsolx);
   printf("y values:"); printf("Replace x values in the system, firts equation");
   y1 := subst(list0(1),lsolx(1)); printf(y1);
   printf("Replace x values in the system, second equation");
   y2 := subst(list0(1),lsolx(2)); printf(y2);
   printf("Solutions shaped as a array");
   sols:=[[lsolx(1),y1],[lsolx(2),y2]]; printf(sols);
   printf("Checking results:"); printf("Replace x and y values in the system, firts equation");
   test1 := subst(list0(1),[sols(1,1),sols(1,2)]); printf(test1);
   printf("Evaluate:");
   test1 := evalb(test1); printf(test1);
   printf("Replace x and y values in the system, second equation");
   test1 := subst(list0(1),[sols(2,1),sols(2,2)]); printf(test1);
   printf("Evaluate:");
   test1 := evalb(test1); printf(test1);
   sols := solve([ y = x^2, y = 2*x + 3 ],[x,y]); printf("Solutions:"); printf(sols);
   printf("Solutions shaped as a boolean expression:");
   sols := list2exp(sols,[x,y]); printf(eval(sols,1));
   printf("Graphing");
   plot([x^2,2*x+3],x);
   // DispHome
   return("Done");
}:;


Image
Last edited by compsystems on 21 Mar 2018, 20:54, edited 1 time in total.
User avatar
compsystems
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 40.2%
 
Posts: 256
Joined: 30 May 2011, 13:44
Gender: Male
Calculator(s):
MyCalcs profile

Re: Challenge: XCAS code to anothers CAS

Unread postby Ti64CLi++ » 21 Mar 2018, 20:49

I will try it :)
It's a good idea, maybe a lot of people will port it to a lot of calculator :p
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.3%
 
Posts: 3441
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi


Return to Nspire-Basic

Who is online

Users browsing this forum: No registered users and 12 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1608 utilisateurs:
>1571 invités
>32 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)