Mathematica Asked by Tarandeep Kaur on January 9, 2021
I have to form a matrix like this. How ever I can not directly input. I have to form a function and then use the table command. I am stuck.
{{2,5,10},{9,12,17},{28,31,36}}
This problem is an example of finding rules that match number sequences. For problems like these, the answer is less important than understanding the steps you use to find a solution.
A number sequence is a list of numbers that's defined by a rule. If you work out the rule, you can find the numbers in the sequence. Find the rule by looking for a pattern or common factor that defines the next number in the sequence. Finding rules is a combination of logic and intuition.
A simple example is the number sequence (5,9,13,17). The difference between each number is 4, so the rule is to add 4 each time. Mathematica can help find these rules. For example:
FindFormula[{5, 9, 13, 17}, n]
(* 1. + 4. n *)
For your table, you might begin by looking at each row to find a rule that defines the number sequence. Again, logic and intuition is important, but Mathematica can help. Inspect the first row, and notice that the numbers depend on the column number. For the first row, we can try:
FindFormula[{2, 5, 10}, c]
and we find $1 + c^2$. For the second and third rows, we use FindFormula[{9, 12, 17}, c]
and FindFormula[{28, 31, 36}, c]
. The results are $8 + c^2$ and $27 + c^2$.
Notice the common factor $c^2$, and that each row begins number: 1, 8 and 27. Let's try to find a rule for the sequence (1, 8, 27).
FindFormula[{1, 8, 27}, r]
We see that $r^3$ is the rule that defines the number sequence for each row. Combining these results for the columns and rows, we can build a table.
Table[r^3 + c^2, {r, 3}, {c, 3}] // MatrixForm
$left( begin{array}{ccc} 2 & 5 & 10 \ 9 & 12 & 17 \ 28 & 31 & 36 \ end{array} right)$
Answered by creidhne on January 9, 2021
Let me first explain that it makes sense to use Table
only when you know the functional form of a sequence. In you example one can only guess what was the actual idea for this homework. One possible solution would be
Table[j + i^2 - 1, {j, {2, 9, 28}}, {i, 3}]
But I would like to emphasize that both, for this forum and for your teacher, you need to demonstrate some work. It is pathetic, but this is the only way to learn something.
Answered by yarchik on January 9, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP