Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am using this proc by Carl Love posted here

https://www.mapleprimes.com/questions/211401-How-Do-I-Print-Text-Followed-By-Math

TSprintf:= proc() 
   local e;
   uses T= Typesetting; 
   T:-mrow(seq(`if`(e::string, T:-mn(e), T:-Typeset(T:-EV(e))), e= [args])) 
end proc:

when I do 

         TSprintf("Solving ", diff(y(x),x)=x);   

it works fine and it prints on the screen as expected. 

The problem is that inside a proc, if I use an error() later on, the message do not show up

foo:=proc()
   TSprintf("Solving ", _passed);   
   error "opps"
end proc;

And now when I call it like this 

  foo(diff(y(x),x)=x);
      Error, (in foo) opps   # Where the message "solving...." gone?? it does not show on the screen

I only see the "opps" and never see the message.  If I remove error(), then it shows up. But with standard printf, both show up

foo:=proc()   
   printf("Solving %a", _passed); 
   error "opps";
end proc;


foo(diff(y(x),x)=x);
    Solving diff(y(x),x) = x  # printf message shows OK
    Error, (in foo) opps      # from error 
 

Why TSprintf message do not show up if there is an error() after it?

Hello all,

     When using maple's differential equation solvers (dsolve or pdsolve), solutions will often have undetermined constants (or functions) _C1, _F2(x), _F5(t,x), etc. These are automatically generated and could potentially cause name collisions. I've found that passing names as part of the solver's ranking prevents this. For instance

D[1,1](y)(t,x) + y(t,x) = 0:
pdsolve(%);

would return y(t,x) = _F1(x)*cos(t) + _F2(x)*sin(t). However, if _F1(x,z) is defined elsewhere, then passing

D[1,1](y)(t,x) + y(t,x) = 0:
pdsolve(%, {y(t,x), _F1(x,z), _F2(x,z)});

instead returns y(t,x) = _F3(x)*cos(t) + _F4(x)*sin(t), preventing a collision.

However, it seems that PDEtools:-Solve doesn't follow this same convention. Indeed, calling PDEtools:-Solve(%, {y(t,x), _F1(x,z), _F2(x,z)}) on the above system returns y(t,x) = _F1(x)*cos(t) + _F2(x)*sin(t).

In all fairness, this is only a problem since my "colliding" functions are actually different functions: they differ in their arguments. When the arguments are the same (for instance, passing {y(t,x), _F1(x), _F2(x)} to Solve) then no collision occurs.

Nevertheless, having two different functions with the same name is causing problems for my code (later invocations of Solve with both _F1(x) and _F1(x,z) causes an "found functions with same name" error).

Is there any trick to avoid this behavior?

Thanks!

I am learning to use module().  If one has a local private proc() inside  a module, then on calling this local proc from inside the module itself, does one need to call it using module_name:-local_proc() or is it safe  to just call it using local_proc()?

i.e. will Maple always look to resolve this name inside the module first, before looking outside? What order Maple uses to resolve names? 

Here is an example

restart;
private_proc:= proc()
    print("Opps, should not be calling this, global copy");
end proc;

foo :=module()
    local private_proc;
    export public_proc;

    private_proc:=proc()
        print("inside private");
    end proc;

   public_proc:= proc()
        private_proc(); #will this always call foo:-private_proc() and not
                        #any other global proc with that name?                 
   end proc;

end module;

foo:-public_proc();

gives "inside private". So it seems to work without having to use foo:-private_proc(). But I thought to ask if the above will always work like this. 

Hi guys, 

I always thought matrices (Matrix) and 2D arrays (Array) where different objects in Maple.

In the attached file you will find a few examples of build-in functions which prove that Maple doesn't always check correctly the type of the arguments.

Beyond the questions set in the attached file, is there some tacit and unspoken rule in Maple which considers that Matrix and 2D Array have to be treated equally ?


Thanks for your answers

Matrix_or_Array.mw

For the most part, when I have come across bugs (or what appears to be bugs from my naive view, maybe it is left unevaluated for some means of diplomacy that I am not privy to) they are very difficult or impossible for me to find a way to get around.

But I have found alot recently that I was able to fix very quickly using functions that are already inbuilt in maple. Most have to do  with evaluating functions of trancendental arguements or composites of trancendental functions, but still, it leaves me feeling a little disturbed just how readily it was resolved.

I don't know exactly what to say, perhaps a 'dispatch' needed to be included in an inbuilt procedure to inform the 'engine' that a user has come across a bug of some kind at that address, so that maplesoft can keep the process of applying patches in house, avoiding having to enable the evolution/personal development the inept user that clearly stumbled upon the bug by sheer coincidence whist entering formula and observing output in a relatively sub human cognitive state?

  I want to calculate values of constants a[1] and b[1] by NonlinearFit model for two equations mentioned in below

(1/a[1]*x*t)*(1+a[1]*x^(2)*t+2*b[1]*x)    and  (1/b[1]*x*t)*(5*x*t+20*b[1]*a[1]*x*t^2+2*b[1]*x)

I know for the nonlinearfit model we need a data. But in my case, I do not have any data. So maybe data can be obtained by the numerical method, but how I do not know 

 

I only just noticed the Start.mw file being always number 1 in my Recent document list.  I don't recall it being there, ever, and I don't think it should.  Why is it there now?  Anyone else have this?

I am trying to show visually how many Lie derivatives of two different objects are needed to get a unique solution to a problem, so i want to create a graph of the form:


