# How to exchange data between "algebra" view and "cas" view?

Gretel8 shared this problem 2 years ago
New

How to exchange data between "algebra" view and "cas" view?

geogebra version is 5.0.570.0-d (java 1.8.0_121-64bit, 910MB, Giac/JNI; 09 december 2019) from "http://www.geogebra.net/linux/"; repository.

OS is linux mint 19.3.

Lets consider example: find point "E" of intersection of lines "fa" and "fb" defined by points "A", "B", "C", "D". Such example chosen, because more complex example cause geogebra to crash more times.

Type following code into input bar

(coordinates may be random):

A : (0,0)

B : (1,1)

C : (1,0)

D : (0,1)

Type following code into "cas" lines:

eq1 := y(A)=ma*x(A)+ba

eq2 := y(B)=ma*x(B)+ba

eq3 := y(C)=mb*x(C)+bb

eq4 := y(D)=mb*x(D)+bb

eq5 := yE =ma*xE +ba

eq6 := yE =mb*xE +bb

eqs := {eq1,eq2,eq3,eq4,eq5,eq6}

unkns := {ma,mb,ba,bb,xE,yE}

sols := Solve(eqs,unks)

Type following code into input bar:

mas : Element(sols,1,1)

mbs : Element(sols,1,2)

bas : Element(sols,1,3)

bbs : Element(sols,1,4)

xEs : Element(sols,1,5)

yEs : Element(sols,1,6)

E : (xEs,yEs)

fa : y=mas*x+bas

fb : y=mbs*x+bbs

In the above code values of variables retrieved by index. How to get them by name? The values of same variables will be always available by same indexes or not?

If you change position, for example, of point "A" and press "Ctrl-R" to recompute all objects or call function "UpdateConstruction()", position of point "E" will not changed (because "cas" will not recalculate values). How to ask "cas" to recalculate values? You can place cursor to each of six "cas" lines (for "eq1", "eq2", ..., "eq6") and press "enter", but this is slow (and may erase user typed code (because of bug)). There are way to recalculate "cas" lines without manually reevaluate each line (may be create function "UpdateCAS()")?

There are better ways to transfer values ("ma", "mb", "ba", "bb", "xE", "yE") from "cas" to "algebra" (may be create function "GetFromCAS(\$1,xE)")?

List of found bugs.

- When you work with "cas", geogebra may crash with SIGILL. ggb file not provided because geogebra crashed. Not reproducible, but happened regularly, if "cas" used.

- If you unset checkbox "allow style bar" in "preferences" dialog, "style bar" of "cas" view still be visible (value of check box ignored). Reproducible always.

- If you set cursor to new "cas" line, press "up", copy expression, press "down", paste expression, edit expression, press "up", edit expression, press "enter" to reevaluate, edited expression sometimes lost; you may get empty line and need repeat copy-paste-edit cycle. Please, fix this bug to prevent type same code many times. Not reproducible, but happened regularly.

- If you place cursor in "cas" line, press "enter" to reevaluate, solution may be not found, some definitions may be removed. In my case content of "cas" line with call of "Solve()" become empty and definition of point "E" (was "E : (xEs,yEs)") was replaced on "E = ?". Please, if solution not found, return undefined, do not remove user typed code. Not reproducible, but happened regularly.

- Instead of lower index (subscript) "algebra" view may display html code like "f<sub><font size=\"-1\">1</font></sub>: -x + y = 0". To see bug use tool "line" to paint line by two points and rename line to "f_1". Reproducible always.

30 december 2019.

1

2

Nice prosa ;-)...

I dont know what you intending, but you should write top-down running code...

Perhaps you mean something like

```Alg:
P={A, B, C, D}
X=Sequence(x(P(j)), j, 1, Length(P))
Y=Sequence(y(P(j)), j, 1, Length(P))
CAS:
g(x):=m x + t [keep input]
eq:=Sequence(g( X(j) )-Y(j) ,j,1,Length(P))
mt:=Sequence(Flatten(Solve({Element(eq, k),Element(eq, Mod(k,Length(P))+1)},{m,t})),k,1,Length(P) )
G:=Sequence(Substitute(g(x), Element(mt, j)) , j,1,Length(P))```

Extend P by adding a Point E