# Mathematical Operation

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 07-08-2008
Mathematical Operation
prepare a report which contains the C source code, the documentation and the flow charts, along with drawings explaining the mathematical background related to the calculation of-

insert
Code:

F(x)= 5.x^2 + e ^(1/2.x) / 1/3.x^2+25.x+1.6

in the range x ∑{A,B}

With a step of B-a/y, e.g. y= 1000.

The range, i i.e. a,b along with the step discretisation should be user defined. The results of the calculation should be stored in a file in the current directory which is also user defined.

in a second independent program, calculate the area (integral from a to b)

f (x).dx for the discrete value of an f(x) passed to the program through a user defined file located in the current directory. The output of the previous program

in a third independent program calculate f`(x)= dy/dx for all values provided the output file of the first prgram with the assumption that dy/dx= ∆y/∆x, ∆x→0

How would I do this? I have taken a c language class but have never did equatons or mathematical operations, also how do flow charts work?
• 07-08-2008
zacs7
Don't just copy & paste your assignment on here. Ask a specific question.

Most of the operators are what you'd find on a calculator, ie + (add), - (minus). Get a good book, it'll help. It seems you don't have to parse any math equations, so it all should be fairly straight forward (providing you have a good point of reference / book).
• 07-08-2008
audinue
Quote:

F(x)= 5.x^2 + e ^(1/2.x) / 1/3.x^2+25.x+1.6
What a hell is that! :S
• 07-08-2008
that says that the function F(x) is equal to 5.x^2 + e ^(1/2.x) / 1/3.x^2+25.x+1.6 , the ^`s are used to show powers. e^(1.2.x) is exponent to the power of .5 times x. Do you understand now? I only know the basics of C, but am not sure whether a source code is correct or has errors. Can someone please help me with the source code?
• 07-08-2008
rags_to_riches
Sounds like you did not satisfy all the prerequisites for your class, and it's come back to bite you. Happened to me once too, taking Calculus 3 without Calc 1 and 2 (I took business calculus by accident...I was going to school a night). I survived Physical Chemistry without Calc 3 just fine.

You need to either address this with your professor or withdraw from the class. It's the right thing to do.
• 07-08-2008
audinue
Quote:

• 07-09-2008
insert
Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main ()
{
double a,b,x;
printf("range[a,b]=");
scanf("%lf %lf",&a,&b);

printf("input [a,b]=(%lf %lf)\n",a,b)
if (a>b)
{
printf("error:a>b\n");
exit(1);
}
FILE *fd;
if((fd=fopen("sample.txt","w"))==NULL)
{
printf("cannot open file.\n");
}
x=a;
while(x<=b)
{
fprintf(fd,"%lf\t%lf\n",x,(3+exp(0.5*x))/0.3*x*X+25*x+1.6));
x=x+(b-a)/1000;
}
close(fd);
exit(0);
}

This is the source code for the first problem, is it correct? how can i do the flow charts and documentation?
• 07-09-2008
laserlight
Quote:

This is the source code for the first problem, is it correct?
Most certainly not, since it lacks proper formatting to make it readable. As to whether it works as expected... that should be tested by you.

Quote:

how can i do the flow charts and documentation?
Do you need a soft copy of the flow charts and other drawings? If not, it would be pretty easy to sketch them out by hand.
• 07-09-2008
Quote:

This is the source code for the first problem, is it correct? how can i do the flow charts and documentation?

It's your code, didn't you run it and see if it gives the right answer on several test sets of data?

You just post up code, but didn't test it! Brilliant! Absolutely *brilliant*!

Usually, you do flow charts by seating yourself, reviewing you class notes and text books on flow charts, and beginning the work. And let me emphasize the YOU DOING the WORK, part of it.

Ditto with your request for the program's documentation.

There is no big shortcut to learning how to program - *you* have to do a lot of work, plain and simple.
• 07-09-2008
Can I get any of your emails to contact you guys? I do not have the program to test the code, thats the problem. Can anyone test it for me? I would really appreciate it.
• 07-09-2008
laserlight
Quote:

I do not have the program to test the code, thats the problem.
That problem is easily solved. You can download compilers available at zero price online. For example, for Windows users, the MinGW port of gcc is packaged with the open source IDE Code::Blocks, and Microsoft's optimising compiler (for both C and C++) is available with the free Microsoft Visual C++ 2008 Express.
• 07-09-2008
• 07-09-2008
laserlight
Quote:

I would like to contact you about something.
Pose your questions to the community here.

Quote: