Ken Lin

28 Reputation

0 Badges

20 years, 226 days

MaplePrimes Activity


These are answers submitted by Ken Lin

To make your program more readable for help in the future, you  should use some indents. Allow me to make some changes in your program which I listed below. 

f:=x->x^3+6*x^2-11*x-10:
A:=1:
M:=0.0001:
E:=M+1:

while (A<>n) do
   A:=readstat("Would You Like To Find Another Root?[y/n](n to quit)"):

   if A=y then
      B:=readstat(`Initial Value One?`):
      C:=readstat(`Initial Value Two?`):
      if sign(f(B)) = sign(f(C)) then
           printf("No Roots In The Interval %a",[B,C]);
      else
           while E>M do
               d:=evalf((B+C)/2):
               #print('d'=d):
               print('f'(d)=f(d)):
               if   f(d)>0 and f(d)<f(C) then
                      C:=d;
                      E:=abs(f(d)):
               elif f(d)>0 and f(d)<f(B) then
                      B:=d:
                      E:=(abs(f(d))):
               elif f(d)<0 and f(d)>f(B) then
                      B:=d;
                      E:=(abs(f(d))):
               elif f(d)<0 and f(d)>f(C) then
                      C:=d:
                      E:=(abs(f(d))):
               elif f(d)=0                     then
                      E:=0:
               end if:
           end do:
      end if:   
      print(sol=evalf(d));
   end if:
end do:

 

Ken.Lin @ Taiwan

 

Refine the last line code to the codes listed below will serve your need.

> plist:=[]:
   for beta from 0 to 10 do
      fsolve({eq1,eq2}, {x,y});
      xx:=eval(x,%):
      yy:=eval(y,%%):
      plist:=[op(plist),[xx,yy,beta]]:
   end do:

  plist;
  plots[pointplot3d](plist,axes=boxed,symbol=solidcircle);


 

Ken.Lin @ Taiwan

For your reference,

Given with x+y=2 and s=z+y to get "s= z-x+2":

> isolate(x+y=2,y);
   algsubs(%,s=z+y);

Ken.Lin @ Taiwan

There are  many ways to draw a circle with given diameter, For example:

(1)By plottools[]...

    Oo:=[0,0]:
    P:=[1,1]:
    r:=Student[Precalculus][Distance](Oo,P);
    p1:=plottools[circle](Oo,r,color=red):
    plots[display](p1,scaling=constrained);

(2)By geometry[]...

    geometry[point](Oo,[0,0]):
    geometry[point](P,[1,1]):
    r:=geometry[distance](Oo,P);
    geometry[circle](c,[Oo,r]):
    geometry[draw](c,axes=normal);
 

I hope this will give some help.

Ken.Lin @ Taiwan

Use the combine() command ,not simplify().

For your reference:

sin(alpha)*cos(beta)+cos(alpha)*sin(beta):
%=combine(%);
sin(alpha)*cos(beta)-cos(alpha)*sin(beta):
%=combine(%);
cos(alpha)*cos(beta)+sin(alpha)*sin(beta):
%=combine(%);
cos(alpha)*cos(beta)-sin(alpha)*sin(beta):
%=combine(%);

Fun with Maple!

Ken.Lin @ Taiwan

 

Page 1 of 1