Question: Given a function of two parameters x and y , we want to create a file with a table of function values. The left column
Given a function of two parameters x and y we want to create a file with a table of function values. The left column of the table contains y values in decreasing order as we go down the rows, and the last row contains the x values in increasing order. That is the first column and the last row act like numbers on an x and y axis in a coordinate system. The rest of the table cells contains function values corresponding to the x and y values for the respective rows and columns. For example, if the function formula is x Cy x runs from to in steps of and y run from to in steps of the table looks as follows: The task is to write a function: def writetabletofilef xmin, xmax, nx ymin, ymax, ny width decimalsNone, filenametable.dat:where f is the formula, given as a Python function; xmin, xmax, ymin, and ymax are the minimum and maximum x and y values; nx is the number of intervals in the x coordinates the number of steps in x direction is then xmaxxminnx; ny is the number of intervals in the y coordinates; width is the width of each column in the table a positive integer; decimals is the number of decimals used when writing out the numbers None means no decimal specification and file name is the name of the output file. For example, widthand decimalsgives the output format g while width and decimalsNone implies g
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
