UnivariateTaylorSeries

4 views
Skip to first unread message

Ralf Hemmecke

unread,
Feb 22, 2021, 12:38:51 PM2/22/21
to fricas-devel
Hello,

I wrote some code that relies on univariate taylor series in q.
Since it was cumbersome to always carry the variable name 'q and the
center of expansion 0 in the type, I created a kind of wrapper domain.
(See attachement for something that demonstrates my problem.)

My wrapper domain actually works nicely as long as I do not want to make
a connection back and forth to UnivariateTaylorSeries.

My question is how can I coerce an element of QEtaTaylorSeries(Q) to an
element of UnivariateTaylorSeries(Q, 'q, 0$Q) and/or the other way round?

I simply cannot find the error in the implementation.

I am sure it has something to do with non-type-valued arguments, but how
can I make this code work nicely without tricks?

Thank you
Ralf

==========================================================

(7) -> t1 - t2
There are 9 exposed and 6 unexposed library operations named -
having 2 argument(s) but none was determined to be applicable.
Use HyperDoc Browse, or issue
)display op -
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.

Cannot find a definition or applicable library operation named -
with argument type(s)
UnivariateTaylorSeries(Fraction(Integer),q,0)
QEtaTaylorSeries(Fraction(Integer))

Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.

(7) -> t1 :: QTS(Q)

Cannot convert the value from type UnivariateTaylorSeries(Fraction(
Integer),q,0) to QEtaTaylorSeries(Fraction(Integer)) .

(7) -> t2 :: UTS(Q)

Cannot convert the value from type QEtaTaylorSeries(Fraction(Integer
)) to UnivariateTaylorSeries(Fraction(Integer),q,0) .

(7) -> coerce(t1)$QTS(Q)
There are 81 exposed and 159 unexposed library operations named
coerce having 1 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op coerce
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.

Cannot find a definition or applicable library operation named
coerce with argument type(s)
UnivariateTaylorSeries(Fraction(Integer),q,0)

Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.

Ralf Hemmecke

unread,
Feb 22, 2021, 12:41:06 PM2/22/21
to fricas-devel
Oops... attachments are now there...
qetaser.spad
qetaser.input

Martin R

unread,
Feb 22, 2021, 12:55:27 PM2/22/21
to FriCAS - computer algebra system
Such a domain exists and is called UnivariateFormalPowerSeries :-)

Ralf Hemmecke

unread,
Feb 22, 2021, 1:29:48 PM2/22/21
to fricas...@googlegroups.com
On 22.02.21 18:55, 'Martin R' via FriCAS - computer algebra system wrote:
> Such a domain exists and is called UnivariateFormalPowerSeries :-)

Same problem.

(8) -> UFPS == > UnivariateFormalPowerSeries

You have used the abbreviation UFPS of the constructor
UnivariateFormalPowerSeries as an identifier on the left hand
side of a function definition. This is not allowed.

(8) -> t3 := 1$UFPS(Q) + monomial(1, 1)$UFPS(Q)

(8) 1 + x
Type:
UnivariateFormalPowerSeries(Fraction(Integer))
(9) -> t3 :: UTS(Q)

Cannot convert the value from type UnivariateFormalPowerSeries(
Fraction(Integer)) to UnivariateTaylorSeries(Fraction(Integer),q,
0) .



Waldek Hebisch

unread,
Feb 26, 2021, 9:49:29 AM2/26/21
to fricas...@googlegroups.com
On Mon, Feb 22, 2021 at 06:38:49PM +0100, Ralf Hemmecke wrote:
> Hello,
>
> I wrote some code that relies on univariate taylor series in q.
> Since it was cumbersome to always carry the variable name 'q and the
> center of expansion 0 in the type, I created a kind of wrapper domain.
> (See attachement for something that demonstrates my problem.)
>
> My wrapper domain actually works nicely as long as I do not want to make
> a connection back and forth to UnivariateTaylorSeries.
>
> My question is how can I coerce an element of QEtaTaylorSeries(Q) to an
> element of UnivariateTaylorSeries(Q, 'q, 0$Q) and/or the other way round?
>
> I simply cannot find the error in the implementation.
>
> I am sure it has something to do with non-type-valued arguments, but how
> can I make this code work nicely without tricks?

Fix interpreter and compiler? At compiler level this is confusion
between 0 and '(Zero)'. The second is needed to get proper
evaluation, the first appears in types. Spad compiler prints offending
types so one can see what the problem is.

Interpreter has some extra problem.

--
Waldek Hebisch

Waldek Hebisch

unread,
Feb 27, 2021, 10:45:00 PM2/27/21
to fricas...@googlegroups.com
The attached patch works around compiler problems, now one can
call corresponding functions from Spad. Interpreter problem
remains...

--
Waldek Hebisch
sum6.diff
Reply all
Reply to author
Forward
0 new messages