{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

transcend3

# transcend3 - %Move all terms to one side> x^4 x 2 = 0...

This preview shows page 1. Sign up to view the full content.

%numerical solutions to equations clear; fprintf('\nThis program solves the equation '); fprintf('x^4 = x + 2\n' ); % We need to know approximately where our solution lies. % From plotting the left-hand side (LHS) and the right- % hand side(RHS) vs. x, I can see that I will have 2 % solutions, 1 between -2 and 0, and 1 between % 0 and 2 xmin = -2; xmax = 0; intv = .001; x1 = xmin : intv : xmax;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %Move all terms to one side --> x^4 - x - 2 = 0 func1 = x1.^4 - x1 - 2; %x value that makes function closest to zero is solution [sol1 index1] = min(abs(func1)); %find other solution, between x = 0 and x = 2 x2 = 0:.001:2; func2 = x2.^4 - x2 - 2; [sol2 index2] = min(abs(func2)); fprintf('\nx= %.2f or x = %.2f\n\n', x1(index1), x2(index2));...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online