• Ask an Expert
• Get a Professional Answer
• 100% Satisfaction Guarantee
Raj, Engineer
Category: Homework
Satisfied Customers: 1290
Experience:  4 + Experiance in IT Industry
16752232
Type Your Homework Question Here...
Raj is online now

# Trigonometric functions, such as sine and cosine are normally

This answer was rated:
Trigonometric functions, such as sine and cosine are normally evaluated on computers by using a truncated infinite series. The same approach is used to compute the inverse of these functions.
For instance, a truncated series used to calculate the cos of an arbitrary angle x is
 cos x=1-(x^2/2!) +(x^4/4!) - (x^6/6!)+.....+(-1)^n (x^(2n)/(2n)!)
and, k! = 1x2x3x......x k
           
in which x is in radians. Write a program in VB that allows user to enter values x and n. Then the
program calculates cos(x) by above formula using n first terms of the series and a DO LOOP. Using
your program find and report values of cos30 and cos60 for n=2, 4, and 5.
Develop a ‘Windows Forms’ application which allows user to enter values of n
and x via a graphical interface, and calculates/dispays cos(x) when ‘Calculate’ button is clicked User can exit the program by clicking ‘Exit’ button.
Hi,
Welcome back.
Thank you for asking me.
You should be using 'for logicpro'

What is the deadline?
Customer: replied 3 years ago.

hey, yeah sorry it just said ask logic pro so I thought it just send straight to you.

Customer: replied 3 years ago.
Hi There,

My Name is XXXXX XXXXX I will be helping you with the solution.
May I know how much time is left before the deadline?

Thank you
Customer: replied 3 years ago.

I just need it within an hour?

1 Hour is enough for me to complete the project.
Will be posting the solution within 1 hr.
Customer: replied 3 years ago.

thanks raj

You are Welcome
Almost done just implementing the do part of the loop
Customer: replied 3 years ago.

do you reckon you could make it as basic as possible? if that makes sense?

Yes I am making it very basic.
Customer: replied 3 years ago.

thankyou

Hi There,

Solution project is ready.

I have compressed the Solution project into one file.
So after downloading the file you will have to extract its content and in the folder open the file with name "Cos Function.sln" to open the project in Visual Basic

http://www.mediafire.com/?3jm77gss94qcy1k

If you face any difficulty than feel free to ask for help.

If the solution file is satisfactory than Please don't forget to RATE the Answer.
It will hardly take few seconds to RATE my Answer

Thank You and Have a Good Day.

I think my last post containing solution didn't go through So, I will post the solution file again:

Solution project is ready.

I have compressed the Solution project into one file.
So after downloading the file you will have to extract its content and in the folder open the file with name "Cos Function.sln" to open the project in Visual Basic

http://www.mediafire.com/?3jm77gss94qcy1k

If you face any difficulty than feel free to ask for help.

If the solution file is satisfactory than Please don't forget to RATE the Answer.
It will hardly take few seconds to RATE my Answer

Thank You and Have a Good Day.

Customer: replied 3 years ago.

so I tried to run it, and their are a few errors it says? stuff about

'statement is not valid in a namespace'

and

Error 1 'Sub Main' was not found in 'ConsoleApplication1.Module1'. ConsoleApplication1

and

Error 12 'End Class' must be preceded by a matching 'Class'. C:\Users\Donna\AppData\Local\Temporary Projects\ConsoleApplication1\Module1.vb 114 1 ConsoleApplication1

I sent you a GUI Form Application not a Console Application so The Error Above is not possible using the Project I sent you.

Simply Uncompress the File and open the SLN FILE not the VB File

Than Run the project and Output will look something like the following:

Customer: replied 3 years ago.

when I open the solution file it comes up with an error message saying one or more projects in the solution were not loaded correctly. sorry to e a nuisance, im just not very good with all this programing

No Problem , I understand
What version of Visual Studio are you using? Is it 2008 or 2010 or 2012?
Customer: replied 3 years ago.

its 2010

I have made the solution in same 2010 version of Visual Studio.

Ok I will provide you step by step Solution how to run it.

STEP 1 : Download the compressed file I have sent you.
STEP 2 : Close Everything all the projects that you have kept opened.
STEP 3 : Extract the contents of Downloaded file in which you will get a FOLDER with name "Cos Function"
STEP 4 : When you go inside the Folder you will See three files named as follows:
a) Folder with name Cos Function
b) File with name Cos Function.sln
c) File with name CosFunction.suo
Among above three files Double Click Cos Function.sln file and the project will open in Visual Studio with two parts(1 is code part, Other is Form Design Part).
STEP 5 : Press F5 Key from the keyboard to RUN the code and get the OUTPUT
Customer: replied 3 years ago.

okay thankyou, I found the sln file but is it possible you could send the code just over a message here? sorry raj if im being quite difficult

Actually in GUI(Windows Form Project) the project gets divided into two parts:
1. CODE PART
2. FORM DESIGN PART

So We cannot complete the project when one part is missing and Form cannot be submitted in form of code.

So If I only provide you the code part it wont work alone.
And Form is made using drag and drop so even thats not possible to convert to code and provide.

Customer: replied 3 years ago.

the cos of an arbitrary angle x is
 cos x=1-(x^2/2!) +(x^4/4!) - (x^6/6!)+.....+(-1)^n (x^(2n)/(2n)!)
and, k! = 1x2x3x......x k
           
in which x is in radians. Write a program in VB that allows user to enter values x and n. Then the
program calculates cos(x) by above formula using n first terms of the series and a DO LOOP.

The console application for just this part... do you reckon you could just send the code just for this part of the question? ignoring the windows forms part?

Ok Give me 10 min and I will post the code for console version of the requirement.
CODE is as follows as a Console Application:

Module CosFunction

Sub Main()
Dim n As Integer
Dim x As Integer
Dim i As Integer
Dim j As Integer
Dim sign As Integer
Dim result As Double
Dim fact As Integer

i = 2
sign = -1
result = 1

Console.Write("n : ")
Console.Write("x : ")

Do While i <= (2 * n)
fact = 1
For j = 1 To i
fact = fact * j
Next
result = result + ((Math.Pow(sign, i - 1) * Math.Pow(x, i)) / fact)
i = i + 1
Loop

Console.WriteLine("cos (" + Convert.ToString(x) + ") : " + Convert.ToString(result))
End Sub

End Module
THIS ANSWER IS LOCKED!

You need to spend \$3 to view this post. Add Funds to your account and buy credits.
Raj, Engineer
Category: Homework
Satisfied Customers: 1290
Experience: 4 + Experiance in IT Industry
Raj and other Homework Specialists are ready to help you
Thank you for your Feedback

In Future to request any new Question to me just begin your Question with TO RAJ followed by the Question in the following format:

TO RAJ: Followed by the Question.

Have a Good Day.