Re: Curious behavior of Taylor series
Ralf Hemmecke <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.general |
|---|---|
| Message-ID | <[email protected]> |
>>>>>>> (113) -> y := taylor x >>>>>>> (113) x >>>>>>> Type: UnivariateTaylorSeries(Expression Integer,x,0) >>>>>>> (114) -> x*y >>>>>>> (114) x x >>>>>>> Type: UnivariateTaylorSeries(Expression Integer,x,0) >>>>>>> (115) -> coefficient(%,1) >>>>>>> (115) x >>>> But Axiom coerced the two x to the same domain!!! > > Looking back, it didn't. One of the x's is in Expression Integer, and > the other is UTS. In some sense you are rigth, BUT, for that to claim you would have to know the internal representation of UnivariateTaylorSeries(Expression Integer,x,0). What if you are a poor Axiom user who doesn't have access to the source code? How could you justify your statement. All you see is ONE type and that is UnivariateTaylorSeries(Expression Integer,x,0) and nothing else. >> Well, but how can you tell this to Axiom? > Axiom could try to coerce x to be the same type as y, or y to be the > same type as x. The latter would lose structure, and should fail. > So x should be coerced to the same domain as y. As I said, Axiom does exactly that. But it has (at least two) incompatible ways to do it. Maybe someone familiar with tracing the search of the interpreter for the right coerce function could explain that better than me. >> But see, x is a symbol which should be coerce into a Taylor >> series. The interpreter has several choices. So assuming the ideal >> that the interpreter should have no mathematical knowledge itself, >> it can only take the available information from the library. But >> there are several available ways to go from x to UTS(Expression >> Integer,x,0). So how can the interpreter ever know that it does the >> wrong thing? > > The problem is that it didn't even try to go from x to UTS; x ends up > as an Expression Integer. I think it should have tried coercing x > before multiplying x and y. Let's abbreviate U := UnivariateTaylorSeries(Expression Integer,x,0) and E := Expression(Integer). That's what Axiom does. It tries to coerce to U, there is no such coerce function. Then maybe after checking some other coerce functions that fail, it finds a coercion to Expression(Integer), furthermore there is function *: (E, U) -> U. So Axiom does a minimal thing: it interprets x*y as (x::E)*y note that the coercion to U would go like (x::E::U) * y and would then be more costly. You surely also consider that unreasonable to go the long way if there is a shorter path. No? > It is dangerous to use Expression Integer as above, but I don't think > it should be. I think the commands at the beginning of this thread > were reasonable and should work. You are talking to a computer not a human. Have mercy. Ralf