MaplePrimes Questions

Hi Users!

I hope everyone is fine here. I have plotted the density plot below:

restart; Digits := 20; with(LinearAlgebra); with(plots); N := 20; Mx := 20; L := 1; `&Delta;x` := L/Mx; T := 2; `&Delta;t` := T/N; for i from 0 while i <= Mx do u[i, 0] := 0 end do; for n from 0 while n <= N do u[0, n] := 0; u[Mx, n] := 0 end do; for n from 0 while n <= N-1 do for i while i <= Mx-1 do Ru[i, n] := eval((u[i, n+1]-u[i, n])/`&Delta;t` = (u[i+1, n+1]-2*u[i, n+1]+u[i-1, n+1])/`&Delta;x`^2-u[i, n+1]+.5) end do; Sol[n] := fsolve({seq(Ru[i, n], i = 1 .. Mx-1)}); assign(op(Sol[n])) end do;

Digits := 10; NP := 100; XX := [seq(seq(i1/Mx, i1 = 0 .. Mx), i2 = 0 .. N)]; TT := [seq(seq(i2, i1 = 0 .. Mx), i2 = 0 .. N)]; ZZ := [seq(seq(u[i1, i2], i2 = 0 .. N), i1 = 0 .. Mx)]; interfunc := subs(__M = Matrix(Matrix(Mx+1, N+1, ZZ), datatype = float[8]), proc (x, y) options operator, arrow; CurveFitting:-ArrayInterpolation([[`$`(i1, i1 = 0 .. Mx)], [`$`(i2, i2 = 0 .. N)]], __M, [[x], [y]], method = cubic)[1, 1] end proc); newz := CurveFitting:-ArrayInterpolation([[`$`(i1, i1 = 0 .. Mx)], [`$`(i2, i2 = 0 .. N)]], Matrix(Mx+1, N+1, ZZ, datatype = float[8]), [[seq(Mx*(i3-1)/(NP-1), i3 = 1 .. NP)], [seq(N*(i3-1)/(NP-1), i3 = 1 .. NP)]], method = cubic); nminz, nmaxz := (min, max)(newz); C := .666*(1-ImageTools:-FitIntensity(newz)); PC := PLOT(GRID(0 .. Mx, 0 .. N, newz, COLOR(HUE, C)), STYLE(PATCHNOGRID)); numcontours := 15; PP := (proc (P) options operator, arrow; (op(0, P))(op(P), ROOT(BOUNDS_X(0), BOUNDS_Y(0), BOUNDS_WIDTH(600), BOUNDS_HEIGHT(500))) end proc)(plots:-display(PC, plots:-contourplot(interfunc, 0 .. Mx, 0 .. N, thickness = 0, contours = [seq(nminz+(nmaxz-nminz)*(i3-1)/(numcontours+2-1), i3 = 1 .. numcontours+2)]), seq(plot(ZZ[1], nminz .. nminz, thickness = 15, color = COLOR(HUE, .666*(1-i3/(numcontours+1))), legend = sprintf(" %.3f", nminz+i3*(nmaxz-nminz)/(numcontours+1))), i3 = numcontours+1 .. 0, -1), legendstyle = [location = right, font = [Helvetica, 14]], font = [Helvetica, 16], labelfont = [Helvetica, bold, 16], labels = [x, t], labeldirections = [horizontal, vertical]));
plots[display](PP, size = [500, 400]);

Here the t-axis is from 0 to 20 but its actual value is from 0 to 2 and the x-axis is from 0 to 20 but its actual value is from 0 to 2. How can I change the axis? Moreover, I used the following way to extract the data in a dat file to plot the function (say f) in some professional software.

with(plots); f := plot(sin(x), x = -Pi .. Pi); dat1 := `~`[plottools:-getdata]([f]); for i while i <= 1 do A[i] := dat1[i, 3]; Y[i] := A[i][1 .. -1, 2] end do; X := A[1][1 .. -1, 1]; MM1 := `<|>`(X, `$`(Y[j2], j2 = 1 .. 1)); ExportMatrix("C:/Users/Usman/Desktop//Graph f.dat", MM1);

