Most metals weaken as temperature increases. For many metals, its Ultimate Tensi
ID: 3764610 • Letter: M
Question
Most metals weaken as temperature increases. For many metals, its Ultimate Tensile Strength (UTS) is defined by the following equation, where T is the current temperature and the Exponent is specific to the metal: UTS = 1.0 - (T/1000)^Exponent For example, a common type of Stainless Steel has an Exponent value of 2.0. For the temperature values [0, 100,200,300, 400, 500], the UTS of this type of stainless steel is [1.0, 0.99, 0.96, 0.91, 0.84,0.75]. That means, for example, that at 500 degrees C, this type of stainless steel retains 75% of its original strength. Write a function that takes 2 vectors, T and E --- temperatures and exponents -- and returns a matrix of UTS values for each combination of temperature and exponent. Example: suppose T= [0, 200, 400] and E [2.0, 3.0], then the function returns 1.0, 1.0 0.96, 0.992 0.84, 0.936 the rows denote each temperature [0,200,400] and the columns denote each exponent [2.0,3.0].Explanation / Answer
As the language is not mentioned so I will be using JAVA to implement the function
The complete Java code is shown below. It contains a main method to intialize the two vectors and calcUTS method which alculates the UTS from the values passed through two arrays.
import java.util.*;
import java.io.*;
public class UltimateTensileStrength{
static void clacUTS(double temp[], int exp[])
{
double uts;
int s1=temp.length;
int s2=exp.length;
double utsArr[][]= new double[s1][s2];
for(int i=0;i<s1;i++)
{
for(int j=0;j<s2;j++)
{
uts=1.0-Math.pow((temp[i]/1000),exp[j]);
utsArr[i][j]=uts;
}
}
for(int i=0;i<s1;i++)
{
for(int j=0;j<s2;j++)
{
System.out.print(utsArr[i][j]+" ");
}
System.out.println(" ");
}
}
public static void main(String[] args) {
try
{
double temp[]={0,200,400}; // Temperature Vector and size can be changed
int exp[]={2,3}; // Exponents Vector and size can be changed
clacUTS(temp,exp);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.