25 Reputation

4 Badges

11 years, 228 days

MaplePrimes Activity

These are answers submitted by Nick

So whenever I try to display the values in my pos matrix to ensure that they updated properly, improper values are displayed.

In essence, pos(1,1) maintains the initial position, which is good.

pos(1,2) should and does return the sum of pos(1,1) and the velocity.

But then pos(1,3) and all other following indices do not further update.  They all retain the value of pos(1,2).  My suspicion is that the matrix is not evaluating properly because it is being passed into the procedure.

Any hints?

Thank you in advance.


Thank you very much. I made a bunch of your changes to the program, and it definitely sped up.  I did, however, omit the compiling because I don't really understand how it works, and I'm sure I can add it later.

Before I ask another question about the actual program, I was have a few simple ones about Maple in general:

1. How do I indent a single line... This is extremely frustrating. 

2. Is there a syntax coloring, besides everything being red, similar to what other IDE's provide?

Firstly, I'll address the differential equation approach.  I just discussed the idea with my Professor, and he noted that I will be dealing with 3 coupled differential equations (all of them depend on each other).  I'm not sure if Maple can do this without intervention from the user.  If my math skills were stronger, I would definitely give it a shot, but I just feel like I would frustrate myself in the end.

At the moment, I'm getting a compile error that says, "Error, final value in for loop must be numeric or character."

It then references a few functions.

I posted one of the functions and then the loop that calls them.  I have a feeling it has to do with the way I passed the i value into the functions... actually, I'm pretty sure I get it.  Since i is a variable name, I need a different restriction than posint.  When i say i::name instead?

UpdateAllPositions := proc (i::posint, pos::Matrix, vel::Matrix, step::(float[8]))

pos(1, i) := pos(1, i-1)+vel(1, i)*step;

pos(2, i) := pos(2, i-1)+vel(2, i)*step;

pos(3, i) := pos(3, i-1)+vel(3, i)*step;

end proc

for i from 2 to maxint do

UpdateAllAccelerations(i, accel, step);

        UpdateAllVelocities (i, vel, accel, step);

UpdateAllPositions(i, pos, vel, step);

end do:

EDIT: solved that error. I accidentally used maxint instead of maxi.

EDIT2: Now it is telling me

"UpdateAllAccelerations expects its 3rd argument, step, to be of type float[8], but received .1"

If I declare step as step := .1, what type is it declared as?  Clearly it isn't float[8].

@acer: You said "lists are not ordered, in the sense that Maple retains their entries in the original order in which you input them or create the object. This is in contrast with sets."

So, in essence, a set will modify itself.  The most obvious example that I noticed was that if duplicate entries are inputted into a set, the duplicate is deleted.  I take it that this is not the case with lists.

So if entries retain the order in which they were inputted in both lists and arrays, what is the primary difference between the two structures?  Is one of these dynamically growing in size?

Before we continue this discussion, I want to detail my assignment.

There will be a user interface where the user can input initial parameters.  There are about 2 dozen variables that affect the flight of a baseball.  The user will choose these.  About half of these variables will change with time; meanwhile, variables such as temperature, humidity, ect, remain constant.  The properties of the ball will be calculated iteratively for n number of time intervals over a certain time period.  

I said earlier that I will need to be able to select and change values... I suppose this is untrue.  At any time, however, the user can change one of the initial input parameters.  At this time, all of the balls properties at future times will be recalculated.  In essence, all the values of the data structure would be changed.

I am thinking that it might be nice to allow the user to choose the time intervals between each calculation.  For example, if the ball is measured over 1s, he could choose to view 100 .01s intervals or 200 .005s intervals or any other combination.  In this case, I imagine that we would want a data structure that can change size dynamically.

Thank you again


Page 1 of 1