1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
%*
Create 3 points A, B and C in GeoGebra.
*/
%mathpiper,title=""
/*
The GeoGebra() function is used to tell the system which GeoGebra objects
should be inserted into the MathPiper environment. The names of the
objects are sent to the GeoGebra() function in a comma separated list.
*/
GeoGebra()["updateObjects"] := "A,B,C,f,g";
/*
GeoGebraPoint() is an experimental function which directly places points
into GeoGebra. The first parameter is the name of the point, the second
parameter is its x coordinate, and the third parameter is the name of
its y coordinate.
*/
GeoGebraPoint("A",1,2);
GeoGebraPoint("B",2,2);
GeoGebraPoint("C",1,1);
%/mathpiper
%output,preserve="false"
Result: java.lang.Boolean
. %/output
%mathpiper, output="latex"
ax := A["coords"]["x"];
ay := A["coords"]["y"];
bx := B["coords"]["x"];
by := B["coords"]["y"];
cx := C["coords"]["x"];
cy := C["coords"]["y"];
%/mathpiper
%hoteqn,preserve="false"
Result: 1.0
. %/hoteqn
%mathpiper, output="geogebra"
bez1(a,b,r) := a*(1-r)+b*r;
bez2(a,b,c,r) := bez1(a,b,r)*(1-r) + bez1(b,c,r)*r;
f(x) := Expand(bez2(ax,bx,cx,x));
f(x);
%/mathpiper
%geogebra,preserve="false"
Result: 2.0*x-2.0*x^2+1
. %/geogebra
%output,preserve="false"
GeoGebra updated.
. %/output
%mathpiper, output="geogebra"
g(x) := Expand(bez2(ay,by,cy,x));
g(x);
%/mathpiper
%geogebra,preserve="false"
Result: 2.0-x^2
. %/geogebra
%output,preserve="false"
GeoGebra updated.
. %/output
%geogebra, clear="false"
curve : curve[f(t),g(t),t,0,1]
%/geogebra
%output,preserve="false"
GeoGebra updated.
. %/output
%mathpiper, output="latex"
{f(x), g(x)};
%/mathpiper
%hoteqn,preserve="false"
Result: \left(2x-2x^{2}+1,2-x^{2}\right)
. %/hoteqn
%output,preserve="false"
HotEqn updated.
. %/output
|