acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

You should be able to provide the steps to reproduce what you obtain when you run it in the debugger.

As it stands, you haven't even shown us how you invoked the debugger for that run, let alone whatever computations might have preceded that entry.

Do any of the relevant names have assumptions on them? Are they globals or locals? Those are just queries. You can produce code and steps to reproduce, because that's what you're using.

@C_R If I open your latest attachment (Maple 2023.0) and (without re-executing any other part), run at its end the single command,
  alias()
then I get NULL as its output.

I wonder whether you might have an initialization file that's getting run.

@delvin Axel did not include attachments.

Instead, he was making a comment about your attachments.

The file you attached above named 01.mw was last saved using Maple 2023.0.

The file you attached above named 02.mw was last saved using Maple 2022.0.

I believe that Axel was pointing out that they were last saved using different versions of Maple.

If you're going to paste several images of homework questions at near the same time (did you just get an assignment?) then please add them all to the same Question thread.

Please put your follow queries for this here, instead of spawning a wholly separate, duplicate Question thread.

I have submitted a bug report about this.

The behavior doesn't match what code you've shown.

You haven't assigned anything to U, in the code shown.

I suggest that you upload and attach your worksheet, using the green up-arrow in the Mapleprimes editor.

ps. I changed your Post into a Question.

@minhthien2016 For your followup example you can also get the answer using the geom3d package, which can compute the exact result.

Below I do that by manually splitting the region into two tetrahedrons.

You can compare that with floating-point results.

restart;

with(PolyhedralSets): with(geom3d):

 

L:=[[1/2,1/2,0],[-1/2,1/2,0],[-1/2,-1/2,0],
    [-1/4,1/4,sqrt(15)/4],[1/4,-1/4,sqrt(15)/4]]:

 

point('A',L[1][]),point('B',L[2][]),point('C',L[3][]),
point('E',L[4][]),point('F',L[5][]):

gtetrahedron('T1',[A,C,E,F]),gtetrahedron('T2',[A,B,C,E]):

volume(T1) + volume(T2);

(1/12)*15^(1/2)

evalf(%);

.3227486122

ps := PolyhedralSet(convert(evalf[15](L),rational,':-exact'),
                    [x,y,z]):

evalf(PolyhedralSets:-Volume(ps));

.3227486122

evalf(ComputationalGeometry:-ConvexHull(L,'output'=':-volume'));

.3227486122

Plot(ps);

draw([T1,T2],'axes'=':-boxed',labels=[x,y,z]);

Download 3dpolyhed_vol.mw

@DEE_Engineering In your first followup worksheet (attached file "more_testing_in_workbook.mw") you have suppressed the t in x(t).

And so in that worksheet the input that looks like s(x) is actually s(x(t)). That is, the input that looks like s(x) does in fact depend upon t.

But you have done no such suppression for theta or varphi. So s(theta) is just s(theta) and doesn't depend upon t. Similarly c(varphi) is just c(varphi) and doesn't depend upon t. So when you differentiate either of those two things (or their product) with respect to the name t the result is zero.

diff(s(theta)*c(varphi), t);

         0

Of course, when you did it (in the previous line) like,
   diff(s(theta(t))*c(varphi(t)), t)
you got the expected result.

As for your second followup query I cannot tell because the 2nd attachment (named "more_testing_in_doc.mw") doesn't look like what you showed inlined above.

@C_R Yes, another purely text-based approach would be to simply append using printf.

(ie. without using "\n" in the format string.)

for i from 1 to 10 do
  Threads:-Sleep(0.75);
  printf("  %a",i);
end do:

Another very simple approach is to call DocumentTools:-Tabulate inside the loop. That just overwrites the embedded assembly (for that Execution Group or Document Block). It also allows for some look&feel options, as well as handling of a mixed/combined text, typeset math, and plots. I think this is easier than writing all this Post's DocumentTools code -- especially if it's a one-off.

with(DocumentTools):
for i from 1 to 10 do
  Threads:-Sleep(0.75);
  Tabulate([sprintf("done %a of %a",i,10)],
           exterior=none);
end do:

There are also a couple of other "progress bar" approaches in the stock Example worksheet page,
   Programmatic Content Generation

In 2016 I wrote some code for a Slider approach, in a Mapleprimes response here. (That could also be saved to a Library archive for convenient future re-use...)

Now, a comment: it might be useful to some people if the running progress indicator were visible in some separate "console" window, so that one could pan around a large document while still having the running indicator present. I suspect that I could force it into the GUI's right-panel (used these days for context-menus and PlotBuilder), but I don't have time for it.

Your code makes the assignment,

   tolerance := 1e-6

What effect do you hope that might have on the ensuing computations?

Are you trying to increase/force the working precision at which the floating-point evaluation (following a substitution) will be done? Or are you trying to do something else with `tolerance`, and, if so, what?

It's difficult to correct your code if you do not explain in detail what it's supposed to accomplish.

Please add your close followup queries on this here, instead of spawning a wholly separate Question thread for this problem.

@delvin Your equations contain the following, as a function call of sinp ,

sinp(-2*cosh(d)*sinh(d)
     *((a[1]+b[1])*cosh(d)^2+(-a[1]+b[1])*cosh(xi[n])^2-b[1])
     /(cosh(d)^4-cosh(xi[n])^4-cosh(d)^2+cosh(xi[n])^2))

How can that make sense here, as a function call of an unassigned name? How could you possibly expect to be able to solve for variables like a[1],b[1] as they appear within a call to an unknown function?

The same kind of thing happens with cosp.

Did you intend something else, rather than function calls?

Perhaps you intended multiplication by sinp, and forgot a multiplication symbol after the name -- instead of applying that name to arguments?

What are sinp and cosp supposed to mean in your code?

@Carlos36r A very easy way, IMO, is to suppress all usual output from the loop by terminating it in a full colon, and then using the print command to forcibly show what parts you want.

For example,

restart;

for x in [0,1,2] do                           
    if is(x in RealRange(Open(0),infinity)) then                                                 
        print(yes);
    else
        print(no);    
    end if;
end do:

            no
            yes
            yes

I think that gives you nice, legible code which can be easily augmented with additional computations added throughout it.

I also think that a solution for this that has to get finicky with printlevel has already gone astray. A sign that it's suboptimal is that if you want to add/remove additional do-loop/if-then layers then such code for more involved examples might need extra editing in several places.

First 71 72 73 74 75 76 77 Last Page 73 of 591