nm

11413 Reputation

20 Badges

13 years, 71 days

MaplePrimes Activity


These are replies submitted by nm

@Alejandro Jakubi 

"I wonder what the Ada feature looks like."

In ada:

  SWAP:
       declare
          TEMP : INTEGER;
       begin
          TEMP := V; V := U; U := TEMP;
       end SWAP; 


http://archive.adaic.com/standards/83lrm/html/lrm-05-06.html
It is a very useful feature. Similar things can be done in C++ by simply writing a nested {}

  main()
 {
   int a=2;
   {
     int tmp=3;  // this has scope only inside enclosing {}
     .....
    }
   ....
 }



@Carl Love 

thanks. I was very close. I tried value(expr) and evalf(expr), but somehow forgot there is also eval(expr).

Help in that page could be a little more clear for newbies. A small example sometimes is worth 1000 words :)

@Carl Love 

thanks, that is good news. Looking at it now. Some Maple expert should consider adding an entry to http://rosettacode.org/wiki/Named_parameters since Maple is missing from there while many other languages are present. This gives one the impression that Maple does not support this feature.

@Carl Love 

Thank you very much Carl this and notifing me about it;

Your new operators worked very well. There was one case where I could not use it. I was using your earlier operator ~= to display the equations as well as expressions before numerical values are substitued in, and when I switched to ~> and removed the () it did not like it for the equation case.

Here it is (assume your operators are defined and restart was done before each example:

v:=10;
eq &= (2*x +v = 5);

changed to


eq <~ 2*x +v = 5;
          Error, `=` unexpected

But this seems to happen for the = operator only from what I have seen so far. So it is not a big deal. I can add () for this one special case, like this

eq <~ (2*x +v = 5);

So I have changed my code to use your new operator <~. I think we should give this operator a name since it is very useful. I suggest the Love assignment operator if it is ok with you.

ps. I do not use Maple too much actually, mainly becuase I do not like the new GUI interfaces, even though I do like the language itself. I liked the old classical interface. I do use it on occasions to compare results with Mathematica (Maple seems really good in solving differential equations) and used it before few times here and there. But I consider myself a newbie in Maple.

You should not need a computer algebra program to do this trivial thing. It is only second order. can be done on the fly easily as we do it by hand.

@Carl Love 

thanks. Those short cuts help.

But as you can see, there is no way,using one command, to insert a new text mode group.

For example, if one is in an execution group, and want to make new text group below it, one must first create new execution group (ctrl-J), then go change it to text mode (Ctrl-T) in order to document something, before starting new execution group below it.

so, what is needed, is new command to insert text mode group (above and below), similar to the Ctrl-J and Ctrl-K, but work for text and not just executable. The bottom line: there is no way to make a new text mode group when one is inside an execution group and using one command only. at least 2 are needed. This is a UI design error.

someone can correct me if I am wrong.

 

@Carl Love Carl, your function is wonderful. I use it now all the time. Nice way to document the computation as it runs. This really should be part of Maple itself.

I was wondering, is it too much work to make it work, when the RHS is an expression, without having to group the expression inside () ?

For example this works:

restart;
`&=`:= proc(f::uneval, expr::uneval)
local x:= eval(expr);
  print(op(1, subs(_f= nprintf("%a", f), _x= x, proc(_f:= expr=_x)
end proc)));
assign(f, x)
end proc:

r1:=10; r2:=20;
x &= (r1 +r2 );

                               10
                               20
                         x:= r1 + r2 = 30

but this does not

x &= r1 + r2;

it gives

                            x:= r1 = 10
                            () + 20

it is not a big deal to put () around everything, but it would be nice it it can be avoided?

thanks again for a wonderful assignment operator.

@Markiyan Hirnyk 

That was really a rude reply by you.

@Carl Love 

thanks, That is very nice. now one can do this:

g&=int(cos(x),x);
                
Something like this should have been build into Maple itself ! You have invented a new useful assignment operator.

@Markiyan Hirnyk 

Sorry, but I do not use document mode or 2D math at all. I use worksheet and classical Maple for input. I also wanted a solution without any clickable calculus :). So that I can run large code and have the output to look at later. I mean, I am looking for way to do this using code only. No mouse, and no GUI interface.

thank you

@Axel Vogt 

"Is it a bug if posts are in languages other than English? That is actually an incredible attitude."

Please calm down. I thought it is a bug as what happened when the Maple web site was showing the web site in non-English due to geolocation bug. Since Mapleprime forum is full of bugs I thought maybe the same thing happens to some entries.

I visit many technical forums, and never seen a technical and international forum no-less, have discussion or a single question in it in something other than in English (except this).  Try to post a question at Mathematica or Matlab forums in something other than English and see what happens. Try that at stackexchange and see.

Unless the forum is local to a country, or private and not an international forum like this that is open to everyone, then there should be one common language used. period.

btw, English is not my birth language myself. And I would never think of asking a question here in my own language myself. It will be rude to do so since many (if not all) would not understand what I am saying.

 

 

why not post plain text code? Do you expect someone to type all of this?

 

Example

Diff(x1,t) = x2^2,
Diff(x2,t) = u,
y = x1

result in

Diff(y,t$2)-4*u^2*Diff(y,t) = 0
2*u*x2 - Diff(y,t^2) = 0
x1 - y = 0

Which version are using? Using Maple 17 I do not get the output you show, I get this:

--------------------
restart;
Diff(x1,t) = x2^2,
Diff(x2,t) = u,
y = x1;

      Diff(x1, t) = x2^2, Diff(x2, t) = u, y = x1

------------------

I do not even see where the `4` could have come from.

 

@Alejandro Jakubi 

Let me just step back one step. First I think we agree there can be different regions of expansion, and hence there is a need to tell laurent() (or series() the region, btw, Mathematica does not have Laurent[] function, but Series does both, Taylor and Laurent). 

How this API should look like, I am not sure. I am only a user. All what I am saying is that, from a user point of view, I want to ask a CAS to expand a complex function in some region, and currently this is not possible directly (unless one can do some smart tricks as shown above, and not all users would know how to do this).

To make this more concrete, here is a HW problem I had to solve (the one I asked about)

"Obtain two distinct Laurent expansions for f(z)=((3z+1)/(z^2-1)) around z=1 and tell where each converges"

Currently, neither Maple nor Mathematica as well supports specifying a region. Only an expansion point, and what seems to happen is that the disk around this point up to the first pole is used by default.

As far as implementation inside Maple, I do not know. I know I solved it by hand, by making a diagram and looking and seeing where to use Laurent vs. Taylor depending on direction. How to program this in a CAS, that is up to the math experts.

For an API, it can be as simple as supporting regions specificed as a disk or an annulus. So any mathematical way deemed to be the right way to specify these regions to use in the API would be fine.

Again, I am answering as a user, saying there is a need for this. I will leave how to do it for those experts in CAS programming :)

What does (T(z))r ® 0 as r ® ∞?  mean?  what is circle with R inside it? Is this some kind of worksheet coding?

First 84 85 86 87 88 89 90 Page 86 of 91