[fortran90] cartesian to polar coordinate

In summary, the conversation is about writing a FORTRAN90 subroutine and program to convert Cartesian coordinates to spherical polar coordinates. The program should be able to handle multiple points and the results should be output in degrees and written to a text file. It is mentioned that the program and subroutine should be edited as separate files. The individual asking for help is informed that they cannot request code on this platform and must do their own coding.
  • #1
2000yak
1
0
Write a short FORTRAN90 subroutine to convert Cartesian coordinates (x, y, z) to spherical polar coordinates (r, q, f) using
• Write a FORTRAN90 program which uses this subroutine to convert the following (x, y, z) coordinates which are read from a text file and stored within a single vector (1D allocatable array) – (3.0, 4.5, -1.0) , (5.2, 2.6, 1.4) , (-1.0, -1.0, 0.0) , (0.0, 3.0, 3.0)
• Note that: – Both q and f should be output in degrees with 0 £ q £ 180º and 0 £ f < 360º – Both the program and the subroutine should be edited as separate files – The program should be able to convert any number of points and the results should be written to a text file.

this is the problem...
please... code this in fortran
 
Physics news on Phys.org
  • #2
Yak, you have been tragically mis-informed. PF is not a job-shop code shack. You've got to do all your own coding.
 
  • #3
Thread closed.

2000yak, read your private messages.
 

Related to [fortran90] cartesian to polar coordinate

1. What is the difference between Cartesian and polar coordinates in Fortran90?

Cartesian coordinates are based on a rectangular grid, where the position of a point is represented by its distance from the origin along two perpendicular axes. Polar coordinates, on the other hand, use a radial distance and an angle to describe the position of a point relative to an origin.

2. How do I convert from Cartesian to polar coordinates in Fortran90?

To convert from Cartesian to polar coordinates, use the ATAN2 function to calculate the angle, and the SQRT function to calculate the radial distance. These values can then be used to assign the appropriate variables for the polar coordinates.

3. Can Fortran90 handle complex numbers in polar coordinates?

Yes, Fortran90 has built-in support for complex numbers, including the ability to represent them in polar form using the CMPLX function.

4. Are there any built-in functions in Fortran90 for working with polar coordinates?

Aside from the ATAN2 and SQRT functions mentioned earlier, Fortran90 also has the POLAR function, which converts from rectangular coordinates to polar coordinates, and the CARTESIAN function, which does the opposite. There are also various mathematical functions that can be used with polar coordinates, such as SIN, COS, and EXP.

5. How do I plot data using polar coordinates in Fortran90?

Fortran90 has a built-in graphics library, GKS, which supports the plotting of data in polar coordinates. You can use the PLOT function to create a polar plot, specifying the radial distance and angle for each data point. Alternatively, you can use the POLAR function to convert your data to rectangular coordinates and then use the standard PLOT function to create a regular x-y plot.

Similar threads

  • Programming and Computer Science
Replies
4
Views
639
Replies
1
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
5K
Replies
47
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
2K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
8
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Advanced Physics Homework Help
Replies
1
Views
2K
Back
Top