Oops... attachments are now there...
-------- Forwarded Message --------
Subject: UnivariateTaylorSeries
Date: Mon, 22 Feb 2021 18:38:49 +0100
From: Ralf Hemmecke <[email protected]>
To: fricas-devel <[email protected]>
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.
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/a763405b-5e2f-16c4-1672-5b2ba96b4db0%40hemmecke.org.
rep x ==> (x@%) pretend Rep
per x ==> (x@Rep) pretend %
UTS(C) ==> UnivariateTaylorSeries(C, 'q, 0$C)
QTS ==> QEtaTaylorSeries
)abbrev category QETATSC QEtaTaylorSeriesCategory
++ QEtaTaylorSeriesCategory is a UnivariateTaylorSeriesCategory
++ extended by a few functions that we need in the computation of our
++ package.
QEtaTaylorSeriesCategory(C: Ring): Category ==
UnivariateTaylorSeriesCategory C with
coerce: UTS C -> %
++ coerce(x) interpret a univariate Taylor series in q with a
++ center at 0 as an element of this domain. No check is made.
coerce: % -> UTS C
++ coerce(x) interprets x as a univariate Taylor series in the
++ variable q about the center 0.
)abbrev domain QETATS QEtaTaylorSeries
++ QEtaTaylorSeries(C) is in fact identical with
++ UnivariateTaylorSeries(C, 'q, 0). We just fix the variable to the
++ symbol q and the center to zero.
QEtaTaylorSeries(C: Ring): Exports == Implementation where
Exports ==> QEtaTaylorSeriesCategory C
Implementation ==> UTS C add
Rep ==> UTS C
coerce(s: UTS C): % == per s
coerce(x: %): UTS C == rep x
)compile qetaser.spad
Z ==> Integer
Q ==> Fraction Z
UTS(C) ==> UnivariateTaylorSeries(C, 'q, 0$C)
QTS ==> QEtaTaylorSeries
t1 := taylor(hypergeometricF([1/12,5/12],[1],12^3*q))::UTS(Q)
t2 := 1$QTS(Q) + monomial(1, 1)$QTS(Q)
-- Does not work because of type mismatch
t1 - t2
-- But suppose I have a computation that gives me t2 as an element of
-- QTS(Q). How can coerce t1 into QTS(Q) or coerce t2 into UTS(Q).
t1 :: QTS(Q)
t2 :: UTS(Q)
coerce(t1)$QTS(Q)