Mathematica Help with Table command and Matrix operations

Click For Summary
SUMMARY

The discussion focuses on generating data using the Table command in Mathematica and performing matrix operations. The user encounters issues with extra parentheses in the output of the Table command, which complicates matrix multiplication. Specifically, the user attempts to multiply a 2x10 matrix (test) with a 2x2 matrix (test2) but faces errors due to the formatting of the data. The solution provided involves modifying the Table command to eliminate the extra parentheses by accessing the first element of the solved equation.

PREREQUISITES
  • Familiarity with Mathematica syntax and commands
  • Understanding of matrix operations in linear algebra
  • Knowledge of the Solve function in Mathematica
  • Experience with data structures in Mathematica, specifically lists and matrices
NEXT STEPS
  • Learn how to manipulate lists and matrices in Mathematica
  • Explore the use of the Solve function for equations in Mathematica
  • Research matrix multiplication rules and techniques in Mathematica
  • Investigate debugging techniques for common syntax errors in Mathematica
USEFUL FOR

Mathematica users, data analysts, and anyone involved in mathematical modeling or matrix operations seeking to enhance their skills in data manipulation and matrix calculations.

Amatya
Messages
1
Reaction score
0
Hi,

I need to generate some data in a Table and then be able to do all kinds of matrix and other mathematical operations on them. Right now I am testing the commands but am unable to get them to work. My table has this extra parenthesis floating around which I'm not sure how to get rid of.

Code:
test = Table[{i^2, y /. Solve[2 y + i == 0]}, {i, 1, 10}]
Code:
 Out[8]={{1, {-(1/2)}}, {4, {-1}}, {9, {-(3/2)}}, {16, {-2}}, {25, {-(5/
    2)}}, {36, {-3}}, {49, {-(7/2)}}, {64, {-4}}, {81, {-(9/
    2)}}, {100, {-5}}}
Code:
test2 = {{1/2, 0}, {0, 1/2}}


Now I am unable to multiply the two Matrices, Test 2x10 and Test2 2x2. I have tried
Code:
test2.test
and also
Code:
test.test2
and neither command works. Also, Test has this additional set of parenthesis around the entries in the second column, for example like this:
Code:
{1, {-(1/2)}}
. I would like to be able to get rid of them if possible.. though I'm not sure if that messes anything up.

Any help will be greatly appreciated. Thanks a lot,
 
Physics news on Phys.org
Replace your code with

Code:
test=Table[{i^2,y/.Solve[2 y+i==0][[1]]},{i,1,10}]
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K