mmcdara

7891 Reputation

22 Badges

9 years, 63 days

MaplePrimes Activity


These are replies submitted by mmcdara

@mapleatha 

If this is mainly a cisualization problem, for instance to distinguish more easily the different polynomials (or other "complex" objects), I use to use this tip.
Assuming the polynoms are  list or set L you can do this

print~(L):

and if  L is a sequence 

print~([L]):

This will print one polynom per line.

Here is another option where the list L is printed in "matrix" form (polynomials are written by rows)

alias(DCT=DocumentTools:-Tabulate):
r := rand(3..8);
L := [seq(randpoly(x, degree=3), i=1..r())];

N  := numelems(L):
NC := 3: # a value to choose
NR := `if`(irem(N, NC)=0, iquo(N, NC), iquo(N, NC)+1):

M := Matrix(NR, NC, (i,j)->`if`(3*(i-1)+j <= N, L[3*(i-1)+j], "")):
DCT(M)


But maybe Carl'reply is already enough

Preben is right,
but if you are nevertheless want to write your own algorithm, there are a lot of questions (and answers too) about the shooting method on this same site.
Use search to find some, for instance
How do I solve shooting method in Maple - MaplePrimes
Shooting method in maple - MaplePrimes
How to solve BVP by shooting method? - MaplePrimes
...

@9009134 

What does "The fitting procedure is constrained such that at the common temperature both the specific heat and its first derivative are equal"?
If a function of T and its derivative are equal for both values of T this means this function is an exponential ???
Could you give more details about this procedure, or at least provide open sources for references 14 and 15.

Without some effort from your own I won't be capable to help you.

 

@9009134 

I don't understand your question about a6 and a7.
Are you saying that the CP = f(T) is used to estimate a1 to a5 ; that H/T = g(T) is used to estimate a6 with the values of a1 to a5 previously found ; finally that S/T = h(T) is used to find a7 given a1 to a6?

If it's not the case it seems to me that you haven't read my first reply.

But if it is really what you want (estimating a1..a5, next a6 next a7, even IOf I think is nonsense [I will tell you why below]) here is the solution
SOL_1.mw

Results are bad aren't they? 
I will explain this latter.



Why is it nonsense?

  1. Here is an alternate method : find a1...a6 from model H/T = g(T) ; plug them into model S/T = h(T)  and find a7  (the model CP = f(T) is already determined because you know a1..a5).
  2. And another one : find a1...a7 from model S/T = h(T) ; plug them into model S/T = g(T) and find a7 (the model CP = f(T) is already determined because you know a1..a5).
  3. Using you method means that only data (T, CP) are accurate enough to find a1..a5 ; the first one above means these data are (T, H) and the second one above they are (T, S). Don't you think it's stupid?


The correct way to proceed in this kind of stuation is to estimate a1..a7 from all the data at the simultanously.
This canbe done easily by minimizing a global sum of squares made of the sum of the three individual sums of squares for each model (RSS = RSS1+RSS2+RSS3). You could also add weights W1, W2, W3 and minimize RSS = W1*RSS1+W2*RSS2+W3*RSS3 instead ; this could be useful if the measurement of H is more accute than the one of CP for instance?

Here is the solution with W1=W2=W3 : SOL_2.mw

Same bad results if not even worse.

Now look closely at the three models you give: are you sure that they are correct?
That you have not flushed the parameters in some of them?
For instance that you would have written S/T = a6*ln(T)+... instead of S/T = a1*ln(T)+..
(or H/T/R = a1/T+... instead of H/T/R = a6/T)?
I don't think your three models respect thermodynamical relations.

If I'm wrong let's drop these remarks ; if I'm right correct the models and modigy SOL_2.mw accordingly.



 

@tomleslie 

