acer

17433 Reputation

29 Badges

14 years, 144 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.

On math.stackexchange.com.

MaplePrimes Activity


These are replies submitted by acer

Where did the image go?

If the OP removed the image then that would be incredbly rude, given that an answer was supplied.

@Christopher2222 What do you mean?

Do you mean that you want the clock to run k times as fast, from the moment the stopwatch is started?

@Christopher2222 Where it utilizes Today you can instead modify that using AdjustDateField.

Tod := Calendar:-Today():
New := Calendar:-AdjustDateField( Tod, "minute", 10 ):

Calendar:-Format(Tod, "hh:mm:ss a");
Calendar:-Format(New, "hh:mm:ss a");
                         "01:46:55 PM"
                         "01:56:55 PM"

clock_adj.mw

The original question was defaced. It went something like this:

"Does anyone knows how to calculate determinant of a matrix with a proc or function , i mean i don't have to use "det" in maple i need a whole..."

And the original title was, "Help me with determinant calculation of a matrix".

What is the class of optimization problems in which are you interested?

@mmcdara 
Just as a fun alternative,

restart;

f := (x__2+y^3)/(1+cos(y)):

H:=proc(e)
     uses T=Typesetting;
     nprintf(`#%a;`,
             subsindets(convert(T:-Typeset(T:-EV(e)),`global`),
                        identical('fontstyle')=anything,u->NULL));
   end proc:

 

H(f);

`#mfrac(mrow(msup(mi("y"),mn("3")),mo("+"),mi("x__2")),mrow(mn("1"),mo("+"),mrow(mi("cos"),mo("⁡"),mfenced(mi("y")))));`

lprint(%);

`#mfrac(mrow(msup(mi("y"),mn("3")),mo("+"),mi("x__2")),mrow(mn("1"),mo("&p\

lus;"),mrow(mi("cos"),mo("⁡"),mfenced(mi("y")))));`

 

Download for_fun.mw

Of course your mileage may vary, depending on expression.

I recall that (7.5 years ago) I wrote this.

I'm pretty sure that I've duplicated a similar thing (that also adjusts colors of fencing, etc) in several responses over the years.

It's all inter-related: MathML, Maple's Typesetting, etc.

However none of this helps directly with your original question (unless you are willing to accept a space denoting multiplication of H__2 or H[2] and O__2 or O[2], or to remove it in such mechanisms).

Even Robert's suggestion to manually form the concatenated name of a pair of symbols -- both having subscripts -- as an atomic identifier is not entirely straightforward. Backing up over a space between subscripted terms may be one step. Obtaining a result with upright Roman symbols is yet another step. And all as a one-off.

One of the strengths of a programming language is that such constructs can be built programmtically.

restart;

 

mk:=module()
  local f, ModuleApply;
  ModuleApply:=proc(L::list([symbol,posint]))
    local u;
    cat(`#mrow(`,
      f(L[1]),
      seq([`,`,f(L[u])][], u=2..nops(L)), `)`);
  end proc:
  f:=proc(LL::[symbol,posint])
    if LL[2]=1 then
      nprintf("mo(\"%a\",mathcolor = \"blue\")",LL[1]);
    else
      nprintf("msub(mo(\"%a\"),mn(\"%a\"),mathcolor = \"blue\")",
                  LL[1],LL[2]);
    end if;
  end proc:
end module:

mk([[H,2],[O,1]]);

`#mrow(msub(mo("H"),mn("2"),mathcolor = "blue"),mo("O",mathcolor = "blue"))`

mk([[H,2]]);

`#mrow(msub(mo("H"),mn("2"),mathcolor = "blue"))`

mk([[C,8],[H,10],[N,4],[O,1]]);

`#mrow(msub(mo("C"),mn("8"),mathcolor = "blue"),msub(mo("H"),mn("10"),mathcolor = "blue"),msub(mo("N"),mn("4"),mathcolor = "blue"),mo("O",mathcolor = "blue"))`

salt := mk([[Na,1],[Cl,1]]);

`#mrow(mo("Na",mathcolor = "blue"),mo("Cl",mathcolor = "blue"))`

eq := salt = true;

`#mrow(mo("Na",mathcolor = "blue"),mo("Cl",mathcolor = "blue"))` = true

 

I can cut and paste from that 2D Output.

eval(`#mrow(mo("Na",mathcolor = "blue"),mo("Cl",mathcolor = "blue"))`, eq)

true

 

Download typemk_more.mw

@mmcdara If you lprint your example you should be able to detect that your problematic example has some hidden character or space in it.

@Axel Vogt It may be that inttrans:-fourier is splitting it, and then running into failure:

int(erf(x)*exp(-I*x*k),x = -infinity .. infinity):
lprint(%);
  -2*I*exp(-1/4*k^2)/k

int(erf(x)*cos(-I*x*k),x = -infinity .. infinity):
                     0

I*int(-erf(x)*sin(-I*x*k),x = -infinity .. infinity):
lprint(%);
  I*int(I*erf(x)*sinh(x*k),x = -infinity .. infinity)

The integrals involving erf(x)*cos(-I*x*k) and erf(x)*exp(-I*x*k) are handled successfully by method=meijergspecial.

This is an engaging read.

Readers who like this might also be interested in these old posts by John May: 1, 2, 3, 4, 5, 6.

@Magma I do not have access at this momemnt to a machine with enough RAM to complete your large example.

However, I have noticed something troubling about the performance on your smaller example (which I included in my first Comment) as shown by CodeTools:-Usage under 10 repeats.

Maple 2015.2 (or earlier, approx.)
Your BP:
memory used=41.43MiB, cpu time=229.70ms, real time=232.80ms, gc time=12.40ms
Carl's modified BP:
memory used=12.47MiB, cpu time=97.80ms, real time=97.80ms, gc time=4.41ms

Maple 2016.0 (or later, approx.)
Your BP:
memory used=193.62MiB, cpu time=1.03s, real time=990.50ms, gc time=96.95ms
Carl's modified BP:
memory used=152.51MiB, cpu time=783.60ms, real time=757.30ms, gc time=76.69ms

@Magma In order to get Carl's revised BP to behave the same (on the earlier example A) as your procedure BP in Maple 15 all I had to do was modify one instance of a call to seq (to not utilize the newer calling sequence seq(U) ).

Otherwise I simply copied and pasted as 1D input.

BP_15.mw

Did you have an (other) input example that was problematic?

@Christopher2222 In my opinion the iPhone is a far more interesting target than the Fire for an Arm port.

The Fire also has difficulties with installation of arbitrary programs as applications. That also applies (at present) to an x86-64 based Chromebook, although there is some mitigation for those who run a terminal shell in developer mode or who re-install with ubuntu, etc.

Another Arm platform that might interest some is the Raspberry Pi.

On a related topic, I am hoping that the worldwide cloud/thin-client craze will peter out, and that something as locally useful as plugins will re-emerge.

@Kitonum Indeed, all methods will suffer from the possible problem of prior uniquification by the kernel. Your last edit is another example of what I was showing: forcing the order in which the variables are used to complete-the-square is enough (but still will succomb if the unwanted form has been previously constructed).

Unfortunately I don't know how sort could be used to forcibly re-order the terms (as for some similar problems) because the target is not expanded.

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10:
CompleteSquare(P, [y,x]);

(x-1)^2+(y-1/2)^2-13/4 = 10

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10:
(y-1/2)^2+(x-1)^2-13/4=10:
CompleteSquare(P, [y,x]);

(y-1/2)^2+(x-1)^2-13/4 = 10

 

Download zw2.mw

@Kitonum Your approach is not generally reliable -- it doesn't work if the alternate form has been formed beforehand in the same session.

Given the above weakness (to which Carl also alluded), there are easier ways to get the same effect.

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10;
P1 := lhs(P);
A := CompleteSquare(P1, x);
op(1,A)+CompleteSquare(A-op(1,A), y)=rhs(P);

x^2+y^2-2*x-y-2 = 10

x^2+y^2-2*x-y-2

(x-1)^2+y^2-y-3

(x-1)^2+(y-1/2)^2-13/4 = 10

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10;
(y - 1/2)^2 + (x - 1)^2 - 13/4 = 10: # zwischenzug
P1 := lhs(P);
A := CompleteSquare(P1, x);
op(1,A)+CompleteSquare(A-op(1,A), y)=rhs(P);

x^2+y^2-2*x-y-2 = 10

x^2+y^2-2*x-y-2

(x-1)^2+y^2-y-3

(y-1/2)^2+(x-1)^2-13/4 = 10

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10;
CompleteSquare(CompleteSquare(P,y),x);

x^2+y^2-2*x-y-2 = 10

(x-1)^2+(y-1/2)^2-13/4 = 10

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10;
(y - 1/2)^2 + (x - 1)^2 - 13/4 = 10: # zwischenzug
CompleteSquare(CompleteSquare(P,y),x);

x^2+y^2-2*x-y-2 = 10

(y-1/2)^2+(x-1)^2-13/4 = 10

 

Download zwisch.mw

5 6 7 8 9 10 11 Last Page 7 of 400