for the elements of this workseet:
3d_plot_of_Lie_derivatives_against_numelems.mw

Ok the error message I originally recieved in requesting 'expression' rather than 'value' was telling me the input is ambigous, isn't exactly helpful.

With the uploaded worksheet as last attempted, it gives the error of something about an invalid sequence, but still and I honestly do not see how when MathML is an XML application, surely whatever is put into the math container is retrievable considering XML applications are based on just handling the rendering of symbols.

 

Anyway I can only post here seeings that following the link for error messages rarely opens an actual help page in the brower, it simply tells you there is no help page for that error.

 


 

MathML[ImportModified](DocumentTools[GetProperty]('IIRN_CONTENT15', 'value'))

Error, (in MathML:-ImportModified) Typesetting:-merror("invalid sequence")

 

MathML[ImportModified](DocumentTools[GetProperty]('IIRN15', 'value'));

808066846690

(1)

 

``


 

Download 26052018.mw

Hellow,

how to write the codes for linear Lagranges piecewise polynomial in the interval x=[0,1] by taking h=0.1. 

if we fix h=0.1 automatically it should take the polynomial like these sample

x<0.1,(x-1)/0.2,x<0.2,(x^2-3x)/0.2,..... so on

 

In as much as the embedded component suite is a brilliant tool for the custom design of online educational programs, student tests, etc, my purposes are orientated around encouraging and assisting of self directed investigation, with the utilization of the packages of maple, but in a manner that allows the user to neglect the requirement to have any knowledge of maple code itself, allowing them to focus entirely on their discipline of choice. 

So because the content the user will enter into the interface I am designing is naturally going to be quite variant from individual to individual, one of the  necessary properties that does not exist is for the math containers to have the option of being resizeable at the discretion of the user.

At the moment, I have added buttons that allow the user to resize the window by pressing one of four buttons entitled "increase height". "decrease height", "increase width" and "decrease height". This will suffice for my first working prototype but i just feel that it would be much neater if it were possible to resize the math component directly, and some option of the neighbouring embedded components to either shift their position accordingly, or maintain rectilinear alignment with the greater proportion of other components by all embedded components shifting accordingly when one math container is resized.

 

Dear sir,

I want to plot the graph of Differential Equation numerically and other equation by changing the parameter values beta=2,2.5,5 . i am writing an sample codes and graph. the range of x is 0,..0.1

Eq1:=diff(y(x), x, x)+beta*y(x) = 0, y(1) = sin(1), (D(y))(1) = cos(1):
Eq2:=y=beta*e^x+sin(2*x)+x^2:

 

In the same vein as my last question, I need to bang out function symbols depending on a variable list of parameters, and refer to them later. I'm currently doing this:

PW > FunGen := symb -> PDETools[declare](symb(w1, w2, x1, y1), symb);
F > F0 := [b, seq(cat(r, i), i = 1 .. k), seq(cat(s, i), i = 1 .. k)];
                          [b, r1, s1]
PW > map(FunGen, F0);
          b(w1, w2, x1, y1) will now be displayed as b
         r1(w1, w2, x1, y1) will now be displayed as r1
         s1(w1, w2, x1, y1) will now be displayed as s1
F > dx := i -> 'eval(cat(dx, i))';
dy := i -> eval(cat(dy, i));
r := i -> parse(cat(r, i, "(w1,w2,x1,y1)"));
s := i-> parse(cat(s, i, "(w1,w2,x1,y1)"));
epsilon := i -> cat(epsilon, i);
F > bb := parse(cat(b, "(w1,w2,x1,y1)"));

I generate the function aliases for r,s,b depending on w1,w2,x1,y1, and refer to them later with 'r(i)', 's(i)' and bb. In general however, the number of x's and y's is variable (depending on k).

What I would like to do is something like

F > args := w1, w2, seq([x || i, y || i][], i = 1 .. k);
                         w1, w2, x1, y1
PW > FunGen := symb -> PDETools[declare](symb(args), symb)
r := i -> (cat(r, i)(args)
...

This does now however work, even though cat(r, i)(args) on a standalone line does indeed produce ri(w1, w2, x1, y1) and correctly parses to r1, etc.

Hi All,

I recently switched from Maple 18 to Maple 2018. I was trying to execute and old worksheet created with Maple 18 in which a DAE have to be solved numerically. In Maple 18 the worksheet works flawlessly whereas Maple 2018 throws 'Error, (in dsolve/numeric/process_input) invalid specification of initial conditions...'

Initial conditions are given in the form {x1(0) = 1, x2(0) = 2, D(x1)(0) = 1, D(x2)(0) = 0 ....} and are the same in both cases ( I merely executed without any modification the same worksheet in the two Maple versions).

I feel I've missed out something in the changelog... any idea on what is happening?

PS. call to dsolve

dsolve(dsys_numeric, numeric, implicit = true, stiff = true, optimize = true, compile = true):
 

 

 

Hi,

This is a notional example

1/ I define a matrix through some procedure, for instance
p := k -> Matrix(3, 3, (i,j) -> i+j+k mod 3)

2/ Now I would like to animate the plot of matrices p(k) for successive values of k.
The red commend below doesn't work
N := 5:
plots[animate](Statistics[HeatMap], [ p(k) ], k=0..N, frames=N+1);


Could you please help me to fix this ?
TIA

First 804 805 806 807 808 809 810 Last Page 806 of 2217