## asukumari

Mr. Abhilash Sukumari

5 years, 38 days

## Logical comparator question...

Maple

What am I doing wrong here, or don't understand about Maple. I followed the 'IF' structure from Maple help. I am getting the wrong result.

a := 1:
b := 3:
if a > b then
print(wrong)
else
print(correct)
end if
correct

## Error line indication?...

Maple

Is there a way for Maple to tell where the error occurs? For example I am not able to find the error that says 'Error, missing operator or `;'' in the following code.

# ctrl + del to delete a Maple cell
# golden search implementation
# chapra 7th ed
golden_search := proc(f, xl, xu, es100, maxiter)
description "find the optimal point using golden-search optimization method";
locals R, d, xopt, x1, x2, f1, f2, iter, ea, xint;
R := (sqrt(5)-1)/2;
d := R*(xu-xl);
x1 := xl + d;
x2 := xu - d;
f1 := evalf(eval(f, x = x1));
f2 := evalf(eval(f, x = x2));
# declare iterator and ea
iter := 1;
ea := 1.00;
# start while
while ea*100 > es100 and iter < maxiter do
d := R*d; # new golden ratio
xint := xu - xl;
if f1 > f2 then
xopt := x1;
fx := f1;
x1 := x2;
x2 := x1;
x1 := x1 + d;
f2 := f1;
f1 := evalf(eval(f, x = x1));
else
xopt := x2;
fx := f2;
xu := x1;
x1 := x2;
x2 := xu - d;
f1 := f2;
f2 := evalf(eval(f, x = x2));
end if
# calculate new ea
if xopt <> 0 then
ea := (1 - R)* abs(xint/xopt);
end if
iter = iter + 1;
end do;
# return xopt and fx here
xopt;
end proc:

## How to get help from documentation?...

Maple 2017

How does one look through the Maple 2017 help for a code structure. I have been looking for how to construct a While loop and I am not able to find any example that implements while loop nor the code structure for it.

Any help is appreciated.

## Evaluate expression at value...

Maple

How do you evaluate a function expression at given variable values?

`f := 2*sin(x)-x^2/10.00:`

`eval(f, x = 5)` gives `2*sin(5)-2.500000000`

`evalf(eval(f, x = 5))` gives `-4.417848549`

So is there a way we can just numerically calculate f(x) where x = 5?

## Fourier Transform of arctan(x)/x...

Maple

This question caught my eye on Mathematics Stack Exchange forum and doesnt seem to be resolved even with Mapel 2017.3: