nm

3161 Reputation

17 Badges

7 years, 320 days

MaplePrimes Activity


These are questions asked by nm

I've never noticed this before, becuase I do not like to with()  packages, but like to add the name of the package at each command and alwsys try to use explicit commands.

Compare this first example, which does not work, since the "." in the codeis the global "dot" command ?dot

restart;
VC:=VectorCalculus:
f:=y*sin(x)+y^2;
VC:-Nabla . VC:-Nabla(f,[x,y])

So the dot above is the one used for normal dot product, which is visible without loading any package as in: <1,2>.<3,4> gives 11

Now when I next loaded the VectorCalculus explicitly, but kept the same code the same, i.e. using the same ".", now it worked

restart;
with(VectorCalculus);
VC:=VectorCalculus:  #do not need this now, but to keep the code the same
f:=y*sin(x)+y^2;
VC:-Nabla . VC:-Nabla(f,[x,y])

It worked because Maple now used VectorCalculus:-`.`  ,Even though I did not tell it to do this, it searched the package since it is loaded) and now decided to use VectorCalculus:-`.` instead of the global `.` dot defined before loading this package.

But how did Maple know which dot to use? 

Did it say to itself, the dot in the middile must be VectorCalculus:-`.` and not the global `.` due to the type of the operands around the dot, it automatically found the correct match? 

So imagine if one has loaded more packages, and some might have its own `.` operator that takes the same operands, does Maple search them all to find the correct dot to use based on type of operands to bind it to? and how in this case it knows which to use, if there is more than one match among all loaded packages? I can see this causing confusion, becuase one is never sure in this case which operator was used. I do not know if Maple issues a warning in this case or not.

I do not use input 2D math in document mode. But was trying it now to see if I can enter this to check my hand solution

In worksheet, this is what I do

restart;
VC:=VectorCalculus:
f:=y*sin(x)+y^2;
VC:-DotProduct(VC:-Del,VC:-Gradient(f,[x,y]))

But I do not know how to enter   if possible, in document mode 2D math. THis is what I tried. Created document mode. Picked the DEL operator from the left side common symbols window. But I do not know how to do the rest.

Clearly I am doing something silly. This is why I prefer plain Maple code, becuase I can see what I am typing :)

But was wondering, how to do the above in docuemnt mode + 2D math? To make it look close to how it shows in the book. Does one need special palette for this?

 

 

I wanted to overwrite an existing variable of type table by the one returned from a call to a proc().

But it does not work, unless eval() is called on the returned result from the proc()

But if the variable that recieves the return value from the proc() was not already a table type, then it works without using eval. Why is that? 

Here is an example

restart;
foo:=proc(A::table)
  A["c"]:=3; #add new field
  return A;
end proc;

A:=table():
A["a"]:=1:
A["b"]:=2:
B:=foo(A):
whattype(B);
print(B)

           table(["a" = 1, "c" = 3, "b" = 2])

In the above, it worked. is table now, and assigned the updated table from the proc.  But 

A:=table():
A["a"]:=1:
A["b"]:=2:
A:=foo(A): #without eval, it does not work.
whattype(A);
print(A)

             symbol
               A

I expected A to be overwritten, just like B was. To fix this, I have to change A:=foo(A): by A:=eval(foo(A)):

But why eval was not needed in the first example, and was needed for the second example?

btw, the same thing happens with Record(), not just table()

just like to understand the reasoning behind this. I expected both cases to work the same way. But it works different if the variable happend to be unassigned (like B above).

Why does Maple product history page   stop at Maple 6, year 2000?

Maple starterd in 1984. There are more versions before version 6. I think this official Maple page should list every release made in Maple and do not understand why it stop at version 6 only.

Wikipedia has more complete and detailed history of Maple products, starting with version 1 in 1982, with minor versions also shown than Maple own official web page gives.

btw, Wilipedia says version 6 was released in December 6, 1999. But Maple official page says version 6 was released in 2000.  

 

 

Any help why this code fail

restart;
PDE := diff(u(x,y), y$2 ) + diff(u(x,y), x$2) = 0;
BC:= u(x,0)=0, u(x,100)=100, u(0,y)=0, u(10,y)=0;
sol:=pdsolve([PDE,BC],numeric);

gives

Error, (in pdsolve/numeric/process_PDEs) PDEs can only contain dependent variables with direct dependence on the independent variables of the problem, got {u(0, y), u(10, y), u(x, 0), u(x, 100)}
 

But sol:=pdsolve([PDE,BC])  works OK and gives analytical solution.

What error Am I doing in the above code in this case?

Maple 2020 with Physics 642

1 2 3 4 5 6 7 Last Page 1 of 75