gusesADE: List(K) -> (SUP(K), INI(K))
Why not simply returning a polynomial as described in (7)?
well, apart that it's not univariate, that's of course one possibility.
However, I wanted that
res := guessADE [n^n/factorial n for n in 0..12]
eval(first res, 'n=30)
works.
OK, that is your design decision.
Mine would be different. I would have all you guess* functions returning
very specific types and then have wrapper functions that turn the
specific type into expression integer. A user could then choose what is
best for him.
> Moreover, consider:
(1) -> res := guess([product(1+factorial k, k=0..n-1) for n in 0..6],
[guessPRec], [guessProduct])
n - 1
++-++
(1) [ | | [f(p ): f(p + 1) + (- p - 1)f(p ) + p = 0,f(0)= 2]]
| | 7 7 7 7 7
p = 0
7
You believe that I understand that output?
And by the way, if you use Expression(Integer) only because you can have
nice output, then you should rather choose untyped systems. Look into
the implementation of SUP, its representation is a list of terms and
still the output looks nice.
Since in mantepse.spad I don't actually see Expression(...) as an input,
can you (apart from you design decision above) say why you actually need
the Expression domain at all? My suspicion is that like with the
(multivariate) polynomial that could be used as the return type for
guessADE, you might have more specific types for all the other
functions, too.
I agree that Expression(..) is nice if you want to program a prototype,
but I would really think twice to use it in a library program. All you
actually deal with is polynomials, rational numbers, integers,
q-polynomials, differential operators, and maybe elements of a
differential ring. Am I wrong? So why Expression? To my taste it is not
using the full potential of FriCAS. Make your types more specific.
(2) -> [eval(first res, 'n=n) for n in 1..10]
(2)
[2, 4, 12, 84, 2100, 254100, 183206100, 923541950100, 37238134969982100,
13513011656042074430100]
Finally, we have
(3) -> r(0)==1; r(1)==1; r(n)==q^(n-1)*r(n-1)+(n-2)*r(n-2);
Type: Void
(4) -> guessPRec(q)([r m for m in 0..7], maxMixedDegree==1, maxDegree==1,
homogeneous==true)
Compiling function r with type Integer -> Fraction(Polynomial(
Integer))
Compiling function r as a recurrence relation.
n
(4) [[f(n): q f(n + 1)q - f(n + 2) + n f(n)= 0,f(0)= 1,f(1)= 1]]
Type: List(Expression(Integer))
where the result is really a polynomial in f(n), f(n+1), ... with
coefficients in Z[q, q^n]. There is currently no domain in FriCAS I
know of to handle these...
Not that I understand your problem that you want to convey with the
session above, but what is not possible? You cannot construct Z[q, q^n]
in FriCAS? Why not? Isn't q and q^n algebraically independent. Or can
you give a polynomial p(x,y) \in Z[x,y] such that p(q, q^n) = 0. No you
cannot, since n is an indeterminate.
So Z[q,q^n] can be represented by Z[x,y]. What exactly is the problem?
I wanted to be able to use guessing routines in a uniform fashion and
possibly nested way.
Why shouldn't that work, if you provide appropriate wrapper functions as
an interface to the user? But internally you can still be more specific.
The easiest (the only?) way to allow that is to
use a common type.
OK, you like untyped CAS. You should use expression trees as all the
non-PanAxiom systems. ;-)
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
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/fricas-devel?hl=en.