Ken Lin

28 Reputation

0 Badges

20 years, 226 days

MaplePrimes Activity


These are replies submitted by Ken Lin

For a better thought you may want to hear about this.

SOLi:=(a,b,c,d,i)->solve(a*x^3 + b*x^2 + c*x + d=0,x)[i];
SOLi(1,3,3,1,1),SOLi(1,3,3,1,2),SOLi(1,3,3,1,3);
SOLi(1,6,11,6,1),SOLi(1,6,11,6,2),SOLi(1,6,11,6,3);

Best regards,

Ken.Lin @ Taiwan

I am glad to hear from you that everything is going right. Also thanks to Robert Israel who helps find bugs in your program. For your reference, you may use the if...elif...else... structure in the future for a substitute of the "case" control structure in other modern programming language. By the way, you may also use the Maplets[] package(library) for a better GUI. I list an example in the next line which refines the "readstat("Would You Like To Find Another Root?[y/n](n to quit)")" in your original program.

> Maplets[Examples][Confirm]("Would You Like To Find Another Root?");

 

Best regards,

Ken.Lin @ Taiwan

I am glad to hear from you that everything is going right. Also thanks to Robert Israel who helps find bugs in your program. For your reference, you may use the if...elif...else... structure in the future for a substitute of the "case" control structure in other modern programming language. By the way, you may also use the Maplets[] package(library) for a better GUI. I list an example in the next line which refines the "readstat("Would You Like To Find Another Root?[y/n](n to quit)")" in your original program.

> Maplets[Examples][Confirm]("Would You Like To Find Another Root?");

Best regards,

Ken.Lin @ Taiwan

For your reference,the codes listed below show that the solutions according to the numbers of the equation.  I hope this will do some help.

> xSol:=(a,b,c,d)->solve(a*x^3 + b*x^2 + c*x + d,x);
   solone:=(a,b,c,d)->xSol(a,b,c,d)[1];
   soltwo:=(a,b,c,d)->xSol(a,b,c,d)[2];
   solthree:=(a,b,c,d)->xSol(a,b,c,d)[3];
   solone(1,3,3,1),soltwo(1,3,3,1),solthree(1,3,3,1);
   solone(1,6,11,6),soltwo(1,6,11,6),solthree(1,6,11,6);
 

Ken.Lin @Taiwan

To do with geometry things, geometry[] and geom3d[] are convinent tools to choose. I prefer that.

The codes listed below show a pyramid you may want. For clarification, I use the long form format,but you may change that to a short form,that is,with(geomed): point(..)...

> a:=1:

geom3d[point](P1,[0,0,0]):
geom3d[point](P2,[a,0,0]):
geom3d[point](P3,[a,a,0]):
geom3d[point](P4,[0,a,0]):
geom3d[point](P5,[a/2,a/2,sqrt(2)/2*a]):

geom3d[segment](S1,[P1,P2]):
geom3d[segment](S2,[P2,P3]):
geom3d[segment](S3,[P3,P4]):
geom3d[segment](S4,[P4,P1]):
geom3d[segment](S5,[P5,P1]):
geom3d[segment](S6,[P5,P2]):
geom3d[segment](S7,[P5,P3]):
geom3d[segment](S8,[P5,P4]):

geom3d[draw]
 (
   [
      S1(color=black ,linestyle=SOLID)
    , S2(color=black ,linestyle=SOLID)
    , S3(color=black ,linestyle=SOLID)
    , S4(color=black ,linestyle=SOLID)
    , S5(color=black ,linestyle=SOLID)
    , S6(color=black ,linestyle=SOLID)
    , S7(color=black ,linestyle=SOLID)
    , S8(color=black ,linestyle=SOLID)
  ]
   ,scaling=constrained
   ,orientation=[30,71]
 );

Ken.Lin @ Taiwan
 

To do with geometry things, geometry[] and geom3d[] are convinent tools to choose. I prefer that.

The codes listed below show a pyramid you may want. For clarification, I use the long form format,but you may change that to a short form,that is,with(geomed): point(..)...

> a:=1:

geom3d[point](P1,[0,0,0]):
geom3d[point](P2,[a,0,0]):
geom3d[point](P3,[a,a,0]):
geom3d[point](P4,[0,a,0]):
geom3d[point](P5,[a/2,a/2,sqrt(2)/2*a]):

geom3d[segment](S1,[P1,P2]):
geom3d[segment](S2,[P2,P3]):
geom3d[segment](S3,[P3,P4]):
geom3d[segment](S4,[P4,P1]):
geom3d[segment](S5,[P5,P1]):
geom3d[segment](S6,[P5,P2]):
geom3d[segment](S7,[P5,P3]):
geom3d[segment](S8,[P5,P4]):

geom3d[draw]
 (
   [
      S1(color=black ,linestyle=SOLID)
    , S2(color=black ,linestyle=SOLID)
    , S3(color=black ,linestyle=SOLID)
    , S4(color=black ,linestyle=SOLID)
    , S5(color=black ,linestyle=SOLID)
    , S6(color=black ,linestyle=SOLID)
    , S7(color=black ,linestyle=SOLID)
    , S8(color=black ,linestyle=SOLID)
  ]
   ,scaling=constrained
   ,orientation=[30,71]
 );

Ken.Lin @ Taiwan
 

For your reference:


Press Ctrl+r to change to Math mode.

  • suffix: Shift+"-"(_,underscore)  Ex: H,Shift+_,2,O
  • superscripts:  Shift+6(^,caret)  Ex: x,Shift+6,3
  • under(below): Ctrl+'
  • overhead(above): Ctrl+Shift+'

Ken.Lin @ Taiwan

 

From the codes that listed below,we can see that the piecewise() command  is a function checked by whattype(). The reserved word "undefined" makes the defination more precise. As you will see also from the plot,the "discont=true " is indispensable and the "axes=none" and the range "-1..2" make it more visible to distinguish whether  the end-point is included(A circle on the plot) or not.

> f:=piecewise(x=0,0,x>0 and x<=1,1-x,undefined);
   whattype(f);
   plot(f,x=-1..2,discont=true ,axes=none);

Ken.Lin @ Taiwan

By the post Lark wrote ,in a similar way except that change the command from combine() to expand().

>> maple('expand(sin(x+y)+sin(x-y))')

Ken.Lin @ Taiwan

By the post Lark wrote ,in a similar way except that change the command from combine() to expand().

>> maple('expand(sin(x+y)+sin(x-y))')

Ken.Lin @ Taiwan

The error message maybe cause by the dito operator %(Last result) which doesn't support by MATLAB.
I don't use MATLAB, so sorry for not helping.

Please try this instead.

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

Ken.Lin @ Taiwan

The error message maybe cause by the dito operator %(Last result) which doesn't support by MATLAB.
I don't use MATLAB, so sorry for not helping.

Please try this instead.

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

Ken.Lin @ Taiwan

Page 1 of 1