# Help in programming using Fortran 90 for Computational Physics.

Page 1 of 1

## 3 Replies - 1391 Views - Last Post: 30 October 2012 - 06:59 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=297821&amp;s=58456211fe06913c4a1450a7db086d40&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 jhosamelly

Reputation: 0
• Posts: 3
• Joined: 30-October 12

# Help in programming using Fortran 90 for Computational Physics.

Posted 30 October 2012 - 05:56 PM

Well, our professor in Computational Physics asked us to make a program for interpolation and differentiation.

Its on this link: (Chapter 4 and 5 only)
http://ww2.odu.edu/~.../solutions.html

We haven't discussed this yet and he asked us to do this "activity" while he's gone.

I don't have any idea whatsoever on how to do this. Since this is my first course which involves programming.

P.S: I'm new here so if I'm doing anything wrong please tell me. Thanks for the help in advance.

Is This A Good Question/Topic? 0

## Replies To: Help in programming using Fortran 90 for Computational Physics.

### #2 jhosamelly

Reputation: 0
• Posts: 3
• Joined: 30-October 12

## Re: Help in programming using Fortran 90 for Computational Physics.

Posted 30 October 2012 - 06:51 PM

```program FDA2
implicit none

real (kind=8) :: h, t, x, df1, xdf1, err
integer :: count

h=0.1
t=2.0

!print *,"Enter value for h: "

!print *,"Enter value for t: "
count=1
do
df1 = ((sin (x)) - (sin(x)))/h
xdf1 = cos (x)
err = abs((df1-xdf1)/xdf1)*100

!print *,"FDA Method: ",df1
!print *,"Actual Val: ",xdf1
print *,"h: ", h,"% Error: ", err
h=h/10
count=count+1
if (count==8) exit

end do
end program FDA2

```

This is the problem: Write a program to calculate sin and cosine and determine the forward difference.
Do I have the write codes for sin? we are using Fortran 90.

Thanks.

### #3 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 12269
• Posts: 45,363
• Joined: 27-December 08

## Re: Help in programming using Fortran 90 for Computational Physics.

Posted 30 October 2012 - 06:54 PM

You tell us if your code is correct. Did you run it? Does it work as expected?

### #4 jhosamelly

Reputation: 0
• Posts: 3
• Joined: 30-October 12

## Re: Help in programming using Fortran 90 for Computational Physics.

Posted 30 October 2012 - 06:59 PM

Did I duplicate my post? the second one is only with one question. Anyway, I run it and yes it works. But, I don't exactly know what is expected.