Input a polynomial into FORTRAN?

In summary, the conversation discusses the possibility of inputting a polynomial into a FORTRAN program. While it may not be a built-in feature, there are options such as writing a subroutine or using a text file to input the polynomial. Other suggestions include using a function with arguments or searching for solutions online.
  • #1
danerape
32
0
Input a polynomial into FORTRAN?

Hello all, I took a Fortran programming class last semester and can write Fortran well. However, I never recall anyone ever asking if there would be a way to input a polynomial into the command prompt. I'm assuming there is not. It would be great though. I have written an entire diff and int program that can do logs,trig,exp,inverse, basically everything. I still have to chose what kind of diff/int, the degree and input each coefficent on its own. Would be nice to just enter a poly and hit enter.

THANKS
 
Technology news on Phys.org
  • #2


You could write your own subroutine to do it. You could use a function with two arguments, an integer (polynomial degree) and a vector of the coefficients.
 
  • #3


It is not the solution you requested, but couldn't you just have the program open and read from a text file? It would save you the trouble of constantly entering the data one-at-a-time, possibly making typos, etc. That is what I do, especially during the debugging phase of writing a program.

Alternately, I did a Google search for

fortran read command line

and came up with many results. Perhaps there is something there that can help you.
 
Last edited:

Related to Input a polynomial into FORTRAN?

What is a polynomial in FORTRAN?

A polynomial in FORTRAN is a mathematical expression consisting of one or more terms, with coefficients and variables raised to non-negative integer powers. It is typically represented as a series of terms separated by addition or subtraction operators.

How do I input a polynomial into FORTRAN?

To input a polynomial into FORTRAN, you will need to use the appropriate syntax for mathematical expressions. This may vary depending on the specific version of FORTRAN you are using, but generally you will need to declare variables and coefficients, assign them values, and perform operations using mathematical operators.

Can I input a polynomial with multiple variables into FORTRAN?

Yes, FORTRAN supports polynomials with multiple variables. You will need to declare and assign values to each variable, and use appropriate operators to perform operations between the variables and coefficients.

What are the benefits of inputting a polynomial into FORTRAN?

Inputting a polynomial into FORTRAN allows you to easily perform mathematical operations and calculations on the polynomial. FORTRAN is a high-level programming language designed for scientific and mathematical applications, making it a powerful tool for working with polynomials and other mathematical expressions.

Are there any limitations to inputting a polynomial into FORTRAN?

There may be some limitations to inputting a polynomial into FORTRAN, depending on the specific version and implementation. Some older versions of FORTRAN may have limitations on the number of variables or terms that can be used in a polynomial, or may have more complex syntax for inputting polynomials. It is important to consult the documentation for your specific version of FORTRAN to ensure you are using the correct syntax and avoiding any limitations.

Similar threads

  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
2
Replies
59
Views
9K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
Back
Top