Hi!

On 3 Apr., 00:30, G B <[email protected]> wrote:
> That did it.  I found the section in the tutorial explaining the
> different interpretations of functions more fully, and while I don't
> quite have my head around it, I think I understand the problem at a
> basic level to be that my f(x) is a symbolic expression, but
> get_random_element() is a Python function, and there's some odd
> interaction under the hood.

I think that's a wrong description of what is happening. You talk
about the line
  f(x)=sin(x)+T.get_random_element()

In that line, f is to be defined (in particular, at that point, f(x)
is not a symbolic expression, yet).

So, let's look at the right hand side of it. sin(x) is a symbolic
expressioon. T.get_random_element() is, in contrast to what you state,
*not* a Python function --- T.get_random_element() is a number. And of
course, when you add a number to a symbolic expression, you get a
shift and not a noise.

I don't find this an odd interaction at all.

What you probably had in mind was that T.get_random_element *without*
the brackets is a Python function (or actually a method). Adding an
*unevaluated* Python function to a symbolic expression should result
in an error - everything else would probably be a really odd
interaction, because this means to add things that have a completely
different meaning.

> Is this something that will ever be able to be worked around...

What do you mean by "work around" in this case?

You seem to believe that "f(x)=sin(x)+T.get_random_element()" makes
sense as a mathematical definition of adding noise to sin(x).
But here I disagree: You can mathematically add functions that have
the same range, but this is obviously not the case for sin(x) and
T.get_random_element() (the latter is even not referring to x).

But when a statement does not make mathematical sense, you can not
expect to work around it in any computer algebra system.

> Is Sage doomed to have these similar but not quite
> compatible entities ...

They are totally different.

> everything will begin to play
> more nicely?

What do you consider "nice"? I believe that it would certainly *not*
be nice to have a computer algebra system that interpretes
   f(x)=sin(x)+T.get_random_element()
in the way you suggested. I am mathematician, and as a referee of a
research paper I would complain about such a line.

By the way, there is already quite an effort done behind the scenes in
order to make sense of the line
  f(x)=sin(x)
Again, it is a definition, but on the left hand side you have two
things, namely f and x. But x also appears on the right hand side.

> My concern is that, as a newbie, I'm carefully double checking each
> step of my calculation because I know that I don't know what I'm
> doing-- but eventually I'm liable to gain confidence, lose track of
> these various function types, and not realize that the results I'm
> getting are incorrect.

Don't worry. It is normal to commit errors when programming. But you
can be confident that you will invent more and more subtle errors as
your programming skills improve. :)

Best regards
Simon

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

To unsubscribe, reply using "remove me" as the subject.

Reply via email to