How I can, I extract data in the form of a dat file to plot in some professional software? 

integral of sqrt(sin(x)) is known to be as given in few place such as in here and other places.

Maple gives a result which is much more complicated (but also in terms of EllipticE special function). 

Could someone find a way to simplify it to the above answer and also to the same answer given by Mathematica?

int(sqrt(sin(x)),x)

Compare to 

Maple's result seems to be correct, as I plotted it and compared the smaller known resut. But I was not able to simplify it to obtain the smaller antiderivative.

Any tricks to do that?

Maple 2023.1 will not let me overload a method for an object when using _self.  Is there a way around this?

module person()
   option object;
   local the_name::string:="*",the_age;

   export set_info::static:= overload(
   [
      proc(_self,the_name::string,$) option overload;
          _self:-the_name:=the_name;
      end proc,

      proc(_self,the_name::string,the_age::integer, $) option overload;
          _self:-the_name:=the_name;
          _self:-the_age:=the_age;
      end proc
   ]);

   export get_name::static:=proc(_self,$)
      RETURN(_self:-the_name);
   end proc;
end module;

And now when I do 

o:=Object(person);
o:-set_info("me");
o:-set_info("me",20)

Error, (in person:-set_info) `me` does not evaluate to a module
Error, invalid input: no implementation of person:-set_info 
matches the arguments in call, 'person:-set_info("me",20)'

The problem goes away by removing `_self` as first argument in signature of the overloaded method. But then I will not be able to use _self any more inside the methods.

There is no problem overloading the method when using normal module, or one that does not use _self. For example this works

restart;

module person() 
   export set_info:= overload(
   [
      proc(the_name::string,$) option overload;
          print(the_name);
      end proc,

      proc(the_name::string,the_age::integer, $) option overload;
          print(the_name);
          print(the_age);
      end proc
   ]);
end module;

person:-set_info("me");
person:-set_info("me",20)

How to make the first example above work? I need to overload a method inside an module with option object that uses _self

update

I found a workaround. But it is not good, but for now. For the overloaded method, instead of using 
           o:-set_info("me");

This works instead

         set_info(o,"me");

So the following now works

o:=Object(person);

#o:-set_info("me");   #do not use with overloaded
#o:-set_info("me",20); #do not use with overloaded

set_info(o,"me");  #now works OK with no error
set_info(o,"me",20); #now works OK with no error

o:-get_name();  #OK since this method  is not overloaded
o:-get_age();  #OK since this method  is not overloaded

I do not understand why _self can't be used with overloaded methods and if this a bug or by design. 

Maple 2023.1 on windows 10

67588

interface(version);

`Standard Worksheet Interface, Maple 2023.1, Windows 10, July 7 2023 Build ID 1723669`

restart;

67588

module person()
   option object;
   local the_name::string:="*",the_age;

   export set_info::static:= overload(
   [
      proc(_self,the_name::string,$) option overload;
           #print("Inside first overloaded set_info");
          _self:-the_name:=the_name;
      end proc,

      proc(_self,the_name::string,the_age::integer, $) option overload;
          #print("Inside second overloaded set_info");
          _self:-the_name:=the_name;
          _self:-the_age:=the_age;
      end proc
   ]);

   export get_name::static:=proc(_self,$)
      RETURN(_self:-the_name);
   end proc;

   export get_age::static:=proc(_self,$)
      RETURN(_self:-the_age);
   end proc;
end module;

module person () local the_name::string, the_age; option object; end module

o:=Object(person);
#o:-set_info("me");
#o:-set_info("me",20);

set_info(o,"me"):
set_info(o,"me",20):

o:-get_name();
o:-get_age();

module person () local the_name::string, the_age; option object; end module

"me"

