[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Axiom-developer] about Expression Integer (with Quizzes)
From: |
Bill Page |
Subject: |
RE: [Axiom-developer] about Expression Integer (with Quizzes) |
Date: |
Sun, 26 Feb 2006 15:53:31 -0500 |
On February 26, 2006 1:32 AM William Sit wrote:
> >
> > William
> >
> > On Friday, February 24, 2006 8:07 AM you wrote:
> > >
> > > Any scientific literate person, when (s)he wrote down:
> > >
> > > 2*x + 1/x
> > >
> > > would mean that there is only ONE x, the x means the same
> > > thing throughout the expression.
> >
> > Yes.
>
> I'm glad you agreed. So how can you keep arguing that one x
> lives in one domain, and the other x in another?
I did not make that claim. It is incorrect to think in terms
of 'x' belonging to one domain or another. It is the same 'x'
used in different ways. 'x' lives in only one domain - Symbol.
There is a lot more I want to reply to below but let me skip
that for now (I'll get back to it later) and get to the fun
part. :)
> ...
> Here are some quizzes if you have read so far (it does not
> matter if you agree with me or not).
>
> Instructions: What is the output for each of the following?
> Do the problems only one at a time. You should write down
> your answer, its type, and with explanations and any expected
> error messages. Then check it (using )set mess bot off),
> revise your explanation if necessary, or explain Axiom's
> output. Finally, use )set mess bot on to see exactly what
> the Interpreter did. Then and only then, advance to the next
> problem.
>
> Just in case: the function 'variables' returns a list of the
> variables occurring in the argument.
It is slightly more accurate to say that it returns a list
of Symbols that are used as variables. But I suppose that is
a quibble.
>
> )set mess bot off -- no cheating
> (1) variables (2*x+1/x)$DMP([x], EXPR INT)
>
> (Got you, right? It got me too.
Yes. It took me a minute to realize that the interpreter parses
this as:
(variables$DMP([x], EXPR INT))(2*x+1/x)
> To understand this, repeat with ')set mess bot on'. You must
> understand what the Interpreter was doing before starting
> quiz (2))
Ok, that was pretty easy. :)
>
> )set mess bot off
> (2) variables (2*y+1/y)$DMP([y], INT)
>
> (Got me again! Repeat with )set mess bot on, read carefully,
> and compare with that from (1)).
This one is obvious. The only operation '/' in this domain is
'?/? : (%,Integer) -> %' and 'y' is not an 'Integer'.
>
> )set mess bot off
> (3) a:=(2*x + 1/x)$DMP([x], EXPR INT);
> variables a
Obvious result: [x]
What is hard about that?
>
> )set mess bot off
> (4) b:=(2*y+1/y)$DMP([y], INT);
> variables b
>
Same error as in (2). But 'b' is interpreted as a Variable
which can be coerced to EXPR INT so result is [b]
> )set mess bot off
> (5) x:DMP([x], EXPR INT);
> variables (2*x+1/x)
>
Obvious. Result: [x]. Essentially the same as (3)
> )set mess bot off
> (6) y:DMP([y], INT);
> variables (2*y+1/y)
>
I wrote: "Error same as in (2)". So I have to admit I got this
one wrong but I should not have. The explanation is simple. This
is not a package call as it was in (2), so the interpreter is
free to apply the usual coercion to 'FRAC DMP([y], INT)' in order
to obtain a selection for '/'.
> For your convenience, the quizzes have been set up at SandBox
> Polynomials. Solutions are at SandBoxPolynomialQuiz and you
> can enter your insights at SandBoxPolynomialQuizExplained.
>
Ok, I'll do that.
> Have fun.
Thanks, I did.
> If you got all 6 perfectly, you are a "guru", congratulations,
> and let us know (so we know whom to ask questions next time :-)
I missed that last one on purpose. ;)
> (Actually, I do have a few related to these quizzes, but rather
> than scratching my head again, I'll wait for the "guru"s to tell
> me.)
Bring them on!
Regards,
Bill Page.