Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Mathematica. I'm not sure how to set this equation up: It seems easy, it's just a wordy question. Write a short program that takes a
Mathematica. I'm not sure how to set this equation up: It seems easy, it's just a wordy question.
Write a short program that takes a list of ordered pairs of data, and applies any function (such as Log or squareroot ) in order to transform the second element of each pair. You will want to test that the list that you give to your function is a list of ordered pairs using the built in functions Dimensions and Depth, and you can apply this test using either the If statement, or the Condition operator. Explain how your program works and show that it works correctly on appropriate and inappropriate inputs. Please note that (1) a set of discrete commands that has to be executed manually is not a program, (2) the program should accept as input both the data to be transformed and the function to apply to the data. (3) the program should accept data lists of ordered pairs that are of arbitrary length. (4) the program should return the entire data set. not just the part that was transformed. Programming can be made simpler if you break the problem down into simpler problems. Please follow these steps to write your program; make sure to label each section of your work with the letter designating the step, so it is easy for you to refer back to each part of the problem: a. Start concretely by writing down the Mathematica commands necessary to apply the Sin function to the second elements of the list {{1, 2}, {3, 4}, {5, 6}, {7. 8}}. define a variable testlist that is equal to this list, and define a second list, tesilist2, which is the copy of testlist that will be modified. After you have executed the correct commands, if you type the variable testlist2, it should return {{1, Sin[2]}, (3, Sin[4]}, {5, Sin[6]}, {7, Sin[8]}}. Section 2.5 of the chapter will help you to do this first step. b. Modify the command so that when you type testlisr2, you get numerical rather than symbolic values, i.e., {{1, 0.909297}, {3, -0.756802}, {5, -0.279415}, {7, 0.989358}}. Section 2.5 of the chapter will also help you with this step. Write a short program that takes a list of ordered pairs of data, and applies any function (such as Log or squareroot ) in order to transform the second element of each pair. You will want to test that the list that you give to your function is a list of ordered pairs using the built in functions Dimensions and Depth, and you can apply this test using either the If statement, or the Condition operator. Explain how your program works and show that it works correctly on appropriate and inappropriate inputs. Please note that (1) a set of discrete commands that has to be executed manually is not a program, (2) the program should accept as input both the data to be transformed and the function to apply to the data. (3) the program should accept data lists of ordered pairs that are of arbitrary length. (4) the program should return the entire data set. not just the part that was transformed. Programming can be made simpler if you break the problem down into simpler problems. Please follow these steps to write your program; make sure to label each section of your work with the letter designating the step, so it is easy for you to refer back to each part of the problem: a. Start concretely by writing down the Mathematica commands necessary to apply the Sin function to the second elements of the list {{1, 2}, {3, 4}, {5, 6}, {7. 8}}. define a variable testlist that is equal to this list, and define a second list, tesilist2, which is the copy of testlist that will be modified. After you have executed the correct commands, if you type the variable testlist2, it should return {{1, Sin[2]}, (3, Sin[4]}, {5, Sin[6]}, {7, Sin[8]}}. Section 2.5 of the chapter will help you to do this first step. b. Modify the command so that when you type testlisr2, you get numerical rather than symbolic values, i.e., {{1, 0.909297}, {3, -0.756802}, {5, -0.279415}, {7, 0.989358}}. Section 2.5 of the chapter will also help you with this stepStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started