File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 1- %% Copyright (C) 2016 Colin B. Macdonald
1+ %% Copyright (C) 2016-2017 Colin B. Macdonald
22%%
33%% This file is part of OctSymPy.
44%%
2424%% Example:
2525%% @example
2626%% @group
27+ %% @c doctest: +SKIP_IF(~strcmp(sympref('ipc'), 'native'))
2728%% syms x
2829%% f = 2*sin(x/2);
2930%% pyobject(f)
30- %% @result{} ans = [pyobject ... ]
31+ %% @result{} ans = [Python object of type sympy.core.mul.Mul ]
3132%%
3233%% 2*sin(x/2)
3334%%
3435%% @end group
3536%% @end example
36- %% @seealso{@@sym/char , py, @@pyobject/pyobject}
37+ %% @seealso{@@sym/sympy , py, @@pyobject/pyobject}
3738%% @end defmethod
3839
3940
4041function y = pyobject (x )
4142
42- y = py .sympy .S (char (x ));
43+ y = py .sympy .S (sympy (x ));
4344
4445 % Above is nice because it needs no imports. But downside is some
4546 % things like NonElementaryIntegral and MatrixElement will fail. See
4647 % e.g., commit 51a80384d5caea0db211e452d39f0b4f6b3778cc
4748
4849 % Alternatively, with many imports (see python_header.py), this works:
49- % y = pyeval (char (x));
50+ % y = pyeval (sympy (x));
5051
5152end
5253
5354
54- % !assert (isa (pyobject (sym ('x')), 'pyobject'))
55+ % !test
56+ % ! try
57+ % ! q = py.int(7);
58+ % ! have_pytave = true;
59+ % ! catch
60+ % ! have_pytave = false;
61+ % ! end
62+ % ! if (have_pytave)
63+ % ! assert (isa (pyobject (sym ('x')), 'pyobject'))
64+ % ! end
You can’t perform that action at this time.
0 commit comments