In addition to what others have written in this thread, there is yet
another potential confusion, stemming from such data types as elements of
polynomial rings. E.g.
sage: R.=QQ[]
sage: f=2*x*y-5
sage: type(f)
shows that f here is neither a python function nor a symbolic expression.
Although
I think you got it, but I'm just adding this below in case someone else is
also interested:
Here, this sequence defines a symbolic x, and that function f, and then
checks the types
x = var('x')
f=lambda x: x*sin(x)
type(f)
type(f(x))
and f(x) is still a symbolic expression.
Now we change x to b
William Stein wrote:
> On Wednesday, August 10, 2016, Todd Zimmerman
> mailto:todd.zimmerman@gmail.com>> wrote:
>
> I assumed that SageMath converts the functions into symbolic
> expressions.
> If I enter the following it will work:
>
>
> f=lambda x: x*sin(x)
> diff(f(x),
I assumed that SageMath converts the functions into symbolic expressions.
If I enter the following it will work:
f=lambda x: x*sin(x)
diff(f(x),x)
def g(x):
return x*sin(x)
diff(g(x),x)
On Wednesday, August 10, 2016 at 4:01:09 PM UTC-5, Harald Schilly wrote:
>
> On Wed, Aug 10, 2016 at
On Wed, Aug 10, 2016 at 10:46 PM, Todd Zimmerman
wrote:
> You can integrate and differentiate both types of functions in SageMath as
> well as use them for solving differential equations.
So, can you copy/paste us an example? It does work, if that small
python-function is evaluated and returns a
I'm aware of the difference between the two approaches in vanilla Python, I
was just trying to figure out if SageMath treats the two differently. You
can integrate and differentiate both types of functions in SageMath as well
as use them for solving differential equations.
-Todd
On Wednesda
On Wednesday, August 10, 2016 at 8:37:18 PM UTC+2, Todd Zimmerman wrote:
>
> Is there any significant difference in SageMath between defining a
> function using lambda vs. defining it using 'def ...:'?
>
>
This is actually a pure Python question, and the answer is yes. Technically:
def f1(x):