acer

32747 Reputation

29 Badges

20 years, 110 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The instances of names x and y within the expressions assigned to s or E[1] or E[2] are not the same as the formal parameters x and y of your procedure si.  So when si is called with numeric values for its parameters x and y those are not used as replacement for the global x and y inside s or E[1] or E[2].

Here are some ways that work.

names.mw

You need n:=1 instead of n=1 to assign the value to n.

From the help page for topic CodeEditRegion, third bullet item in section Steps to Inserting and Collapsing the Code Edit Region , [italics mine],

   When a code edit region is collapsed, an icon displays within the worksheet or
   document marking the code edit region, and all but the first line of the procedure
   will be suppressed. The first line of the procedure displays to the right of the icon.
   A comment may be included before the procedure to display a descriptive
   heading instead of the first line of the procedure. To suppress the printing of the
   first line of the procedure, insert a blank line on the first line of the code edit region
.


 

The value of tanh(20.0) is approximately .99999999999999999150 to twenty decimal places.

If that is squared then the result is approximately .99999999999999998300 .

By default Maple uses a working precision based upon Digits=10. If you subtract the previous result from 1.0 then, at any working precision of less than seventeen decimal digits, the result will just be 0.0 because .99999999999999998300 would be rounded up to 1.0 before the subtraction.

See here for an explanation of this known difficulty with floating-point computation at a fixed working precision. The issue is not specific to Maple, but is quite common in scientific and other floating-point computing.

If you want the trailing digits of information in .99999999999999998300 to be retained during the ensuing stages of the computation then you'll need more than seventeen decimal digits of working precision. That is,

restart; Digits:=16: evalf( 1 - .99999999999999998300 );

                          0.

restart; Digits:=17: evalf( 1 - .99999999999999998300 );

                           -17
                       2 10   

restart; Digits:=18: evalf( 1 - .99999999999999998300 );

                            -17
                      1.7 10

So lets look at the whole computation. Here below the intermediary floating-point result for tanh(-20.0)^2 may not even be as fine as the value used above, for working precision below twenty decimal digits. So there may be roundoff error even before the above kind of loss of precision. (And so this compound floating-point computation can suffer even more, from a successive build up of floating-point error.)

restart; Digits:=16: evalf(1-tanh(-20)^2);

                          0.

restart; Digits:=17: evalf(1-tanh(-20)^2);

                           -17
                       2 10   

restart; Digits:=18: evalf(1-tanh(-20)^2);

                            -17
                      1.6 10   

restart; Digits:=19: evalf(1-tanh(-20)^2);

                             -17
                      1.70 10   

restart; Digits:=20: evalf(1-tanh(-20)^2);

                             -17
                     1.700 10   

restart; Digits:=21: evalf(1-tanh(-20)^2);

                              -17
                     1.6994 10

In stark contrast to the above, the direct computation of evalf(sech(-20)^2) does not happen to involve this particular difficulty.

restart; Digits:=10: evalf(sech(-20)^2);

                                -17
                  1.699341702 10

Note that setting Digits:=d (for positive integer d) does not promise d decimal digits of accuracy in compound floating-point computations. See also subsection "Precision and Accuracy" in section 7.3 "More about Floating-Point Numbers in Maple" of the Programming Guide. That is also available directly from within Maple's Help system.

Those %1, %2 are labels representing common subexpressions.  At the bottom you can see the values that the labels represent.

This form of the output allows the results to be displayed more briefly. It can also allow for easier visual insight into the overall form of complicated results.

You can read about it by looking for the word labelling on the ?interface help page.

You can turn it off as follows:

interface(labelling=false);

In Maple V you could also set the _EnvExplicit environment variable before calling solve on this example.

restart;                             

_EnvExplicit:=true:

solve({x^2+y^2=3,x^2+2*y^2=3},{x,y});

                                1/2                 1/2
                   {y = 0, x = 3   }, {y = 0, x = -3   }

That's one alternative to using the allvalues command on the result (for this example) where the RootOf appeared, which has already been given in another Answer.

Since you're apparently already using a 3-component custom color for the shading of the surface, how about making that produce "black" for a controlled subset of the (x,y) points?

That is, with your HSV coloring expressions, you could set the V component to 1 or 0 in a piecewise fashion. The resulting black lines would be part of the actual surface, and not be hidden. And you could have as many or as few as you wish, regardless of the fineness of the grid option.

Here's a simple example,

restart;

V:=proc(x,y)
  if not ( x::numeric and y::numeric ) then
     return 'procname'(args);
  end if;
  if ( abs(frem(x,0.5))<0.01 )
   or ( abs(frem(y,0.5))<0.01 ) then
     0
  else
     1;
  end if;
end proc:

