Carl Love

Carl Love

28150 Reputation

25 Badges

13 years, 351 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@janhardo In a version of this Question that you've substantially altered, you had a problem and question regarding the circle command. The reason for your error is that circle is in the plottools package, not the plots package; so, if you call it as plottools:-circle, you wouldn't have the error.

@janhardo If a curve is specified parametrically by 

x= f(t), y= g(t), -infinity < t < infinity;

then its arclength between t1 and t2 is

Int(sqrt(diff(x,t)^2 + diff(y,t)^2), t= t1..t2).

You could think of that as a path or line integral (the precise distinction between those two is inconsistently defined---it varies among authors), but I think that it's better for now if you just think of it as the 1-D integral shown above. As a VectorCalculus integral, it would be

VectorCalculus:-PathInt(1, [x,y]= 'Path'(<f,g>, t= t1..t2)).

So, when finding the arclength with this method, the "integrand" is simply 1.

@abdgafartunde Try writing some pseudocode first. Check Wikipedia.

@miasene Some response indicating whether or not my Answer was useful to you would be appreciated.

Some response indicating whether or not my Answer was useful to you would be appreciated.

The type of analysis that I saw in the worksheet that you'd earlier attached (curvature, etc.) does require either Student:-VectorCalculus or plain VectorCalculus. I would advise against you working through this Folium of Descartes example if you do not understand the underlying calculus, which comes from third-semester or multivariable calculus.

@janhardo I don't know what you mean by "high-level commands" other than simply "any command that I haven't seen before" or perhaps "any command whose name contains punctuation marks". To me, they are low-level commands because they are built-in to the kernel rather than being defined in terms of other Maple commands (the vast majority of Maple commands).

Most of the prefix-form operators come from quoting the symbol of an infix operator, and are thus obvious; for example, a + b is equivalent to `+`(a, b). There are only 8 operators whose prefix forms are not so obvious:

`if` #conditional expression
`{}` #set constructor
`[]` #list constructor
`<,>` #matrix/vector constructor by rows
`<|>` #matrix/vector constructor by columns
`?[]` #indexing
`?()` #function application
`~` #elementwise (similar to map)

@naili You say "until here it works perfectly". Have you looked at the output?? The line H:= F(x, -1.8) is nonsense because it treats the expression F as if it were a function that could be applied to arguments. Consequently, the line ListeH:= ... is also nonsense. The definition of H should be

H:= eval(F, y= -1.8);

@janhardo I think that you'll learn best by taking a symbolic example and deconstructing my commands. Please execute the following:

L:= [a, b, c]: 
f:= 'f': #i.e., f is just a symbol, to be used as a function
f~(L); #most-basic use of ~; similar to map(f, L)

`[]`(3, 7); #equivalent to [3, 7]
`[]`~([3], [7]);
`[]`~([a,b], [1,2]);
`[]`~(L, f~(L));

Using "functional-programming" syntax (such as map, zip, and ~) often requires that operators be used in "prefix operator-functional" form. `[]` is that form for the list-building operator [...]. All such forms are enclosed in back quotes: `...`. 

@ Here's my worksheet. The only things that are different from your worksheet are kernelopts(version), f:= (x,t)-> x - t, and the inclusion of k > 0 in the assuming clause.
 

> 

restart

> 

kernelopts(version);

`Maple 2020.0, X86 64 WINDOWS, Mar 4 2020, Build ID 1455132`

 

> 

f:= (x,t)-> x-t:

> 

eq := diff(u(x, t), t)-k*(diff(u(x, t), x, x)) = f(x, t)

diff(u(x, t), t)-k*(diff(diff(u(x, t), x), x)) = x-t

> 

ic := u(x, 0) = 0

u(x, 0) = 0

> 

"G(x,t):=1/(sqrt(4*Pi*k*t))exp(-(x^(2))/(4*k*t))"

proc (x, t) options operator, arrow, function_assign; exp(-(1/4)*x^2/(k*t))/sqrt(4*Pi*k*t) end proc

> 

ans := u(x, t) = int(G(x-y, t-s)*f(y, s), y = -infinity .. infinity, s = 0 .. t)

u(x, t) = (1/2)*(int(piecewise(-csgn(1/(k*(-t+s))) = 1, -2*(-x+s)*Pi^(1/2)/(-1/(k*(-t+s)))^(1/2), infinity)/(Pi*k*(t-s))^(1/2), s = 0 .. t))

> 

`assuming`([simplify(pdetest(ans, [eq, ic]))], [t > 0, k > 0])

[0, 0]

> 

NULL


 

Download InhomoHeat.mw

@janhardo This is perhaps too "clever" to bring up at this point, but at least you can see some of the awesome power of Maple syntax. Acer's

map(p-> [p, f(p)], L)

is functionally equivalent to any of

`[]`~(L, f~(L))  #"clever"

or

[for p in L do [p, f(p)] od]  #very straightforward

or

[seq]([p, f(p)], p= L)  #in between

or

[D[], f]~(L);  #too clever

The explanation of the last one is that the "zeroeth-order derivative" of a "function"[*1] is itself, so the operator that "creates" that derivative is the just identity function. But Maple should provide a dedicated built-in identity function just for such functional-programming constructions. D is not built-in to the kernel, and I think it'd be confusing to use a derivative operator anyway. And, I'm not sure that this functionality won't be changed in the future.[*1]

[*1] When D is used like this, it unintentionally ignores that its argument is not a really a function. 

@Preben Alsholm This bug has been fixed.

@ It's not a bug. The given result is mathematically equivalent to 0 under certain assumptions, which you did not provide. For example, if you specify a simple f such as f:= (x,t)-> x-t and include the assumption k > 0, then the pdetest will quickly return [0, 0].

Permutation arithmetic in Maple is quite easy, and it's expressed naturally with ordinary arithmetic operators. Let's use the permutation from your previous Question:

Orb(1):= Perm([[1,4,6,9,10]]):
Orb(2):= Perm([[2,3,5,7]]):
P:= Orb(1) . Orb(2):

Your problem:

P^4567;
           
 (1, 6, 10, 4, 9)(2, 7, 5, 3)

Compare with (note: 4567 mod 20 = 7,  7 mod 5 = 2,  and 7 mod 4 = 3):

P^7;
Orb(1)^2 . Orb(2)^3;

@DanishMapleFan Great. Let me know if you have any trouble with it or questions about it.

It works quite efficiently for most numbers whose prime factors have at most (approximately) 28 decimal digits and whose overall length is at most (approximately) 56 decimal digits.

First 192 193 194 195 196 197 198 Last Page 194 of 711