Full output in function definition
Publié : dim. nov. 11, 2018 2:16 pm
Hello, BP.
Idea: When defining a function, return the complete definition expression, with the purpose of recovering it in a subsequent operation.
f1(x) := 2*x -3; [enter] returns currently (x) -> 2*x-3
=> f1 := x -> 2*x-3
f2(x) := x² + 1; [enter] f2 := x -> x² + 1
autosimplify(0):; f3(x):=f1(f2(x)) [enter] f3 := x->f1( f2(x) )
[edit Ans(-1)]
f3 := x->f2( f1(x) )
f4 := unapply(f1(f2(x)),x) [enter] f4 := x->2*(x^2+1)-3
unapply(2*x^2,x) [enter] x->2*x^2
Thank you
Idea: When defining a function, return the complete definition expression, with the purpose of recovering it in a subsequent operation.
f1(x) := 2*x -3; [enter] returns currently (x) -> 2*x-3
=> f1 := x -> 2*x-3
f2(x) := x² + 1; [enter] f2 := x -> x² + 1
autosimplify(0):; f3(x):=f1(f2(x)) [enter] f3 := x->f1( f2(x) )
[edit Ans(-1)]
f3 := x->f2( f1(x) )
f4 := unapply(f1(f2(x)),x) [enter] f4 := x->2*(x^2+1)-3
unapply(2*x^2,x) [enter] x->2*x^2
Thank you