plot3d(x^2/3*sin(y), x=-2..2, y=-2..2, grid=[201,201],
       style=surface, lightmodel=none, glossiness=0,
       scaling=constrained,
       color=[x*y,1,V(x,y),colortype=HSV]);

3dcolorgrid.mw

You may choose to further restrict the thickness (width) of the lined black portions -- using derivative values -- if the surface becomes very steep.

The name e has no special meaning for Maple as 1D plaintext input. It's just another unassigned name.

As plaintext code you'd need to enter that with exp(x) instead of e^x, if you want to raise x to the base of the natural logarithm.

There document you attached seems to have a corrupted and unclosed Input at its end.

If I delete that problematic fragment and close off the outstanding Sections then I get to the following (which I'll try and attach both zipped and as is). It end with the subsection "Lektion 18 Tyngdepunkt af volumer".

I saved it last with Maple 2017.2 (since yours was last saved with Maple 2017.1).

1._sem_Maple_-_Kopie_ac.zip

1._sem_Maple_-_Kopie_ac.mw

 

restart;
de := diff(y(t),t,t)=-1:
ic := y(0)=1, D(y)(0)=0:

Events := [y(t)=0,
           diff(y(t),t)=piecewise(abs(diff(y(t),t))<1e-2,
                                  abs(diff(y(t),t)),
                                  abs(0.5*diff(y(t),t)))]:

dsol := dsolve({de, ic}, numeric,
               events=[Events], range=0..5):

plots[odeplot](dsol, thickness=3, color=red);

The simplification that you are expecting is not generally valid. It is not generally valid when Z<0 . That's why Maple is not combining those powers without special direction.

The symbolic option to the simplify command instructs it to ignore such branch cut distinctions. I prefer to provide the special directions in the form of assumptions, so that it's more clear to me just what circumstances are supposed to be allowed. (Of course I still have to be careful about respecting those assumptions.)

For example,

ee := Z^3 / ((Z^2)^(2/3));

Z^3/(Z^2)^(2/3)

ff := simplify(ee, symbolic);

Z^(5/3)

evalf( eval( ee, Z=-1 ) );

-1.

evalf( eval( ff, Z=-1 ) );

.5000000001-.8660254037*I

simplify(ee) assuming Z>=0;

Z^(5/3)

 

Download radsimp.mw

For your posted example you could do one of,

simplify(combine(req)) assuming positive;

simplify(combine(req),symbolic);

restart;

zform := op(solve({z>0, x^2+z^2=y^2}, z)) assuming x>0, y>0, z>0;

z = (-x^2+y^2)^(1/2)

P := x+y = 60;

x+y = 60

yform := isolate(P,y);

y = 60-x

eval(zform, yform);

z = (-x^2+(60-x)^2)^(1/2)

Area := 1/2*x*z;

(1/2)*x*z

Texpr := eval(Area, eval(zform, yform));

(1/2)*x*(-x^2+(60-x)^2)^(1/2)

T := unapply( Texpr, x);

proc (x) options operator, arrow; (1/2)*x*(-x^2+(60-x)^2)^(1/2) end proc

# approach using operator form, T
xsol := solve(diff(T(x), x)=0);

20

T(20);

10*1200^(1/2)

T(xsol);

10*1200^(1/2)

# approach using expression form, Texpr
xsol := solve(diff(Texpr, x)=0);

20

eval(Texpr, x=20);

10*1200^(1/2)

eval(Texpr, x=xsol);

10*1200^(1/2)

 

Download areaprob.mw

The phi obtained from GetProperty(EQUATION1, expression) is the unassigned global name phi, not numtheory[phi].

I don't know whether you want to rethink your definition of FTest.

MAPLE_PLEASE_HELP_aGAIN_ac.mw

How about considering it as an integral over y=-1..1, ie,

int( 2-y^2 - y, y=-1 .. 1);

                       10/3

The above is a bit easier than splitting the domain at x=1 and adding the two portions, while integrating over x=-1..2.

int(x-(-1), x=-1..1) + int(sqrt(2-x)-(-sqrt(2-x)), x=1..2);

                       10/3

I'm supposing that you have realized that the first step is to solve for the upper point where the curves intersect, since that gives you information about the bounds of integration.

solve(y = 2-y^2, {y});

                {y = 1}, {y = -2}

@mpre 

restart;

kernelopts(version);
   Maple 2016.2, X86 64 LINUX, Jan 13 2017, Build ID 1194701

ff:=(sqrt(1/beta)+1)*beta/(beta+sqrt(beta)):

normal(combine(expand(ff))) assuming beta>0;
                               1

evala(combine(ff)) assuming beta>0;
                               1

simplify(expand(ff), symbolic);
                               1

The expression assigned to ff is not equal to 1 for real beta<0.

First 183 184 185 186 187 188 189 Last Page 185 of 340