# _sympy_ conversion for BuiltinFunction and CallableSymbolicExpression objects

Reported by: Owned by: Matthias Köppe major sage-9.4 symbolics Eric Gourgoulhon, Nils Bruin, Karl-Dieter Crisman, Emmanuel Charpentier, Markus Wageringel Matthias Koeppe Travis Scrimshaw N/A d9cff76 d9cff76316fec2da8e4f9ae20eabebef5b4eeb4b

Currently we have:

```sage: from sympy import sympify
sage: sympify(sin(x))
sin(x)
sage:
sage: sympify(sin)
SymPyDeprecationWarning:

String fallback in sympify has been deprecated since SymPy 1.6. Use
sympify(str(obj)) or sympy.core.sympify.converter or obj._sympy_
```

We should fix this by providing functions with a `_sympy_` method that implements the same conversion as `SympyConverter.composition`.

Also, converting `CallableSymbolicExpression` to sympy forgets about the formal arguments:

```sage: from sympy import sympify
sage: f(x, y) = x^2 + y^2; f
(x, y) |--> x^2 + y^2
sage: sympify(f)
x**2 + y**2
```

We change it to return a SymPy `Lambda` instead.

### comment:1 Changed 17 months ago by Matthias Köppe

Description: modified (diff)

### comment:2 Changed 17 months ago by Matthias Köppe

Description: modified (diff) _sympy_ method for function objects → _sympy_ conversion for BuiltinFunction and CallableSymbolicExpression objects

### comment:3 Changed 17 months ago by Matthias Köppe

Branch: → u/mkoeppe/_sympy__conversion_for_builtinfunction_and_callablesymbolicexpression_objects

### comment:4 Changed 17 months ago by Matthias Köppe

Authors: → Matthias Koeppe → d9cff76316fec2da8e4f9ae20eabebef5b4eeb4b new → needs_review

New commits:

 ​d9cff76 `Function._sympy_, SympyConverter.__call__: New`

### comment:5 Changed 17 months ago by Matthias Köppe

Cc: Nils Bruin Karl-Dieter Crisman added

### comment:6 Changed 17 months ago by Matthias Köppe

Cc: Emmanuel Charpentier Markus Wageringel added

### comment:7 Changed 17 months ago by Travis Scrimshaw

Reviewers: → Travis Scrimshaw needs_review → positive_review

LGTM.

Thanks!

### comment:9 Changed 17 months ago by Volker Braun

Branch: u/mkoeppe/_sympy__conversion_for_builtinfunction_and_callablesymbolicexpression_objects → d9cff76316fec2da8e4f9ae20eabebef5b4eeb4b → fixed positive_review → closed
Note: See TracTickets for help on using tickets.