Hi
I give you an
example.
If you run the following lines in maple you will
get a tensor
********************
A:=array(1..3,1..3,[[a,0,0],[0,a,0],[0,0,a]]):
tensor[create]([-1,-1],eval(A) );
************************
However if you run ir in maplet you
recieve the Evaluate_result message.have a go:
********************************
with(Maplets[Elements]):
maplet := Maplet( Window( 'title'="test", [
["g_compts ", TextField['TF1'](( 'value' = array(1..3,1..3,[[a,0,0],[0,a,0],[0,0,a]]),60))],
TextBox['TB1']('editable' = 'true', 3..40 ),
[Button("create tensor", Evaluate('TB1' = 'tensor[create]([-1,-1],eval(TF1) )' )),
Button("OK", Shutdown(['TF1', 'TB1']))]
] ) ):
Maplets[Display]( maplet );
*******************************************
The problem is that you can not create tensors in maplet!
hossein

Hi
I give you an
example.
If you run the following lines in maple you will
get a tensor
********************
A:=array(1..3,1..3,[[a,0,0],[0,a,0],[0,0,a]]):
tensor[create]([-1,-1],eval(A) );
************************
However if you run ir in maplet you
recieve the Evaluate_result message.have a go:
********************************
with(Maplets[Elements]):
maplet := Maplet( Window( 'title'="test", [
["g_compts ", TextField['TF1'](( 'value' = array(1..3,1..3,[[a,0,0],[0,a,0],[0,0,a]]),60))],
TextBox['TB1']('editable' = 'true', 3..40 ),
[Button("create tensor", Evaluate('TB1' = 'tensor[create]([-1,-1],eval(TF1) )' )),
Button("OK", Shutdown(['TF1', 'TB1']))]
] ) ):
Maplets[Display]( maplet );
*******************************************
The problem is that you can not create tensors in maplet!
hossein

Hi Alec
when I looked at your solution carefully I realised that the one displayed in MathMLviewer is not a tensor.
in fact by executing the following lines in maple
> with(tensor):
> g_compts:=array(symmetric,sparse,1..4,1..4):
> g_compts[1,1]:=(1-2*m/r): g_compts[2,2]:=-1/g_compts[1,1]:
> g_compts[3,3]:=-r^2: g_compts[4,4]:=-r^2*sin(th)^2:
> g:=create([-1,-1], eval(g_compts));
we see that the tensor is
TABLE([compts = matrix([[1-2*m/r, 0, 0, 0], [0, -1/(1-2*m/r), 0, 0], [0, 0, -r^2, 0], [0, 0, 0, -r^2*sin(th)^2]]), index_char = [-1, -1]])
which is different from yours.
The difference is that the whole thing is inside a 'TABLE[]'.Then is become a tensor.
I need that to be a tensor because i need it in the later steps.
Now please help me with this one.
Thanks in advance.
Regards
Hossein

thanks very much, Alex. that was what I really needed.

More generally, I would like to create a maplet
that by giving a seconf rank covaiant metric
the user can get different genral relativity
objects.
At the first step, say I enter
an array in the maplet in a textbox
and then creating a metric via the Evaluate
command. This can not be done in maplet. (notable
that I only found examples of maplets that
evaluates integrals or derivalites).
for example:
I need to enter the metric componenets as follows
g_compts:=array(symmetric,sparse,1..4,1..4):
g_compts[1,1]:=(1-2*m/r): g_compts[2,2]:=-1/g_compts[1,1]:
g_compts[3,3]:=-r^2: g_compts[4,4]:=-r^2*sin(th)^2:
and need to create and display the metric by
using the code
g:=create([-1,-1], eval(g_compts));
How this in Maplet?!
regards
Hossein