20

 

Download self_with_overloaded.mw

In short, I'd like to obtain n largest/smallest elements in a huge list of (probably non-numeric) data. Of cource I can sort it and then extract the desired part, yet isn't there a dedicated procedure that do a partial sort of the input data in Maple?

Edit. In a MatLab weblog, the blogger gave: 

So I believe that a dedicated one is not useless. But what is the Maple equivalent to MatLab's maxk, mink, and topkrows?

If if solve for two circles intersecting the general solution conteint a factor of (xc1-xc2) i.e. x co-ors of the circle centres in both numerator and denominator. So the solution fails if they are equal i.e circles vertically aligned.
I can get arount the problem using  "RealDomain" but that introduces Signum which I dont like and is much slower to solve. I substitued out substitued signum out signum(xc1-xc2)=1. Works.

Just looking for is neater solution approach.
 

restart

NULL

eq1 := (x-xc1)^2+(y-yc1)^2 = R1^2

(x-xc1)^2+(y-yc1)^2 = R1^2

(1)

eq2 := (x-xc2)^2+(y-yc2)^2 = R2^2

(x-xc2)^2+(y-yc2)^2 = R2^2

(2)

eq3 := (xc1-xc2)^2-(yc1-yc2)^2 < (R1+R2)^2

(xc1-xc2)^2-(yc1-yc2)^2 < (R1+R2)^2

(3)

Sol1 := `~`[simplify](solve({eq1, eq2}, [x, y], explicit))[]

[x = (1/2)*((-yc1+yc2)*(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)-(xc1-xc2)*(-xc1^3+xc1^2*xc2+(R1^2-R2^2+xc2^2-yc1^2+2*yc1*yc2-yc2^2)*xc1-xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2)))/((xc1^2-2*xc1*xc2+xc2^2+(yc1-yc2)^2)*(xc1-xc2)), y = ((-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+yc1^3-yc1^2*yc2+(-R1^2+R2^2+xc1^2-2*xc1*xc2+xc2^2-yc2^2)*yc1+yc2^3+(R1^2-R2^2+xc1^2-2*xc1*xc2+xc2^2)*yc2)/(2*yc1^2-4*yc1*yc2+2*yc2^2+2*(xc1-xc2)^2)], [x = (1/2)*((yc1-yc2)*(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)-(xc1-xc2)*(-xc1^3+xc1^2*xc2+(R1^2-R2^2+xc2^2-yc1^2+2*yc1*yc2-yc2^2)*xc1-xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2)))/((xc1^2-2*xc1*xc2+xc2^2+(yc1-yc2)^2)*(xc1-xc2)), y = (-(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+yc1^3-yc1^2*yc2+(-R1^2+R2^2+xc1^2-2*xc1*xc2+xc2^2-yc2^2)*yc1+yc2^3+(R1^2-R2^2+xc1^2-2*xc1*xc2+xc2^2)*yc2)/(2*yc1^2-4*yc1*yc2+2*yc2^2+2*(xc1-xc2)^2)]

(4)

eval(Sol1[1], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 178.3493912, y = 165.6165872]

(5)

eval(Sol1[2], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 212.1767210, y = 117.4323513]

(6)

NULL

NULL

NULL

NULL

