Properties
Similar Topics
Statistics
Comments
9
Participants
3
Subscribers
3
Votes
1
Views
327
Share
User created vector (or list) function?
Answered
I would like to create a function which takes a list as input and returns a list as output, something like
shift(x) = Flatten(Append(take(x,2),first(x)))
which is supposed to shift the first element to the last place. (This is just an example). The idea was that I'd then iterate this function using IterationList.
I've tried using both the Algebra and CAS views, and they both give me errors. I know I could probably do what I wanted with the spreadsheet, but I would much prefer to use a function, such as above.
Can this be done? Thanks!
 GeoGebra
 Help
 Partners

Contact us
 Feedback & Questions
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 +43 677 6137 2693
© 2020 International GeoGebra Institute
You have to define userfunctions with „keep input“ in CAS
II don’t know how to do this in algebra view?
Thank you! I can see how that is meant to work. I'm also trying to apply it to some matrix functions, for example, in the CAS view:
but as you see all I get is a question mark. I would love to be able to write a matrixvalued function, using the Keep Input Tool (or any other way), but I can't get it to work. I had already previously defined the matrices D and a. Do I have to explicitly define my function mm to return a matrix? How can I get my function to work? Again, many thanks!
Thank you! I can see how that is meant to work. I'm also trying to apply it to some matrix functions, for example, in the CAS view (which I attach as an image) but as you see all I get is a question mark. I would love to be able to write a matrixvalued function, using the Keep Input Tool (or any other way), but I can't get it to work. I had already previously defined the matrices D and a. Do I have to explicitly define my function mm to return a matrix? How can I get my function to work? Again, many thanks!
I used to add a take around usermatrixfunctions to make it work
see https://www.geogebra.org/m/c6Q7gDmC
Line 1  if this is your question?
more examples to usermatrixfunctions
https://www.geogebra.org/m/j3fqtfcn, https://www.geogebra.org/m/bk6g7h62 (line 2)
Many thanks again!  yes, the use of Take seems to work. I am in fact trying to write the Jacobi and GaussSeidel iterations, for my students to play with. I've almost got it, the combination of Take and the use of Keep Input Tool proves me now with a usable function. However, I can't iterate it. I've defined a function "jc" which does one Jacobi iteration; it takes a 3x1 matrix as input and returns another 3x1 matrix as output. And it can be nested: "jc(jc(jc(v))) " works fine.
But it won't work with Iteration. I thought that "Iteration(jc,v,3)" would produce exactly the same output as my nested functions... but it produces a horrible mess of nested matrices:
This is one of the things I find really annoying about GeoGebra: that its function behaviour is never quite as straightforward as you'd like. And it doesn"t really have a proper programming interface: the scripting and tools is more complicated than it needs to be.
Anyway, thank you again for your help and for the links to your remarkable and lovely 3D GeoGebra uploads, and I'll keep fiddling away.
Programing is really very special in ggb. Do know SMath a Mathcad clone with a paperlike Interface  very interesting?
If you will provide the file I will have a glance about it
Some thiing like
https://www.geogebra.org/m/zzjzgzwt
yo habitualmente cuando quiero funciones que GG no tiene de forma interna suelo crear una herramienta personal que simule una función, por ejemplo creo a, defino D*a con D escrita termino a termino en la instruccion y una heramienta mm con entradas , a y salida D*a entonces con escribir por ejemplo mm(b) simulo mm(x) para x=b. el efecto es muy parecido puesto que mm no tiene representacion
Comments have been locked on this page!