Hello,
I'm learning to use the python interface by trying to translate the
M-files in the tests/matlab directory into their python counterparts.
I start with tutorial1.m and things seem to go well until this line
R=gf_mesh_fem_get(mf, 'eval', {'(x-.5).^2 + (y-.5).^2 + x/5 - y/3'});
Here's the python equivalent I used:
R=mf.eval('(x[0] - 0.5)**2 + (x[1] - 0.5)**2 + x[0]/5.0 - x[1]/3.0')
I got this error traceback
</error>
([], array([], type=Int32))
Traceback (most recent call last):
File "tutorial1.py", line 50, in ?
R=mf.eval('(x[0] - 0.5)**2 + (x[1] - 0.5)**2 + x[0]/5.0 - x[1]/3.0')
File "/usr/lib/python2.4/site-packages/getfem/getfem.py", line 865,
in eval
x=P[:,0]; r=numarray.array(eval(expression))
IndexError: Index out of range
</error>
I think I don't know how to use the eval() function correctly.
Another question: is my understanding of the equivalence of types in the
matlab-interface document correct?
Matlab Python
ivec numarray rank-1 integer array (of default precision)
vec numarray rank-1 float array (of default precision)
imat numarray rank-2 integer array (of default precision)
mat numarray rank-2 float array (of default precision)
On my debian/sid amd64, the default precision for array elements are
Int64 and Float64, respectively.
If anyone is interested, after I get them working, I'm happy to share
them. But don't hold your breadth, :-) I just started my learning and I
can only do it intermittently. I'm sure I have to seek your help again.
Thanks in advance,
ST
--
_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users