Sol2 := `assuming`([`~`[simplify](solve({eq1, eq2}, [x, y], expl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^2-2*yc1*yc2+yc2^2)*xc1+xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2), y = (-signum(xc1-xc2)*(xc1-xc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+(yc1+yc2)*xc1^2-2*xc2*(yc1+yc2)*xc1+(yc1+yc2)*xc2^2-(yc1-yc2)*(R1^2-R2^2-yc1^2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2)]

(8)

eval(Sol3[1], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 178.3493912, y = 165.6165871]

(9)

eval(Sol3[2], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 212.1767209, y = 117.4323512]

(10)

Sol3a := subs(signum(xc1-xc2) = 1, Sol3[1])

[x = (-(yc1-yc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+xc1^3-xc1^2*xc2+(-R1^2+R2^2-xc2^2+yc1^2-2*yc1*yc2+yc2^2)*xc1+xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2), y = ((xc1-xc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+(yc1+yc2)*xc1^2-2*xc2*(yc1+yc2)*xc1+(yc1+yc2)*xc2^2-(yc1-yc2)*(R1^2-R2^2-yc1^2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2)]

(11)

Sol3b := subs(signum(xc1-xc2) = 1, Sol3[2])

[x = ((yc1-yc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+xc1^3-xc1^2*xc2+(-R1^2+R2^2-xc2^2+yc1^2-2*yc1*yc2+yc2^2)*xc1+xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2), y = (-(xc1-xc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+(yc1+yc2)*xc1^2-2*xc2*(yc1+yc2)*xc1+(yc1+yc2)*xc2^2-(yc1-yc2)*(R1^2-R2^2-yc1^2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2)]

(12)

eval(Sol3a, [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 212.1767209, y = 117.4323512]

(13)

eval(Sol3b, [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 178.3493912, y = 165.6165871]

(14)

NULL


 

Download 28-10-28_Q_Circles_Intersect.mw

 

It seems like my maple document has been corrupted. When I tri to open the document I'm met with an error message "There were problems during the loading process. Your worksheet may be incomplete."

I have spent a great amount of time in this document, so if there was a way to recover it, that would be fantastic.

Thanks!

Download prac_exam_ece4179.mw

Hi

Why, when I run the integral command, it only prints the integral instead of solving it?

Hi, I'm looking to create a series of random exercises on square roots for my students with two objectives: Simplify square roots and rationalize the denominator. Here's my scenario: I'm using the properties of the table to display the question and its solution, and generate a PDF with a good layout. I have two issues with the code: I don't want to display the '*' symbol when using "Parse" for "ex1" and "ex2," and I want only one denominator to be displayed for "Sol2." Thank you very much for your insights

AléatoireSérieRadicauxTEST.mw

TestRacineCarrée.pdf

Hi all

I need your advice on Maple usage after a long break. I installed Maple on my laptop and first of all tried to launch my old program. Surprisingly, the old file opened. While the core Maple functionality remained familiar, the user interface had undergone some changes.

Yet, I soon encountered challenges when attempting to perform even the simplest operations, like file browsing or text selection; the Maple Standard GUI seemed uncharacteristically sluggish.  I switched to Maple Input mode but it didn't help much. Are there ways to improve my experience with Maple? Is it caused by the outdated hardware?

My system:
Ubuntu 22.04.3 LTS
Dell Inc. Latitude 5510 (1TB SSD, 32GB RAM).

Maybe it works much better on Windows?

Thank you for any suggestions.

How do I compile a larger maple code for usage without maple system ?

Thanks for support :)

I am trying to separate a value by using solve common but could get the answer. Is there any way to get required expression

Simplification_Help.mw

I have a small problem that I can't find a solution for. How do you draw a diagram like the one shown in Maple? I can't figure out how to rotate the column labels or define tickmarks as text.

Can anyone help?

Modal Analysis is a very usefull feature. Only the animation window is sometimes too tiny.

How to enlarge this view and to pause the animation?

This seems to be a Maple plot window (a "Rotate the view" cursor is visible and the animation can be rotated). Are there any short cuts or functions keys to toggle plot view options?

Edit: Looks to my like a Maplet. Maybe a Maplet programmer can tell if that (what I am asking) is possible

Hi, 

Some of my maple documents contain data tables. 

When I want to view these documents with the maple cloud viewer, the data tables are invisible (the table is completely grayed out) and it is therefore impossible to change the values in this table. 

The table properties are such that it is enabled, visible and editable. 
Does anyone have an idea how to solve this problem? 
Thanks in advance. 

First 8 9 10 11 12 13 14 Last Page 10 of 2279