acer

32343 Reputation

29 Badges

19 years, 328 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

It seems to work for me, even in 2D Input in a Document and without encapsulating brackets around the procedure body.

Perhaps you could upload a Document that reproduces the problem.

restart

kernelopts(version)

`Maple 2018.2, X86 64 LINUX, Nov 16 2018, Build ID 1362973`

q1 := proc (n1, n2) options operator, arrow; if n1 < 0 then 0 elif n2 < 0 then 0 elif abs(n1-n2) = 1 then sqrt((1/2)*max(n1, n2)) else 0 end if end proc

q1(7, 6)

(1/2)*14^(1/2)

`if`(n1 = n2, 1, 0); q1 := proc (n1, n2) options operator, arrow; if n1 < 0 then 0 elif n2 < 0 then 0 elif abs(n1-n2) = 1 then sqrt((1/2)*max(n1, n2)) else 0 end if end proc

0

q1(7, 6)

(1/2)*14^(1/2)

``

Download if_operator_2dmath.mw

@dharr And he's also used the name I in a way that may have him confused.

Perhaps best for him would be to use some other name such as II instead. That's might make it more clear if the imaginary unit I appears in the result. (There are alternatives. But as it is the code looks confusing.)

@Bart Yes, using a value of 0.1 for the thickness makes the result from my suggestion to use subsindets look even better than the OP's suggestion to use value 0 does. I have edited my Answer accordingly, with attribution.

I have submitted various bug reports, on commands where thickness=0.1 is not allowed (but ought to be), and that the THICKNESS value 0.1 renders a thinner line that value 0 does. This kind of thing --- where Maple has the power but it's hidden -- needs to be fixed.

@rstellian The stylesheet option was introduced in Maple 2017, so it's not available in Maple 2016.

@wanderson 

It may be enough to change inert Diff to active diff here (or perhaps use value(pde) ).

restart;

kernelopts(version);

`Maple 13.00, X86 64 LINUX, Apr 13 2009, Build ID 397624`

(1)

The equation of heat condition in a medium of
variable conductivity k(x) is
"(&PartialD; u)/(&PartialD; t)=(&PartialD;)/(&PartialD; x)(k(x) (&PartialD; u)/(&PartialD; x))."

In your case the conductivity is a piecewise constant
function which jumps from k__1 to k__2 at the interval's

midpoint. In principle we should be able to take

"k(x) = `k__1`+(`k__2`-`k__1`) Heaviside(x-L),"

or equivalently

"k(x)=`k__1`+(`k__2`-`k__1`) piecewise(x<L, `k__1`, `k__2`)."

I am unable to make either of these representations
work with Maple's numeric solver, so I do the next
best thing which is to approximate the Heaviside function
with a smooth function such as

myHeaviside := x -> (1+erf(4*x))/2;

proc (x) options operator, arrow; 1/2+(1/2)*erf(4*x) end proc

(2)

Let's compare myHeaviside with the real thing:

plot([Heaviside(x), myHeaviside(x)], x=-10..10,
  color=[red,blue], axes=frame, gridlines=false,
  legend=[Heavisie, myHeaviside]);

 

OK, then, let's start:

pde := diff(u(x,t),t) = diff(k(x)*diff(u(x,t),x), x);

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

(3)

ibc := u(x,0)=0, u(0,t)=v1,  u(2*L,t)=v2;

u(x, 0) = 0, u(0, t) = v1, u(2*L, t) = v2

(4)

k := x -> k1 + (k2-k1)*myHeaviside(x-L);

proc (x) options operator, arrow; k1+(k2-k1)*myHeaviside(x-L) end proc

(5)

L := 10: v1 := 20: v2 := 10: k1 := 10: k2 := 20:

To handle the sharp change in conductivity, we refine the spacestep size from

its default value of 2*L/20 by dividing it by 5.

pdsol := pdsolve(pde, {ibc}, numeric, spacestep=(2*L/20)/5);

module () local INFO; export plot, plot3d, animate, value, settings; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; end module

(6)

pdsol:-animate(t=15, frames=50, labels=[x,u(x,t)],
  title="time = %f", gridlines=false);

 

 

Download pde_m13.mw

@Christopher2222 I would never alter someone else's vote even if I could (and I cannot.)

I submitted a bug report, when I first noticed this.

For one thing it is a backwards incompatibility in GUI usage. And it wasn't broken or inconvenient before, so the change didn't fix anything. So it's an unnecessary backwards usage incompatibility.

More importantly, it now looks as if it is a computational effect -- given the menu-item under which it now appears. And that is bad, because it makes it look like it's undoing any actual computation/assignment in kernel space. And of course it isn't.  Mathematica has such a feature and Maple does not.

It's an editing-undo, not an evaluation-undo. It should be moved back, asap in the next point release.

If Carl Love doesn't find it then imagine the havoc for non-experts.

A mistake on multiple levels

Except your idea doesn't always work, in part because it turns names into globals.

I can't imagine why anyone would give this an up-vote.

@reza gugheri I have updated your Question to mark it as version Maple 13.

@Christopher2222 I'm sorry, but I cannot understand what you're now asking because it seems as if you haven't understood a single word I've written so far. I have to stop with this now. Good luck.

@Christopher2222 But generally computed results will not show the effect. Eg,

restart;
macro(v^2=a^2+b^2):

p:=v:
p*v;
                  2
                 v 
So that's a huge set of situations where the macro won't give you anything extra.

@radaar How could I know anything about a .dll file that you merely reference in a worksheet!?

Is it for 32bit or 64bit?  (Your attached worksheet was last saved in 64bit Maple 2017.3. So if you're using 64bit Maple then the .dll better match.)

What's inside it? How did you build it?

@ecterrab Perhaps I misunderstood, but it seems to me that the OP was looking for considerably more than what macro provides.

Consider these examples. I got a strong sense the the OP wanted Maple to be able to utilize the "assignment" for mathematical effect on subsequently formed expressions -- rather than merely an abbreviation mechanism for input.

restart;
macro(v^2=a^2+b^2):

foo := (v^2)^2;

                             4
                     foo := v

hmm1 := foo/(a^2+b^2);

                               4
                              v
                    hmm1 := -------
                             2    2
                            a  + b

simplify(hmm1);

                         4
                        v
                      -------
                       2    2
                      a  + b

hmm2 := hmm1/v^2;

                              2
                             v
                   hmm2 := -------
                            2    2
                           a  + b

simplify(hmm2);

                          2
                         v
                       -------
                        2    2
                       a  + b

hmm3 := hmm2*v^2;

                               2
                      hmm3 := v

simplify(hmm3);

                          2
                         v

Please don't repost the question just because you haven't received an answer.

@Joe Riel Yes, there some special assignment syntax cases that have a specific meaning and are useful. But his meaning seems to be either general or at best unclearly specified.

Perhaps he is talking about assigning into rember tables of procedures. It doesn't seem clear though, because he also seems to be talking about subsequent use in contexts where ambiguity comes into play. I find it hard to discern what precisely he's requesting, that wouldn't be better achieved via algsubs, say.

I'm not saying that there is no way to extend Maple's assignment functionality in ways that could ever be useful. I'm saying that, as described so far, the request seems unclear or ambiguous.

First 215 216 217 218 219 220 221 Last Page 217 of 592