need some help on this final project.
not asking for someone to do it for me just asking for maybe some guidelines and the premise of the project.
need some help on [url=https://drive.google.com/file/d/1cPb8H6cmCFvY5kUnjLgaWKUZIfw20VR0/view?usp=sharing]this final project.[/url]
not asking for someone to do it for me just asking for maybe some guidelines and the premise of the project.
that site prompts me for a login
that site prompts me for a login
now i have to ask for permission :c
now i have to ask for permission :c
If you need inspiration or coding style guidelines, browse GitHub for some python math-oriented projects. There should be a lot of solutions that may fit your project.
Apart from that - wrap the Vector in a class and implement __add__ method and hide the math logic in it.
If you need inspiration or coding style guidelines, browse GitHub for some python math-oriented projects. There should be a lot of solutions that may fit your project.
Apart from that - wrap the Vector in a class and implement __add__ method and hide the math logic in it.
im not that advanced yet. This is a very simple python class, and I'm literally so lost for this final. I understand the for and while loops, and also understand defining a function and calling it, but past that, i'm lost.
im not that advanced yet. This is a very simple python class, and I'm literally so lost for this final. I understand the for and while loops, and also understand defining a function and calling it, but past that, i'm lost.
Have you had any experience with oop before?
Have you had any experience with oop before?
You can store the x and y params in a tuple as well, without using classes. But this approach sounds pretty painful in a long-term...
You can store the x and y params in a tuple as well, without using classes. But this approach sounds pretty painful in a long-term...
i dont think this is supposed to be object programing...just to complete all the maths and give a correct answer to the inputs. it doesnt have to be so complex. i just need help on how to actually start this off and perhaps i can figure the rest out
i dont think this is supposed to be object programing...just to complete all the maths and give a correct answer to the inputs. it doesnt have to be so complex. i just need help on how to actually start this off and perhaps i can figure the rest out
What exactly are you having trouble with ?
I think the document you shared does a pretty good job splitting the task in smaller sub-tasks that can easily be resolved.
What exactly are you having trouble with ?
I think the document you shared does a pretty good job splitting the task in smaller sub-tasks that can easily be resolved.
jerti dont think this is supposed to be object programing...just to complete all the maths and give a correct answer to the inputs. it doesnt have to be so complex. i just need help on how to actually start this off and perhaps i can figure the rest out
write a method like this:
def (vec1mag, vec1ang, vec2mag, vec2ang)
that returns
(sumMag, sumAng)
or something similar to that. to add two vectors, you can simply sum their x components and their y components, then convert back to magnitude and angle. you should be able to do that with simple right-angled trig. draw some pictures if it's difficult to visualise, and label each argument on the diagram
[quote=jert]i dont think this is supposed to be object programing...just to complete all the maths and give a correct answer to the inputs. it doesnt have to be so complex. i just need help on how to actually start this off and perhaps i can figure the rest out[/quote]
write a method like this:
[code]def (vec1mag, vec1ang, vec2mag, vec2ang)[/code]
that returns [code](sumMag, sumAng)[/code] or something similar to that. to add two vectors, you can simply sum their x components and their y components, then convert back to magnitude and angle. you should be able to do that with simple right-angled trig. draw some pictures if it's difficult to visualise, and label each argument on the diagram
I am almost 100% sure this is an ethics violation at whatever school you attend.
I am almost 100% sure this is an ethics violation at whatever school you attend.
eulerI am almost 100% sure this is an ethics violation at whatever school you attend.
https://i.imgur.com/7Ebq0D6.png
asking for help isn't bad as long as he can still understand the work. notice how he's not asking for full code and no-ones giving it to him
[quote=euler]I am almost 100% sure this is an ethics violation at whatever school you attend.[/quote]
[img]https://i.imgur.com/7Ebq0D6.png[/img]
asking for help isn't bad as long as he can still understand the work. notice how he's not asking for full code and no-ones giving it to him
I'd start by doing it for 2 vectors only, where you would set 4 variables at the start of the program to whatever the user inputs, say v1Magnitude and v1Angle for the first vector's inputs, and v2Magnitude and v2Angle for the other vector.
Next make a function that takes the magnitude and angle and returns the x component, and a similar function for the y component, so
v1XComponent = calculateXComponent(v1Magnitude, v1Angle)
v1YComponent = calculateYComponent(v1Magnitude, v1Angle)
v2XComponent = ...
and then do similar functions for the rest of the steps involved in the calculations. This can all be done sequentially with pretty much no looping required.
Since you are required to use at least one loop, this version of the program won't fill all of the requirements. Storing the magnitudes and angles in a list (for example a list for magnitudes and a list for angles) instead of making a load of variables would allow for some looping to go on, such as
for i in range(0,2)
xComponentList[i] = calculateXComponent(magnitudeList[i], angleList[i])
yComponentList[i] = calculateYComponent(magnitudeList[i], angleList[i])
where the indexes of each item in the list tells us the order in which the vectors were input into the program.
This could be much better implemented by using a class for each vector, but since there is no mention of classes in the requirements, using a bunch of lists will probably be good enough for the project. There are some good tutorials of how to create and use classes in Python on codecademy.
I'd start by doing it for 2 vectors only, where you would set 4 variables at the start of the program to whatever the user inputs, say v1Magnitude and v1Angle for the first vector's inputs, and v2Magnitude and v2Angle for the other vector.
Next make a function that takes the magnitude and angle and returns the x component, and a similar function for the y component, so
[code]
v1XComponent = calculateXComponent(v1Magnitude, v1Angle)
v1YComponent = calculateYComponent(v1Magnitude, v1Angle)
v2XComponent = ...
[/code]
and then do similar functions for the rest of the steps involved in the calculations. This can all be done sequentially with pretty much no looping required.
Since you are required to use at least one loop, this version of the program won't fill all of the requirements. Storing the magnitudes and angles in a list (for example a list for magnitudes and a list for angles) instead of making a load of variables would allow for some looping to go on, such as
[code]
for i in range(0,2)
xComponentList[i] = calculateXComponent(magnitudeList[i], angleList[i])
yComponentList[i] = calculateYComponent(magnitudeList[i], angleList[i])
[/code]
where the indexes of each item in the list tells us the order in which the vectors were input into the program.
This could be much better implemented by using a class for each vector, but since there is no mention of classes in the requirements, using a bunch of lists will probably be good enough for the project. There are some good tutorials of how to create and use classes in Python on codecademy.
If you're new to Python and don't mind spending like $1 or more you could buy the Python dev kit on Humble Bundle currently. There are a couple of guides on how to write pythonic code and PyCharm is a solid IDE, although you might be able to get it for free if you're a student.
You should be more specific about what you're having issues with though
If you're new to Python and don't mind spending like $1 or more you could buy the Python dev kit on [url=https://www.humblebundle.com/software/python-dev-kit-bundle]Humble Bundle[/url] currently. There are a couple of guides on how to write pythonic code and PyCharm is a solid IDE, although you might be able to get it for [url=https://www.jetbrains.com/student/]free[/url] if you're a student.
You should be more specific about what you're having issues with though
The most easy way to do this in your program:
1. Use a list of angles and a list of magnitudes as your input.
2. Write a function that converts angle and magnitude into x and y components (the mathematical stuff for all of this is in part I in the document you linked and you can use the math package for the value of pi and the cos and sin functions).
3. for loop through your list with the function and output the x and y components to 2 new lists.
4. Take the sum of the x list and the sum of the y list.
5. Write a new function that converts x and y components back into angle and magnitude and apply this to your summed x and y.
6. You now have the resultant vector, print this out in a formatted way.
I notice that's only 2 functions, you can do degrees to radians/radians to degrees as a third if you want.
The most easy way to do this in your program:
1. Use a list of angles and a list of magnitudes as your input.
2. Write a function that converts angle and magnitude into x and y components (the mathematical stuff for all of this is in part I in the document you linked and you can use the math package for the value of pi and the cos and sin functions).
3. for loop through your list with the function and output the x and y components to 2 new lists.
4. Take the sum of the x list and the sum of the y list.
5. Write a new function that converts x and y components back into angle and magnitude and apply this to your summed x and y.
6. You now have the resultant vector, print this out in a formatted way.
I notice that's only 2 functions, you can do degrees to radians/radians to degrees as a third if you want.
python is sick for maths just download some library to do it for u
python is sick for maths just download some library to do it for u
NumPy is really good for anything with arrays and math, it has all basic trig functions iirc. If you want to minimize how many variables you make, have your functions store the components in a single array and add the arrays.
NumPy is really good for anything with arrays and math, it has all basic trig functions iirc. If you want to minimize how many variables you make, have your functions store the components in a single array and add the arrays.