Arno

5 Reputation

2 Badges

10 years, 111 days

MaplePrimes Activity


These are replies submitted by Arno

@tomleslie Thank you for the suggestion, this does look a lot neater :)

@Carl Love
 

I tried the NextZero function, but it returns FAIl after 5 repetitions:

s5 := NextZero(y-> tan(y*L)-2*L1*y*epsilon*R/(L1^2*y^2-epsilon^2*R^2), s4, maxdistance = 1000)

Where the previous solution s4 = 252. S5 should be 348.
When I manually increase the value of s4 to 270 (or higher), a solution is found. So I guess I'm still stuck with a similar loop.

@tomleslie Hi tomleslie, thanks for the help!
I was indeed missing some semi-colons. I didn't think you still needed them at the end of a statement (unless you're using the classic worksheet). What I didn't know is that you still need to seperate statements with a semi-colon in the same execution group.

The loop is working fine now. If you're still curious about the rest of the code, see below. And thanks again!

 

restart;

L := 0.3e-1;
L1 := 0.2e-2;
epsilon := .38;
R := 1;

eq1 := tan(y*L) = 2*L1*y*epsilon*R/(L1^2*y^2-R^2*epsilon^2); 

%equation 1 has infinite solutions for y and can only be solved numerically. The fsolve command only returns 1 solution, so what I'm trying to do with the loop is to determine the first nLimit solutions >0 and store them in a vector lambda.%

nLimit := 3;
lambda := Vector(nLimit);

i:=0:
di:=25:
n:=1:  

while (n<=nLimit) do
sol1:=fsolve(eq1, y=i..i+di)
     if type(sol1, numeric) = true then
     lambda[n] :=sol1;
     i:=i+di;
     n:=n+1;
     else  i:=i+di;
     end if:
end do:

Page 1 of 1