[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiomdeveloper] [ExampleSolution1] Fix MathAction display problem
From: 
Bill Page 
Subject: 
[Axiomdeveloper] [ExampleSolution1] Fix MathAction display problem 
Date: 
Thu, 17 Mar 2005 01:25:07 0600 
Changes http://page.axiomdeveloper.org/zope/mathaction/ExampleSolution1/diff

removed:
Aside: I am getting into something I don't quite understand: the first and
last two groups of code are not meant to be there, but the first somehow
returns something wrong. If the commented line <code>dNdt(t)</code> is
removed, the result for the <code>subst</code> line is what I expect. If the
order of the commands is as for the second group, the result is ok too.
Finally if I copied the block to the end and run it a second time, everything
is also ok. But this may go away after I save (it does not). Image is in:
http://page.axiomdeveloper.org/zope/mathaction/images/114170313018px.png,
just in case (this might have to do with use of <code>N(1/10,0,3)</code> and
even a <code>for x in 15..5 repeat output N(x/10,0,3)</code> command that were
ran during testing). However, when all the code in this page was run in Axiom,
everything is as expected.

++added:
dNdt(t)==D(N(t,0,3),t)
 dNdt(2)
subst(dNdt(t), t=2)
??changed:
dNdt(t)==D(N(t,0,3),t)
dNdt(t)
subst(dNdt(t), t=2)
\end{axiom}
Notice that the evaluation for <code>N0(2)</code> is not really done.
One way to avoid this error is to use substitution instead of a
function call, as done in the second line above. The function call
<code>dNdt(2)</code> is not done directly.
To illustrate a common error when mixing numeric and symbolic
computation: first define the derivative as a function of <code>t</code>
and then evaluate the derivative at some value of <code>t</code>.
This does not work because when the derivative is called the system
(Axiom, or other systems) will substitute the value of <code>t</code>
before differentiating.
\begin{axiom}
removed:
Compared with

\begin{axiom}
dNdt(t)==D(N(t,0,3),t)
subst(dNdt(t), t=2)
N(2,0,3)
dNdt(2)
\end{axiom}

Notice that the evaluation for <code>N0(2)</code> is not really done. One way
to avoid this error is to use substitution instead of a function call, as done
in the second line above.

The last function call <code>dNdt(2)</code> is deliberate, to illustrate a
common error when mixing numeric and symbolic computation: first define the
derivative as a function of <code>t</code> and then evaluate the derivative at
some value of <code>t</code>. This does not work because when the derivative is
called the system (Axiom, or other systems) will substitute the value of
<code>t</code> before differentiating.



\begin{axiom}
N(2,0,3)
dNdt(t)==D(N(t,0,3),t)
dNdt(t)
[3 more lines...]

forwarded from http://page.axiomdeveloper.org/zope/mathaction/address@hidden
[Prev in Thread] 
Current Thread 
[Next in Thread] 
 [Axiomdeveloper] [ExampleSolution1] Fix MathAction display problem,
Bill Page <=