Hi,
I'm now at home with my "old" Maple 2015 so I won't be able to do any modification until next friday.
As I explain in the worksheet I had to modify it slightly when I noted maplerimes doen(t enable loading m files.

 

Here is the worksheet with my "real" dataset

When I ran it first time, I received the error messages I mentioned in the first question.
So I inserted at the end of the worksheet, the content of the Classify help page  to verify if this example was working correctly or not
This was the case when I executed it once, but not twice. 

I infered that the problem could already be highlighted with the example from the Classify help page (but maybe it was just a consequence of the fact that this problem was already appeared once in the worksheet?).

In the worksheet above I removed the Classify help page example to focus on may real problem.
The goal is to built a NN classifier (criteria has two outcomes named "acc" or "rej"); there are 5 explanatory variables.
The 5th one is categorical (values= 10, 20, 30).
There are three options :

  1. VERSION 1 : Build a classifier over the 5 variables
  2. VERSION=2 is not included in the worksheet : expansion of the categorical variable in three indicator random variables
  3. VERSION 3 : Build 3 classifiers over the 4 first variables one for each value of the 5th variable (named xi).

When I run the whole worksheet by clicking on the !!! icon the computation named "VERSION 3" often (but not always) returns an error (you can also execute this second computation BEFORE the first one (VERSION 1) to observe this is now this latter wich returns an error). 
In case you get no error, just execute it again to verify if the error appears or not (do not click on !!! ).


Thanks in advance for your involvement.

PS: you will show the execution generates a WARNING. Unfortunately it doesn't seem possible to account for the advice this warning gives.


Classification.mw
RBDO.xls

@vv 

Thank you for your reply.
It seemed to me to be indeed an (unfortunate?) concession to a style of writing that one encounters more in physics or in applied mathematics. 

@acer 
Hi, 
what was the reason that pushed the development team to introduce the syntax 

f(x) := x^2

to define a function?
I thought that this old notation (introduced by Euler?) was now abandoned in modern textbooks and replaced by the arrow notation

f := x -> x^2

whose MAPLE's writing is closer.

 

My previous answer continued...

The differences in the structures of DrawGraph(g) an DrawGraph(g, style=spring) make my code to generate errors.
If you're interesting I can spend a little time  to make it run correctly with style=spring.
Just let me know


Here is a correction that works correctly for all 2D styles (the option dimension=3 is not accounted for: disks should be spheres, edges or vertices have 3 co-ordinates instead of 2, and so on ... too much work to do to generalize what I've done to 3D).
The illustration corresponds to the picture you gave.
It would be interesting to use some plottools:-transform to expand the product graph to have a better separation of the different "layers" (as in your figure).



Cartesian_Product_of_Graphs_corrected.mw

Hi, 

It seems to me you are working on a global Maplet that is intended to do a lot of different things:

  • read an Excel file (your previous post),
  • select interactively some operations to perform (idem):
  • plots some results

Am I right?

If this is the case, I strongly advise you to start by forgetting about Maple: just take a sheet of paper and try to imagine what you would like your Maplet-based App  to look like.

Once you have designed a model, precise the informatic structure of your Maplet-based App.
Next use the Maplet Builder to organise the  elements of the modre complex Maplets. Probably you will face errors at this point, because maplets are powerful but very tetchy to use (more of this they are not "debugable"). Do not discourage yourself (I can guarantee you a lot of things can be done with Maplets).

The key element to embed Maplets, that is to open a Mapletr withi (or from) another Maplet is to use the "Action" element. 
My advice is to write a main procedure P0 wich contains:

  • sub-procedures P1, P2, ...PN
  • A main Maplets M0,
  • and sub-maplets M1, ...MK.

M0 wil be the main Maplet that P0 launches ; M0 will contain buttons whose click on them will run some sub-procedures which, in their turn, will launch sub-mallets and so on.

@tomleslie 

Hi,
Do you know what your paraboloid looks like in Maple 2015?
In any case, it's very nice, even if it's not what was expected.

 

 restart;

interface(version);

  xlim:=10:

  ylim:=10:

  expr:=4*x^2+9*y^2:

  plot3d( expr,

          x=-xlim..xlim,

          y=-ylim..ylim,

          view=[ -xlim..xlim,

                 -ylim..ylim,

                  0..min( [ eval(expr,[x=0, y=ylim]),

                            eval(expr,[y=0, x=xlim])

                          ]

                        )

               ],

         style=surface,

         colorscheme=["zcoloring", z->z]

       );

 

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

 

 

 


 

Download Psychedelic_Paraboloid.mw

@ActiveUser 

There is no mention of any plot in your initial question. Is this a new question?

If you want to plot something within a Maplet, maybe you should consult the Plotter help page  to find out how to proceed.

Maybe another way to ask this question could have been :

Regarding the comparisons between Maple and Mathematica that Wolfram regularly publishes (a recent one is compare-mathematica-and-maple.html),  do you think :

  1. Do you think these comparisons are objective or simple advertising?
  2. In the first case, do the differences  exhibited in favor of Mathematica matter to you?
    Could they force you to question your choice of Maple?
  3. If yes, do you think MapleSoft should improve Maple in order to make these differences disappear ?

And finally : Why do you use Maple instead of another CAS ?

 

PS : Recently there was a rather violent diatribe (whether justified or not is not my point) against the Graphic User Interface of Maple, which excited this forum. Perhaps your question would be an opportunity for MapleSoft to think about what could be improved (if needed) on this interface.

@ActiveUser 

I know I'm sometimes a little be slow to understand, but I get the feeling that you're still not clear.
Here's my latest contribution, hoping it will be of interest to you.

PS: I still think you do not do a correct usage of Maplets and that launching Maplets within the loop is not a clever strategy (in my opinion)
 

restart:

interface(prettyprint=2):

with(ListTools):

with(StringTools):

with(ExcelTools):

with(SumTools):

with(Maplets[Elements]):

count := 1:

 

# While you do not deliver the xls file I can' solve your problem
#
# RR := Import("C:\\Users\\ohungyeeel\\Documents\\EquationsLists.xls", "Candidate", "A1:Q65535"):
#
# Then I decided to simulate what this file could contain given the few informations you gave. 

texts_13 :=  ["Complex" , "Beautiful system but no result", "Anything else"]:

roll  := rand(1..3):

N  := 10:
RR := Matrix(N, 16, 0):
RR[.., 2 ] := Vector(N, i -> x*i-1=0):
RR[.., 13] := Vector(N, i -> texts_13[roll()]):

RR[1..N, [2, 13]]

Matrix([[x-1 = 0, "Complex"], [2*x-1 = 0, "Anything else"], [3*x-1 = 0, "Anything else"], [4*x-1 = 0, "Beautiful system but no result"], [5*x-1 = 0, "Complex"], [6*x-1 = 0, "Beautiful system but no result"], [7*x-1 = 0, "Beautiful system but no result"], [8*x-1 = 0, "Anything else"], [9*x-1 = 0, "Beautiful system but no result"], [10*x-1 = 0, "Complex"]])

(1)

f := proc(text)

  local maplet, choice:

  maplet := Maplet(

    [

      Label(text),

      [

        RadioButton['RB1']("yes", 'value'=true, 'group'='BG1'),

        RadioButton['RB2']("no", 'value'=false, 'group'='BG1')

      ],

      [

        Button("OK", Shutdown(['RB1', 'RB2']))

      ]

    ],

    ButtonGroup['BG1']()

  ):

  choice := Maplets[Display](maplet):

  `if`(parse(choice[1]), "Yes", "No");

end proc:
 

RR[2,13]

"Anything else"

(2)

for count from 1 to N do

  try:

    if RR[count,13] = "Complex" or RR[count,13] = "Beautiful system but no result" then

      dummy := 0:

    else

      print(RR[count,1],RR[count,2]):

      sol := solve(RR[count,2]):

      print("Source:",RR[count,3]):

      print("Solution:",sol):

 

      choosesystem := f("Choose system?");
      printf("count = %2d  Choose System      = %a\n", count, choosesystem);

  

      if choosesystem = "Yes" then

        RR[count,15] := "SystemChosenAndSolutionCorrect":

      else

        RR[count,15] := "NotChosenAndSolutionWrong":

      end if:

 

      plot(sol):


      choosesystem := f("Like and it works?");
      printf("            Like and it works? = %a\n", count, choosesystem);

 

      if choosesystem = "Yes" then

        RR[count,16] := "Best":

      else

        RR[count,16] := "NotSelected":

      end if:

 

  end if:

 

  catch:

    print("error at ",RR[count,1],RR[count,2]):

  end try:

od;



### Export(RR, "C:\\Users\\ohungyeeel\\Documents\\EquationsLists10092020.xls", "Candidate", "A1")

 

0, 2*x-1 = 0

 

"Source:", 0

 

"Solution:", 1/2

 

count =  2  Choose System      = "Yes"

            Like and it works? = 2

 

0, 3*x-1 = 0

 

"Source:", 0

 

"Solution:", 1/3

 

count =  3  Choose System      = "No"

            Like and it works? = 3

 

0, 8*x-1 = 0

 

"Source:", 0

 

"Solution:", 1/8

 

count =  8  Choose System      = "No"

            Like and it works? = 8

 

interface(rtablesize=16):
RR

Matrix([[0, x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Complex", 0, 0, 0], [0, 2*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Anything else", 0, "SystemChosenAndSolutionCorrect", "Best"], [0, 3*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Anything else", 0, "NotChosenAndSolutionWrong", "Best"], [0, 4*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Beautiful system but no result", 0, 0, 0], [0, 5*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Complex", 0, 0, 0], [0, 6*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Beautiful system but no result", 0, 0, 0], [0, 7*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Beautiful system but no result", 0, 0, 0], [0, 8*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Anything else", 0, "NotChosenAndSolutionWrong", "NotSelected"], [0, 9*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Beautiful system but no result", 0, 0, 0], [0, 10*x-1 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Complex", 0, 0, 0]])

(3)

 


 

Download Satisfied.mw

@ActiveUser 

You write

I tried, I can cat the solution in question,

However, it do not allow to control scroll bar of maple after pop up the dialog,

I can not scroll to check the plot and next plot

how to do?


I don't understand, what does it means, could you be clearer ?
Please, begin by telling me what you mean by "I tried, I can cat the solution in question"

PS : I did not worked on your original code for the very simple reason that I cannot Import your Excel file!
        I just gave you some corrections concerning the "Maplets" part and an advice about the way I woulld
        use them.




About Threads :

Maplets are not threadsafe   (look index/threadsafe in the help pages) and this seems normal to me.
The usual use of Maplets is to create GUI (Graphic User Interfaces), tjhat is to gather informations you will next use in some computation process. This process can be distributed among different cores of the same machine or over a cluster of machines, but i cannot imagine why an application would ask for informations to the operator as it is running on multiple procs.

If, at some time and on some proc, the application needs to ask for information to do some aciton or another one, I (personnally) consider that the whole application has not been correctly designed: this kind of situation should have been accounted for before the computations begin.

 

@ActiveUser 

Yes, RadioButton(s) are not restricted to three choices, for instance
 

restart
with(Maplets[Elements]):
maplet := Maplet(
  [
    [
      RadioButton['RB1']("1", 'value'=true, 'group'='BG1'), 
      RadioButton['RB2']("2", 'value'=false, 'group'='BG1'),   
      RadioButton['RB3']("3", 'value'=false, 'group'='BG1')
    ],
    [
      Button("OK", Shutdown(['RB1', 'RB2', 'RB3'])), 
      Button("Cancel", Shutdown())
    ]
  ], 
  ButtonGroup['BG1']()
):
Maplets[Display](maplet);

More generally you write the things this way
 

f := proc(N)
  local maplet, res:

  maplet := Maplet(
    [
      [
        seq(RadioButton[cat("RB", n)](caption=n,'group'='BG1'), n=1..N)
      ],
      [
        Button("OK", Shutdown([seq(cat("RB", n), n=1..N)])), 
        Button("Cancel", Shutdown())
      ]
    ], 
    ButtonGroup['BG1']()
  ):

  res := parse~( Maplets[Display](maplet) );
  map(i -> if res[i] then i end if, [$1..N]);
end proc:

f(5)

Multiple_choices.mw

First 101 102 103 104 105 106 107 Last Page 103 of 154