# Hey I need help with my task for college

hey i’m a bio med engineer, on my first year. And we were given this task on python course.
I would really appreciate of some could help me with this task…I don’t really understand what they want me to do here… or how to do it.

Do you need help to understand the task or you are stuck somewhere with a solution?
As a student, I would first book office hours with the professor to understand the task,
try something before asking for help in a forum when I am stuck.

I am not a fun of students just posting class problems and getting answers without trying.

5 Likes

What they want you to do is (a) write a function to compute the sine of
an angle in radians using a Taylor series, which they write for you, and
(b) compare your results with the results from the Python math.sin
function.

A basic sketch of such a programme might look like this:

``````from math import sin

def mysin(x):
.... compute sin(x) using a Taylor series ...

angle = float(input("Enter an angle in radians: "))
sin1 = mysin(angle)
sin2 = sin(angle)
print(f"mysin({angle})={sin1} vs sin({angle})={sin2}")
``````

which reads an angle, computes the sine via your function and also via
math.sin(), and prints the results.

The difficult bit will be the Taylor series itself, where you compute a
sum of the various terms in the series until the terms become smaller
than some threshold, which they define for you in the question.

Have a go at that and come back with code and questions if you get
stuck
.

Cheers,
Cameron Simpson cs@cskk.id.au

1 Like

Hello, @noamyod, and welcome to the Python Forum!

So that you may enjoy maximum benefit from this assignment, it would be best to try to develop a solution, and post it here with your questions, as you progress with the work.

A good way to begin would be to examine the first several terms in the Taylor series and describe, in words, what patterns can be discerned when proceeding from any given term to the next one. For example, how do the numerators change, and how do the denominators change? Is there any alternating pattern regarding how adjacent terms are applied to an accumulating sum?

If you give this a good try, and post your work, other users can offer constructive suggestions.

yeah I tried that, but the professor didn’t know how to answer her own question…and she wants us to do that…
And we also didn’t learn Taylor series in calculus yet, so I don’t really get the equation

hey, thank you for trying to help. but I haven’t learn the Taylor series in calculus yet…
We need to learn it in a month…

You don’t need to know much about it to do this assignment. Begin by looking at the patterns in the equation on the assignment sheet. For example, what is the power of x in the first term? How does the power of x in the numerator change from each term to the next?