Basically I am trying to solve the following Definite Integral in Maple from Theta=0 to Theta0=45. I am trying to find an actual numerical value but need to find the integral first. I don't know how to ask Maple to help me solve an integral where there are two different values (theta and theta0) within. All I am trying to do is find the period of oscillation of a pendulum but I have been instructed to only use this method and equation.
From the equation d^2θ/dt^2= -g/L sin(θ) we find:
P = 4 sqrt(L/2g) ∫ (0 to θ0) dθ/sqrt[cos(θ)-cos(θ0)]
L= 1
g= 9.8
To simplify the value before the integral I did the following:
>L:=1;
>g:=9.8;
>evalf(4*sqrt(L/(2*g));
>M:=%;
So the integral to solve simplifies to:
P = M ∫ (0 to θ0) dθ/sqrt[cos(θ)-cos(θ0)]
When I try to evaluate the integral by itself I get the error: "Error, index must evaluate to a name when indexing a module". I am trying to figure out how Maple wants me to enter in the integral so it will solve it.
I have tried the following as well as similar combinations of variables:
int(1/sqrt[cos(t)-cos(45)],t=0..45);
I can't conceive how to make maple solve the definite integral for me given it is cos(theta)-cos(theta0) in the denominator instead of just one variable. When I try different values for the integral I also get the following error:
Error, index must evaluate to a name when indexing a module
I must be overlooking something considerable to continue getting this error. Thanks in advance for any help or direction! :)
As acer noted in his comment, maple syntax doesn't use square brackets for functions. The proper syntax for your task is:
int(1/sqrt(cos(t)-cos(Pi/4)),t=0..Pi/4);
Notice that maple works in radians, so I replaced your 45
with Pi/4
.
If you need a numerical value you can use evalf
:
evalf(int(1/sqrt(cos(t)-cos(Pi/4)),t=0..Pi/4));
maple's answer is 2.310196615
.
If you need to evaluate with a generic variable theta0
, you can define a function as:
myint:=theta0->int(1/sqrt(cos(t)-cos(theta0)),t=0..theta0);
Then just call it as, e.g.,
myint(Pi/4);
and for a numerical evaluation:
evalf(myint(Pi/4));