Message Boards Message Boards

0
|
1412 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Simple position, velocity and acceleration notebook with dimensional checking fails?

Posted 8 months ago

Since physics usually involves vectors (frequently 3D) with physical dimensions. A quite frequent source of error in physics math is dimensional conflict. It is important to write out notebooks with vector elements defined with Quantity. I've been working on a very simple notebook involving position, velocity and acceleration and decided to write a convenience function to help with generating the vectors with associated magnitude variables that can be set, including setting them to functions of time so that I can define the velocity as the time derivative of position and acceleration as time derivative of velocity.

The attached notebook demonstrates the difficulty with this simple notebook.

POSTED BY: James Bowery
4 Replies

When we take the derivative of a constant Quantity, the result is a pure number, not a Quantity:

Clear[t];
D[Quantity[0, "Meters"], t]

A variant:

D[Quantity[1, "Meters"], Quantity[t, "Seconds"]]

I would dare call this a bug.

POSTED BY: Gianluca Gorni
Posted 8 months ago

To what does the "we" refer in:

When we take the derivative of a constant Quantity, the result is a pure number, not a Quantity:

To the best of my knowledge, ever since Russell's abandonment of Relation Arithmetic in volume 4 of Mathematica (the original -- not the software) the foundation of mathematics does not even try to rigorously accommodate relationally dimensioned quantities. If there is scholarship in mathematics on this topic I would really like to see it because I basically blew my professional capital to hire Tom Etter to solve this problem -- critical to the foundation of programming languages (such as Mathematica ironically enough) at the largest DotCom era project: HP's "Internet Chapter 2".

That meta-problem aside, the example I provide has an additional "bug" evidenced by the final scalar output which, I would have thought, would be vector.

POSTED BY: James Bowery

By "we" I meant "we, Mathematica users".

POSTED BY: Gianluca Gorni

As for your last "bug":

ReleaseHold[aVec]

does what you don't expect because RealeaseHold only releases the outer Hold, but your aVec has two layers of Hold:

Hold[D[Hold[D[rVec, t]], t]]

which, after the release, becomes

D[Hold[D[rVec, t]], Quantity[tM, "Seconds"]]

The variable tM does not appear in the function, and the derivative is zero. rVec has no chance of being recognized as a vector made of lengths.

At least, this is my own interpretation at the moment. I am no expert of nested held expressions.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract