I have the following formula:
y = a1cos(θ1) +a2cos(θ1+θ2) +...+ancos(θ1+...+θn)
The goal is to implement it in Python so it works with any number of a-value/theta angles combination.
So far I have written code which stores in two separate dictionaries:
- A combination of a-value number and a value
- A combination of a-value number and an angle value
This is implemented via two for loops where i is the number of values the user wants the formula to work with. Here is the code:
a_values_list = {}
a_number = int(input("\nHow many values of a would you like to enter?"))
for i in range(0, a_number):
key = input("Input a-value number")
value = input("Input corresponding value of a")
a_values_list[key] = value
angles_list = {}
for i in range(0,a_number):
key = input('Input a-value number')
value = input("\n Enter a corresponding angle displacement between 0 and pi")
angles_list[key] = value
I need help with the following:
- Figuring out how to implement the formula based on the number of a-values/angle combinations stored in the dictionaries
- Getting the angle values from the dictionaries and adding them within the cos statements
Thank you for your time