Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

função e equação do primeiro grau #11

Open
OrionRandD opened this issue Jul 12, 2023 · 0 comments
Open

função e equação do primeiro grau #11

OrionRandD opened this issue Jul 12, 2023 · 0 comments

Comments

@OrionRandD
Copy link

  1. Esboce os gráficos das seguintes funções constantes:
    (a) f (x) = 1
    (b) f (x) = 3
    (c) f (x) = −2
    (d) f (x) = −5
    (e) f (x) = 4

;;;;;;;;;;;;;;;;;;;;;;;;;
com octave:

f(x) = 1
x = linspace(0, 10, 100);
y = ones(size(x));
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f(x) = 3
x = linspace(0, 10, 100);
y = 3 * ones(size(x));
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f(x) = -2
x = linspace(0, 10, 100);
y = (-2) * ones(size(x));
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f(x) = -5
x = linspace(0, 10, 100);
y = (-5) * ones(size(x));
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f(x) = 4
x = linspace(0, 10, 100);
y = (4) * ones(size(x));
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;

  1. Esboce no mesmo plano cartesiano os gráficos das seguintes funções lineares:

(a) f (x) = x and f (x) = 1
(b) f (x) = 2x and f (x) = 3
(c) f (x) = 3x and f (x) = -2
(d) f (x) = −x and f (x) = -5
(e) f (x) = −2x and f (x) = -4

;;;;;;;;;;;;;;;;;;;;;;;;;

com octave:

f(x) = x
x = linspace(0, 10, 100);
y = x;
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f(x) = 1 and f(x) = x
x = linspace(0, 10, 100);
y1 = ones(size(x));
y2 = x;
plot(x, y1, x, y2);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = 2x
x = linspace(0, 10, 100);
y = 2 * x;
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = 2x and f (x) = 3
x = linspace(0, 10, 100);
y1 = 2 * x;
y2 = 3;
plot(x, y1, x, y2);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = 3x
x = linspace(0, 10, 100);
y = 3 * x;
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = 3x and f (x) = -2
x = linspace(0, 10, 100);
y1 = 3 * x;
y2 = -2;
plot(x, y1, x, y2);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = −x
x = linspace(0, 10, 100);
y = -x;
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = −x and f (x) = -5
x = linspace(0, 10, 100);
y1 = -x;
y2 = -5;
plot(x, y1, x, y2);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = −2x
x = linspace(0, 10, 100);
y = (-2) * x;
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = −2x and f (x) = -4
x = linspace(0, 10, 100);
y1 = (-2) * x;
y2 = -4;
plot(x, y1, x, y2);

;;;;;;;;;;;;;;;;;;;;;;;;;
f (x) = x + 1
x = linspace(0, 10, 100);
y = x + 1;
plot(x, y);

;;;;;;;;;;;;;;;;;;;;;;;;;
(a) f (x) = x + 1

x = [1, 2, 3, 4, 5];
y = x + 1;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;
(b) f (x) = 2x + 1

x = [1, 2, 3, 4, 5];
y = (2 * x) + 1;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;

(c) f (x) = −x + 1

x = [1, 2, 3, 4, 5];
y = -x + 1;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;

(d) f (x) = −x − 1

x = [1, 2, 3, 4, 5];
y = -x - 1;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;

(e) f (x) = 5x − 5

x = [1, 2, 3, 4, 5];
y = (5 * x) - 5;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;

(f) f (x) = −2x + 4

x = [1, 2, 3, 4, 5];
y = (-2 * x) + 4;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;
(g) f (x) = 2x − 4

x = [1, 2, 3, 4, 5];
y = (2 * x) - 4;

coefficients = polyfit(x, y, 1);
linear_coefficient = coefficients(1);
angular_coefficient = coefficients(2);
coefficients
linear_coefficient
angular_coefficient

;;;;;;;;;;;;;;;;;;;;;;;;;

f = @(x) x + 1;
root = fzero(f, 0);
root

f = @(x) (2 * x) + 1;
root = fzero(f, 0);
root

f = @(x) -x + 1;
root = fzero(f, 0);
root

f = @(x) -x - 1;
root = fzero(f, 0);
root

f = @(x) (5 * x) - 5;
root = fzero(f, 0);
root

f = @(x) (-2 * x) + 4;
root = fzero(f, 0);
root

f = @(x) (2 * x) - 4;
root = fzero(f, 0);
root

Gráficos

f = @(x) x + 1;
ezplot(f, [-10, 10]);

f = @(x) (2 * x) + 1;
ezplot(f, [-10, 10]);

f = @(x) -x + 1;
ezplot(f, [-10, 10]);

f = @(x) -x - 1;
ezplot(f, [-10, 10]);

f = @(x) (5 * x) - 5;
ezplot(f, [-10, 10]);

f = @(x) (-2 * x) + 4;
ezplot(f, [-10, 10]);

f = @(x) (2 * x) - 4;
ezplot(f, [-10, 10]);

;;;;;;;;;;;;;;;;;;;;;;;;;

Valor das funções

(a) f (x) = x + 1
x = 3;
result = x + 1

(b) f (x) = 2x + 1
x = 3;
result = (2 * x) + 1

(c) f (x) = −x + 1
x = 3;
result = −x + 1

(d) f (x) = −x − 1

x = 3;
result = −x −1

(e) f (x) = 5x − 5

x = 3;
result = (5 * x) - 5

(f) f (x) = −2x + 4

x = 3;
result = (-2 * x) + 4

(g) f (x) = 2x − 4
x = 3;
result = (2 * x) - 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant