473,726 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Vectors in Visual Python

SOrry if this message is a little confused, it most probably reflects
the state of the author!

I have made a small program that plots the orbit of a planet in visual
python using visual.vector for all values. If i run the program it is
clear that the orbit is non-keplerian as the planets gradually moves
away from the sun. I am pretty sure the orbit should be keplerian so i
guess there must be some source of error in the program.

I am using "from __future__ import division" and the initial conditions
I have are from NASA's horizons system, all values are accuracte to
more than 10 decimal places.

I was wondering if there was a way to specify the type of number used
by visual.vector, for example, when using an array it is possible to
specify the type as float64. If visual.vector was using a smaller
amount of memory to store the number could this be the source of the
error I am finding? If not what else could be the culprit?

I have used a 4th order RK method which I have previously produced
Keplerian orbits with.

I hope I have made some sense here and look forward to any input

Many Thanks

Ben

Jul 18 '05 #1
10 2490
On 9 Feb 2005 02:29:35 -0800, "FLChamp" <be**********@g mail.com>
wrote:
SOrry if this message is a little confused, it most probably reflects
the state of the author!
One bit of confusion is in names. There was a name space clash early
on. As things shook out "Visual Python" is ActiveState's Python
developement environment for Visual Studio .Net
http://www.activestate.com/Products/Visual_Python/
and the 3d programming environmnet to which you question refers
became " VPython". Just a point of information. Certainly no great
confusion in the context of your question, but there could be in other
contexts.
I have made a small program that plots the orbit of a planet in visual
python using visual.vector for all values. If i run the program it is
clear that the orbit is non-keplerian as the planets gradually moves
away from the sun. I am pretty sure the orbit should be keplerian so i
guess there must be some source of error in the program.

I am using "from __future__ import division" and the initial conditions
I have are from NASA's horizons system, all values are accuracte to
more than 10 decimal places.

I was wondering if there was a way to specify the type of number used
by visual.vector, for example, when using an array it is possible to
specify the type as float64. If visual.vector was using a smaller
amount of memory to store the number could this be the source of the
error I am finding? If not what else could be the culprit?


My understanding:

