Jacobi method in linear systemspull out p-values and r-squared from a linear regressiondata.frame to array (2 columns)reason for faster matrix allocation in RMaking a new class for a matrix in RHow to assign values from current matrix to another an empty matrixUsing Cost Sensitive C50 in caretGet all diagonal vectors from matrixR: how to count the number of times two elements have the same ID (perhaps using the outer function)R table one variable vs all other from dbSorting a table according to counts
Find the wrong number in the given series: 6, 12, 21, 36, 56, 81?
How can I legally visit the United States Minor Outlying Islands in the Pacific?
get rid of master boot record
Too many spies!
Why does the trade federation become so alarmed upon learning the ambassadors are Jedi Knights?
Ambiguous sentences: How to tell when they need fixing?
Am I testing diodes properly?
The monorail explodes before I can get on it
As a DM, how to avoid unconscious metagaming when dealing with a high AC character?
Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?
A "Simple" Task
How does one stock fund's charge of 1% more in operating expenses than another fund lower expected returns by 10%?
What is a printer console?
Do native speakers use ZVE or CPU?
How is the idea of "X comes a distant third" commonly expressed in Russian?
What's the point of this scene involving Flash Thompson at the airport?
How can I deal with a player trying to insert real-world mythology into my homebrew setting?
To accent or not to accent in Greek
Supporting developers who insist on using their pet language
What is this welding tool I found in my attic?
TikZ Can I draw an arrow by specifying the initial point, direction, and length?
Is Arc Length always irrational between two rational points?
Was the Ford Model T black because of the speed black paint dries?
Would letting a multiclass character rebuild their character to be single-classed be game-breaking?
Jacobi method in linear systems
pull out p-values and r-squared from a linear regressiondata.frame to array (2 columns)reason for faster matrix allocation in RMaking a new class for a matrix in RHow to assign values from current matrix to another an empty matrixUsing Cost Sensitive C50 in caretGet all diagonal vectors from matrixR: how to count the number of times two elements have the same ID (perhaps using the outer function)R table one variable vs all other from dbSorting a table according to counts
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Hello I would like to use the jacobi method in my own function to get the best guesses for b1, b2 and b3 in the displayed image.
So far I tried this function I made which gave me answers [2, 4, 1.625].
The right answers are however : [-1, 3, 2]. What am I doing wrong ?
jacobi <- function(x, y)
b <- matrix(0,3)
n <- nrow(b)
som <- 0
for (i in 1:n)
for (j in 1:n)
if (i != j)
som = x[i,j]*b[j]+som
u[i] <- (y[i]-som)/x[i,i]
b<-u
print(b)
D <- matrix(c(4,3,-2,2,-5,3,3,2,8),3,3)
E <- matrix(c(8,-14,27))
jacobi(D,E)
r
add a comment |
Hello I would like to use the jacobi method in my own function to get the best guesses for b1, b2 and b3 in the displayed image.
So far I tried this function I made which gave me answers [2, 4, 1.625].
The right answers are however : [-1, 3, 2]. What am I doing wrong ?
jacobi <- function(x, y)
b <- matrix(0,3)
n <- nrow(b)
som <- 0
for (i in 1:n)
for (j in 1:n)
if (i != j)
som = x[i,j]*b[j]+som
u[i] <- (y[i]-som)/x[i,i]
b<-u
print(b)
D <- matrix(c(4,3,-2,2,-5,3,3,2,8),3,3)
E <- matrix(c(8,-14,27))
jacobi(D,E)
r
add a comment |
Hello I would like to use the jacobi method in my own function to get the best guesses for b1, b2 and b3 in the displayed image.
So far I tried this function I made which gave me answers [2, 4, 1.625].
The right answers are however : [-1, 3, 2]. What am I doing wrong ?
jacobi <- function(x, y)
b <- matrix(0,3)
n <- nrow(b)
som <- 0
for (i in 1:n)
for (j in 1:n)
if (i != j)
som = x[i,j]*b[j]+som
u[i] <- (y[i]-som)/x[i,i]
b<-u
print(b)
D <- matrix(c(4,3,-2,2,-5,3,3,2,8),3,3)
E <- matrix(c(8,-14,27))
jacobi(D,E)
r
Hello I would like to use the jacobi method in my own function to get the best guesses for b1, b2 and b3 in the displayed image.
So far I tried this function I made which gave me answers [2, 4, 1.625].
The right answers are however : [-1, 3, 2]. What am I doing wrong ?
jacobi <- function(x, y)
b <- matrix(0,3)
n <- nrow(b)
som <- 0
for (i in 1:n)
for (j in 1:n)
if (i != j)
som = x[i,j]*b[j]+som
u[i] <- (y[i]-som)/x[i,i]
b<-u
print(b)
D <- matrix(c(4,3,-2,2,-5,3,3,2,8),3,3)
E <- matrix(c(8,-14,27))
jacobi(D,E)
r
r
edited Mar 26 at 5:21
Z.Lin
15.5k3 gold badges23 silver badges46 bronze badges
15.5k3 gold badges23 silver badges46 bronze badges
asked Mar 25 at 16:18
CodeNoobCodeNoob
11 bronze badge
11 bronze badge
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342159%2fjacobi-method-in-linear-systems%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342159%2fjacobi-method-in-linear-systems%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown