How do you find out the integral of an expression of polynomials in scilab ?
I have this code:
clc;
clear;
x=poly(0,"x");
printf("Digite a expressão para calcular:");
mfun=input("");
printf("MENU DE OPÇÕES\n");
printf("1-DERIVADA\n");
printf("2-INTEGRAL\n");
printf("3-MAX E MIN RELATIVOS\n");
printf("4-EXTREMOS\n");
printf("5-DOMINIO\n");
printf("6-IMAGEM\n");
printf("0-SAIR\n");
opcao=input("Digite um numero:");
if(opcao==0) then
printf("\nVocê optou por sair do programa!");
end
while(opcao<>0 )
select opcao
case 1 then
if(i==0) then
z=derivat(mfun);
i=i+1;
end
if(i<>0)then
z=derivat(z);
end
disp(z);
case 2 then
printf("INTEGRAL");
case 3 then
printf("MAX MIN");
case 4 then
printf("EXTREMOS");
case 5 then
printf("DOMINIO");
case 6 then
printf("A imagem de sua função é: %d",opcao);
end
printf("\n MENU DE OPÇÕES\n");
printf("1-DERIVADA\n");
printf("2-INTEGRAL\n");
printf("3-MAX E MIN RELATIVOS\n");
printf("4-EXTREMOS\n");
printf("5-DOMINIO\n");
printf("6-IMAGEM\n");
printf("0-SAIR\n");
opcao=input("Digite um numero:");
if(opcao==0) then
printf("\nVocê optou por sair do programa!");
end
end
So far I've been able to make the polynomial derivative work, I can extract the derivative of the typed expression. I would like to know if there is any way to do the same with integral. Can someone help me?
I have already rolled out the entire documentation practically and found some integral commands like intg, etc. But these do not give integral to polynomials (you have to by the value of the variables). If somebody has some suggestion of function or maybe some command that maybe can help me, I thank you!
Expected input:
f(x)=2x²+4x
Expected Exit:
x³ + 2x²