is that VPython "vectors" are in effect flat 3 element Numeric arrays,
and Numeric ararys can be constructed with Float64 specified as the
datatype. (wonder if that speciufication is a "declaratio n", and if
so whether that would indicate some conflict between Python's ideology
(Alex's version) and that of its defacto standard numerical processing
library - but I digress) .

Have you tried feeding the VPython the vectors, arrays declared as
Float64 types.

May, or may not, get you somewhere.

Art

Jul 18 '05 #2

"Arthur" <aj******@opton line.com> wrote in message
news:pb******** *************** *********@4ax.c om...
is that VPython "vectors" are in effect flat 3 element Numeric arrays,
and Numeric ararys can be constructed with Float64 specified as the
datatype. (wonder if that speciufication is a "declaratio n", and if
so whether that would indicate some conflict between Python's ideology
(Alex's version) and that of its defacto standard numerical processing
library - but I digress) .


I (and I believe Alex) object to name declaration *statements* and/or the
strong typing of *names*.

I (and I believe Alex) approve of the strong typing of *objects*, which
must somehow be indicated in the object creation *expression*. This is
absolutely fundamental to Python. There are at least three ways to
indicate the desired object type: literal type, constuctor (and other
function) identity, and constructor (and other function) arguments.

When constructor arguments only specifiy the type of members of a
homogeneous collection object, the visible type() of the collection itself
may not be affected. I believe member type specifications for numerical
and num- arrays are like this, as they are for stdlib array.arrays.

Sorry, no conflict ;-)

Terry J. Reedy

Jul 18 '05 #3
Arthur <aj******@opton line.com> wrote:
is that VPython "vectors" are in effect flat 3 element Numeric arrays,
and Numeric ararys can be constructed with Float64 specified as the
datatype. (wonder if that speciufication is a "declaratio n", and if
so whether that would indicate some conflict between Python's ideology
(Alex's version) and that of its defacto standard numerical processing
library - but I digress) .


That ``speciuficatio n'' (sic) is no more ``a "declaratio n"'' than any
other parameter you can pass to a constructor (or any other factory
callable). I find it hard to believe that this can be less than
totally, entirely, and utterly obvious to anybody with a 3-digits IQ.
Trying to subdivide the issue into sub-issues that I hope will be pretty
obvious even for most 2-digits IQs...:

I can pass parameters when I call something -- do you think ``that's a
declaration''?!

Some of the calls I perform build and return new objects -- do you
REALLY think ``that's a declaration''?!

Obviously, the parameters I pass will normally affect the results of my
calls -- do you TRULY, SERIOUSLKY think ``that's a declaration''?!

*WHAT ON EARTH* could *POSSIBLY* make you "wonder" if any of these
aspects make a perfectly ordinary executable statement into what's
instead ``a declaration''?! ?!
Please clarify if you were making a lame joke without smilies, are
utterly confused about what "declaratio n" *MEANS*, or what other folly
prompted you to this astounding remark, thanks. Having found out how to
build a lasting killfile, I'd like to see if using it liberally on
people who appear to post here just to provoke flamewars, rather than to
offer and receive help, and participate in interesting discussion, can
make the newsgroup decently usable to me again. It's a pity that any
newbie reading the group will be confused and damaged by tons of
unchallenged idiocies posted there by large number of fools, but, ah
well, I can't fix that, obviously -- I can just hope and trust that the
fools' karma suffers in proportion to the stupid harm they inflict.
Alex
Jul 18 '05 #4
Terry Reedy <tj*****@udel.e du> wrote:
I (and I believe Alex) object to name declaration *statements* and/or the
strong typing of *names*.
I confirm that my key objection is to declarations in the strict sense:
thingies that aren't executable, but rather billets doux to the
compiler, for example to affect its treatment of barenames.
I (and I believe Alex) approve of the strong typing of *objects*, which
Absolute and unqualified agreement on this point, yes.
must somehow be indicated in the object creation *expression*. This is
absolutely fundamental to Python. There are at least three ways to
indicate the desired object type: literal type, constuctor (and other
function) identity, and constructor (and other function) arguments.


And yes to all of this, as well.
Alex
Jul 18 '05 #5
On Thu, 10 Feb 2005 00:16:05 +0100, al*****@yahoo.c om (Alex Martelli)
wrote:
Arthur <aj******@opton line.com> wrote:
Please clarify if you were making a lame joke without smilies, are
utterly confused about what "declaratio n" *MEANS*, or what other folly
prompted you to this astounding remark, thanks.


Interesting pedagogical technique all-in-all Mr. Martelli.

What point is there in trying to help you understand the basis of my
confusion, if my confusion is nothing more than a point of ridicule.

I know exactly what "declaratio n" is - a fucking word, nothing more
nothing less.

Art

Jul 18 '05 #6
On Thu, 10 Feb 2005 00:16:05 +0100, al*****@yahoo.c om (Alex Martelli)
wrote:
Having found out how to
build a lasting killfile, I'd like to see if using it liberally on
people who appear to post here just to provoke flamewars, rather than to
offer and receive help, and participate in interesting discussion, can


You are an accomplished provocateur.

It is true that I joined the variable declaration discussion without
the intent of offering or receiving help. I joined it actually to try
to make a point that I thought was community spirited -
thinking that the visciousness with wihich you were attacking someone
suggesting a proposal for an optional feature - even if an iill
adivised proposal for and ill advised optional feature (I frankly
don't care much about that part of the discussion one way or another)
- was unwarranted, and more importantly *unwise* for someone in a
postion of community leadership - considering past, recent, and
undoubtedly future issues that have and will arise.

What don't *you* understand about that??

We all have are own kinds of stupidities, it seems to me.

Art
Jul 18 '05 #7
Arthur <aj******@opton line.com> wrote:
thinking that the visciousness with wihich you were attacking someone
suggesting a proposal for an optional feature - even if an iill
adivised proposal for and ill advised optional feature (I frankly
don't care much about that part of the discussion one way or another)
While in my case it's essentially ALL that I care about in this
discussion: the technical aspects of Python.
- was unwarranted, and more importantly *unwise* for someone in a
If, like you, I didn't care about the technical aspects of Python, it
sure would be unwise to get upset -- I could let the language go to hell
in a handbasket, as long as I made sure I looked good myself.

Caring deeply and passionately about something greater than oneself,
particularly something which may seem dry and abstract to those who
don't care a whit for it, might no doubt be deemed intrinsically unwise
-- and yet, there is much to be said for such passion. Without the
ability to get passionate and inflamed, we might perhaps be wiser, but
we'd be Vulcans, not humans. Moreover, unless some of us felt such
passion for certain technical issues, you guys who don't care would not
get the benefits of the time and energy we freely devote to them -- so
it's unwise, even from a strictly selfish viewpoint, to try to turn us
firebrands into such coolly calculating Vulcans.
postion of community leadership - considering past, recent, and
undoubtedly future issues that have and will arise.

What don't *you* understand about that??
Could you _really_ believe, considering the many years of consistent
history of my posts on this group, that by reviving the issue you could
get *any* other effect but fanning the flames all over again? THAT is
what I don't understand: whether you're doing that _deliberately_, or
out of almost-unbelievable levels of cluelessness.
We all have are own kinds of stupidities, it seems to me.


This is no doubt the case. For example, many of us instinctively brake
and swerve when a small animal jumps into the road in front of the car
they're driving, seriously endangering themselves and the passengers
thereby. If we were presented the issue in a context giving us time to
reflect and react rationally -- "To how much danger to life and limb
would you subject yourself, your wife, and your children, to increase
the likelihood of survival for some stupid cat who can't wait to cross
the road?" -- we'd probably react quite differently. And yet, while it
IS objectively stupid to behave that way, it _is_ one of the stupidities
that make us human.

A _deliberate_ and consistent preference can be disagreed with, but it's
pretty pointless to call it "stupid" or "unwise"; there is just no
accounting for tastes. If you _prefer_ the flame about declarations to
continue for its own sake (or because you believe it makes you look
good, whatever), while not caring about its contents, I may consider
that evil and hateful, but it's neither intelligent nor stupid _per se_.
If your preferences are otherwise, and yet your behavior is easily seen
to be such as to have that effect, then THIS is indeed very stupid.
Alex
Jul 18 '05 #8
On Thu, 10 Feb 2005 09:59:41 +0100, al*****@yahoo.c om (Alex Martelli)
wrote:
Arthur <aj******@opton line.com> wrote:
thinking that the visciousness with wihich you were attacking someone
suggesting a proposal for an optional feature - even if an iill
adivised proposal for and ill advised optional feature (I frankly
don't care much about that part of the discussion one way or another)
While in my case it's essentially ALL that I care about in this
discussion: the technical aspects of Python.


Then *only * talk about the technical aspects of Python, Is my, or
anybody else's stupidity, a technical aspect of Python?
- was unwarranted, and more importantly *unwise* for someone in a
If, like you, I didn't care about the technical aspects of Python, it
sure would be unwise to get upset -- I could let the language go to hell
in a handbasket, as long as I made sure I looked good myself.


Save your fire for real threats - was the exact point I was trying to
make.

Is the questionaing of a newbie on a list Guido doesn't even read a
threat to the fate of Python - technical or otherwise. Not in the
slightest, tiniest way . What is much more a threat to Python is an
inhospitable, dogmatic.and intimidating community ethos.

Let's not get to Altamont before we need to.

Caring deeply and passionately about something greater than oneself,
particularly something which may seem dry and abstract to those who
don't care a whit for it, might no doubt be deemed intrinsically unwise
-- and yet, there is much to be said for such passion. Without the
ability to get passionate and inflamed, we might perhaps be wiser, but
we'd be Vulcans, not humans. Moreover, unless some of us felt such
passion for certain technical issues, you guys who don't care would not
get the benefits of the time and energy we freely devote to them -- so
it's unwise, even from a strictly selfish viewpoint, to try to turn us
firebrands into such coolly calculating Vulcans.
I appreciate your books indeed,Alex. They are calm .I'm a customer. I
can study expositions. Not rants.
postion of community leadership - considering past, recent, and
undoubtedly future issues that have and will arise.

What don't *you* understand about that??
Could you _really_ believe, considering the many years of consistent
history of my posts on this group, that by reviving the issue you could
get *any* other effect but fanning the flames all over again? THAT is
what I don't understand: whether you're doing that _deliberately_, or
out of almost-unbelievable levels of cluelessness.


What issue was being "revived"? There was no issue there being
discussed that is on the table in any serious way. In that sense it
was a harmless discussion, inititated by someone new to Python, and in
the almost inevitable why this? why that? exploratory assessment
stage. I think you were candid enough to admit you had had such a
stage yourself.

Being hardcoded less into any alternative view of the universe when
coming to Python - i.e. ignorant - I faced much less of this.
Knowing little, I had a very smalll unlearning curve.

My struggle has been almost the opposite - and my lament has not been
why this?, why that? - but why change this? and why change that?
We all have are own kinds of stupidities, it seems to me.
This is no doubt the case. For example, many of us instinctively brake
and swerve when a small animal jumps into the road in front of the car
they're driving, seriously endangering themselves and the passengers
thereby. If we were presented the issue in a context giving us time to
reflect and react rationally -- "To how much danger to life and limb
would you subject yourself, your wife, and your children, to increase
the likelihood of survival for some stupid cat who can't wait to cross
the road?" -- we'd probably react quite differently. And yet, while it
IS objectively stupid to behave that way, it _is_ one of the stupidities
that make us human.


If that is your way of admitting perhaps some human overreaction -
attacking as a threat something that rationally is or was not - its
appreciated that you are able to do so.

A _deliberate_ and consistent preference can be disagreed with, but it's
pretty pointless to call it "stupid" or "unwise"; there is just no
accounting for tastes. If you _prefer_ the flame about declarations to
continue for its own sake (or because you believe it makes you look
good, whatever), while not caring about its contents, I may consider
that evil and hateful, but it's neither intelligent nor stupid _per se_.
If your preferences are otherwise, and yet your behavior is easily seen
to be such as to have that effect, then THIS is indeed very stupid.

When Guido started thinking out loud about optional static typing he
came under attack most specifcally with the argument that optional
static typing will be technically optional, but in practice will
become mandatory and will therefore fundamentally change Python and
its culture.

I tried to make the argument that a proposed "optional" feature should
at least find its own range of rhetorical excess, as compared to other
kinds of discussions of possible language design decisions, partly
with that discussion resonating in the background.

You respnd by pontificating about how the world works. My instinct is
to go toe-to-toe with you or anybody else on the subject of how the
world works - maybe having a little more time to spend on the subject
in the last 53 years, having spent *less* time on the subject of how
Python works.

We are in a strange culture in Pythonland. He who knows the most
about Python internals knows all. A little bizarre. If Pythonl;and
is to be an innovative - or even intersting place - it needs, IMO, to
get past this kind of adolescence.

Art
Jul 18 '05 #9
Thanks for all your help everyone, if only it had addressed what I had
asked I may have actually learned something about Python!!

If anything was addressed to my problem then it has completely passed
me by as most points were clearly made by a computer scientist and I am
not one of those in the slightest. My experience of using any type of
programming language is limited to the little we are taught in my
non-computing subject and hence I have no idea what the below is all
about!! In future example code may be more useful to help newbies like
me :)

"That ``speciuficatio n'' (sic) is no more ``a "declaratio n"'' than any
other parameter you can pass to a constructor (or any other factory
callable)."

Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6175
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with itself. Everything you need is available at no costs (except download hassle and installation time). Once your system is set up properly its just a matter of running 'python setup.py build'. No longer waiting for someone else to build binaries and a...
5
3415
by: Pratyush | last post by:
Hi, Suppose there is a vector of objects of class A, i.e., std::vector<A> vec_A(N); The class A satisifies all the STL vector requirements. Now I wish to add some attributes for each of the objects in the vector vec_A. Suppose there are K attributes to be added. For each of the attributes I define K vectors of appropriate types. Say, the attributes have types type1, type2, ..., typeK. So I define std::vector<type1> attr1(vec_A.size());
5
2315
by: Computer Whizz | last post by:
I was reading through Accelerated C++ at work when I read through the first mention of Vectors, giving us certain functions etc. Is there any benefit of Arrays over Vectors? Since all Vectors seem to be (in my eyes at least) are glorified Arrays. - Now I know there's a bit more difference, but what exactly are the advantages of Arrays over Vectors (if any)? Oh, and please keep it in mind I am a real beginner in C++ but can
3
3245
by: Amit | last post by:
Hello. I am having some problem organizing a set of vectors. The vectors itself, could contain a pointer( say integer pointer) or could contain another object MyClass. 1>So, first of all, is there anyway where I can accomodate both the vector types into a single set. Something like a set<vector<void*>, my_compare func >. Right now, I am having them as two different set dayatypes.
4
2016
by: Dr. J.K. Becker | last post by:
Hi all, I have vectors that holds pointers to other vectors, like so: vector<whatever> x; vector<whatever*> z; z=&x; Now I add something to x
5
9011
by: lugal | last post by:
This might be more appropriate here. I'm new to C++, coming from a background in another languages that allowed a similar solution to work (Python). I wrote the following code in C++ based on the Python code found here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 //beginning #include <vector>
5
18194
by: madhu | last post by:
http://msdn2.microsoft.com/en-us/library/fs5a18ce(VS.80).aspx vector <intv1; v1.push_back( 10 ); //adds 10 to the tail v1.push_back( 20 ); //adds 20 to the tail cout << "The size of v1 is " << v1.size( ) << endl; v1.clear( ); //clears the vector I have a few questions:
2
2368
by: joraara | last post by:
Hi. I hope someone would be able to help me with this: I need to declare a structure composed by a couple of vectors. But I need those vectors to have an open dimension, I mean non-especific size (for example: short vector) so that the user doesn't have to be tied under a maximun limit. I'm using Visual C++, but the compiler won't let me use such a way of declaring a vector inside the structure (although I can do it provided it's not...
1
2061
by: Rob | last post by:
How would I do this? I want to be able to handle vectors of many different types of data and vectors that can contain any number of other vectors of data. Currently, I have a templated function that handles vectors of vectors of <typename T(which could be anything from int to vectors of something else). As well, I have specialized/overloaded functions to handle the single-level vectors of data (e.g. vector<string>). So the templated...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.