Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi, 
 

Trying to change the color of the plot that Statistics:-Sunflower produces is not trivial:

restart:
interface(version);
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895

# This example comes from the help page
with(Statistics):
data := Vector[row]([2, 5.3, 4.6, .88, 2.5, 5.9, 5, 10, 1.7, 7.8, 7.2, 9.42, 9.01, 3.42, 4, 11.59, 8, 10.3, 1.5, 8.5, 11.4]):
a := SunflowerPlot(data, length = 4, size = [600,200], color=red):
a;     # navy blue plot
op(a); # look at the structure of a to see why red is not accounted for

After having examined the structure of 'a', I circumvent this problem by doing this:

b1 := SunflowerPlot(data, length = 4, size = [600,200]):  #no more color specified
c  := op(select(has, op(1, b1), COLOUR));
b2 := eval(b1, c=COLOUR(RGB, 1, 0, 0)):

# Red sunflowers!!!
plots:-display(b2)  


Does it exist a simpler way to set the color of the sunflowers through some option of  Statistics:-Sunflower ?

TIA

Hello,

I have the following function:

y:=t->808.2213240*(1 - 0.63*(1993551437/1601983488 - sqrt(3)/2)^0.3)*(1 - 335345*(45188/147189 - 53/(4820*ln(2)))*335345^(131537/203808)*131537^(72271/203808)*(1 - 1/(1 + (203808*exp(-677.0138344*t))/131537)^(131537/203808))/34603964738)

I want to solve for t when y(t)=196.9594856. I tried solve(y(t)=196.9594856,t) and it took several minutes of still evaluating before I gave up. Any ideas? Cheers.

 

Hi,

 

I am looking to convert two expressions into to one, however, their arguments are supposed to be numerically in order:

fsolve(2*x^5-x^4-0.5*x^3+3*x^2-0.5)
            -1., -0.415862444399209580898770761551,0.425609408597783496007437773936


fsolve(x^2-1)
              -1.00000000000000000000000000000, 1.

For my procedure, I need them in order, namely

-1,-1, -0.415862444399209580898770761551,0.425609408597783496007437773936,1

Is it possible to do this with expressions without having to convert them to a list? Since my following code expects expressions, and not lists, I wouldn't like to change the whole program around it.

The order in which expressions evaluate in Maple is something that occasionally causes even advanced users to make syntax errors.

I recently saw a single line of Maple code that provided a good example of a command not evaluating in the order the user desired.

The command in question (after calling with(plots):) was

animate(display, [arrow(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

This resulted in the error:

Error, (in plots/arrow) invalid input: plottools:-arrow expects its 3rd argument, pv, to be of type {Vector, list, vector, complexcons, realcons}, but received 0.5000000000e-1*(cos(t)^2+sin(t)^2)^(1/2)
 

This error indicates that the issue in the animation is the arrow command

arrow(<cos(t), sin(t)>)

on its own, the above command would give the same error. However, the animate command takes values of t from 0 to 2*Pi and substitutes them in, so at first glance, you wouldn't expect the same error to occur.

What is happening is that the command 

arrow(<cos(t), sin(t)>)

in the animate expression is evaluating fully, BEFORE the call to animate is happening. This is due to Maple's automatic simplification (since if this expression contained large expressions, or the values were calculated from other function calls, that could be simplified down, you'd want that to happen first to prevent unneeded calculation time at each step).

So the question is how do we stop it evaluating ahead of time since that isn't what we want to happen in this case?

In order to do this we can use uneval quotes (the single quotes on the keyboard - not to be confused with the backticks). 

animate(display, ['arrow'(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

By surrounding the arrow function call in the uneval quotes, the evaluation is delayed by a level, allowing the animate call to happen first so that each value of t is then substituted before the arrow command is called.

Maple_Evaluation_Order_Example.mw

In the present problem 

I am trying to obtain the numerical solution and graphs for the f' theta1 and theta2 curves vs eta profile

please anyone help me to obtain the solution

i have attached my worksheet below

Thank you for your precious time.

Download ODE_Prob.mw

 

Hello

I am currently working on a visual proof that cutting a cone with a plane, can give you a mathematically correct ellipse.
Therefore i want to animate a cone, using the "cone" command, where you can set the origin, radius and height. I was wondering if it is possible to, using the animate command, make an animation with a cone, either chaning radius of base or height. I have tried various combinations of different commands, but have not had any success. I hope you can help me out!

- Oscar

Hi!

 

Is there a way to use the profiling function for procedures within a procedure? I have this code as an example:

Test:=proc(a,b)::real;

local c;Ergebnis;

Test2:= proc(d,e) #Prozedur zum Schreiben der Ausgaben

    f:=d+e;
    g:=f*d;
    5+3;
    3/0;
end proc:
 c:=a+b;
 Ergebnis:=Test2(a,c)
 end proc:

infolevel[Test]:= 2:
CodeTools:-Profiling:-Profile(Test):
Test(3,4);
CodeTools:-Profiling:-PrintProfiles(Test);

just profiling Test2, the subprocedure, doesn't do anything. Obviously, in this example, the division by zero is the problem, however, I am interested in a general solution to detect more complicated problems within a sub-procedure. Is there a way to also profile it, and thus see where the computation stops?

I want to export Maple 3d graphics to Latex with high quality. ( MAPLE 2020.1)

I export the 3d graphics to a .jpeg or.png file, but the quality of graphics is very poor. So, I want to prefer Encapsulated PostScript files (.eps) format.

 I select the figure, right-click it and choose "Export as". and  I save the figure as  .eps file. No problem I get a file. But when I add the eps figure to Latex, I live some problems:

MY Example Code:

restart:
with(plots):
scheme1 := ["zgradient",["Blue","Cyan","Green","Yellow","Orange","Red"]]:

P1:=plot3d(x*y, colorscheme=scheme1,style=surfacecontour ): 
P2:=plot3d(x*y,colorscheme=scheme1,style=point,symbol=asterisk): 
final_plot:=display({P1,P2}); #I want to export this figure to .eps

 

PROBLEMS which I live:

  • Sometimes I get the result as follows:

  • Sometimes compiling takes too long time in latex, I don't get any results or get an error. (I tried on the all of TexStudio or TexMaker or overleaf)

I read the previous post on this site and applied the suggestions, but I still live the same problem.

 

P.S. 

I can add Maple 2d graphics to LATEX without any problem.

Any help would be appreciated.

Hi everyone, 

I have two expressions given by:

A := -sqrt(m(p[1](t))/m(q[1](t)))*p[2](t) - l[1]*q[1](t) + l[1]*p[1](t) + q[2](t);

B := -(-sqrt(m(p[1](t))/m(q[1](t))^3)*C(p[1](t))*m(q[1](t))^(3/2)*p[2](t)^2*m(p[1](t)) + C(p[1](t))*p[2](t)^3*m(q[1](t))^(3/2)*sqrt(m(p[1](t))/m(q[1](t))) - l[1]*p[2](t)^2*C(p[1](t))*(p[1](t) - q[1](t))*m(q[1](t))^(3/2) - sqrt(m(q[1](t)))*l[2]*(p[1](t) - q[1](t))*m(p[1](t))^(3/2) + m(p[1](t))*l[1]*p[2](t)*C(p[1](t))*(p[1](t) - q[1](t))*sqrt(m(q[1](t))) - C(q[1](t))*q[2](t)^2*sqrt(m(p[1](t)))*m(q[1](t))*(q[2](t) - 1))/(sqrt(m(p[1](t)))*m(q[1](t))^(3/2));

I would like to rewrite these two expressions according to a and b (replace in A and B each: q[1](t) - p[1](t)  by a and   sqrt(m(q[1](t)))*q[2](t) - sqrt(m(p[1](t)))*p[2](t) by ), such that : 

a := q[1](t) - p[1](t);
b := sqrt(m(q[1](t)))*q[2](t) - sqrt(m(p[1](t)))*p[2](t);
 
I used subs and collect but doesn’t work.

Could you help me please ? 

I would like to thank you in advance.

Best regards,

I want to write a procedure for adding gridlines to 3dplots of any function f on ([x_min,x_max]x[y_min,y_max])

restart:
with(plots):
grids:=proc(f,x_min,x_max,y_min,y_max)
 local z_min,z_max,plot_f,xz,yz,xy;
uses plots;
z_min:=0:
z_max:=10:
plot_f:=plot3d(f,x=x_min..x_max,y=y_min..y_max);
xz:=plot3d([x,y_min,z],x=x_min..x_max,z=z_min..z_max,style=line,color=blue,thickness=0,grid=[6,6]);
yz:=plot3d([x_min,y,z],y=y_min..y_max,z=z_min..z_max,style=line,color=blue,thickness=0,grid=[4,6]);
xy:=plot3d([x,y,z_min],x=x_min..x_max,y=y_min..y_max,style=line,color=blue,thickness=0,grid=[4,4]);
return
display(plot_f,xz,yz,xy,lightmodel=none,tickmarks=[3,3,6],labels=[x,y,"f(x,y)"],labeldirections=[horizontal,horizontal,vertical],axes=frame);
end proc:

#EXAMPLE
f:=x^2-y:
x_min:=-1:
x_max:=3:
y_min:=-2:
y_max:=1:
grids(f,-1,3,-2,-1);

 

 

 

 

 

 

Some of the drawbacks of the above code are:

  1. The minimum value ( z_min ) and maximum value ( z_max ) of function f(x,y) can't be calculated automatically.
  2. grid=[6,6],grid=[4,6] etc. can't be calculated automatically. (it may be automatically calculated by considering the stepsize of axis x and axis y)

 

If I make this command in maple: solve(sin(x) = -1/2, x) I would like to get all the answers, but the only output I get is pi/6. I know I can find the other output myself, but I would like to know if I can make maple show all the answers. 

Here is how my cas calculater would shows the answer/output: "x=2k*pi+7pi/6 or 2k*pi-pi/6" - shich is how I would like to see it in maple as well.

 

 

Hi,

I was hoping to run two procs: tgf3 and tgf4 in parallel using Grid, Run and get a faster execution time. As I understood the description of Grid Run, the first call to Grid Run will run in the background and before it is finished the second call Grid Run will start. I do not believe I have that situation in my script. I am not understanding Grid Run. How can this problem be fixed? Here is just a portion of the script using Grid Run:

Use Grid Run 0 for tgf3 and 1 for tgf4. Determine the real time and compare times. The Grid Runs do not appear to run in parallel.

rgt := time[real]();
Grid:-Run(0, `~`[tgf3@op](convert(L, listlist)), 'assignto' = ans3roots);
Grid:-Run(1, `~`[tgf4@op](convert(L, listlist)), 'assignto' = ans4roots);
ans3roots;
ans4roots;

GridRunTime := time[real]() - rgt;
                     GridRunTime := 44.074

Here is my script:

Grid_Run_2.mw

 

Thank you for your help.

1. How did Maple come up with this answer?

I've tried all the packages in SumTools and none of them give an answer except Hypergeometric.

2. Is there a way to trace the steps Maple is using so I can try and answer this myself?

3. Why did it sum the series when I didn't even ask - I deliberately used the inert form (no arguments though - I like what it did).

Thank you.

______________________________________________________________________________

H1a := Sum(GAMMA(2*b - 1 + 2*n)*GAMMA(2*n - s)*(b - 1/2 + 2*n)/(GAMMA(2*b + 2*n + s)*GAMMA(2*n + 1)), n = 0 .. infinity);

H1b:=convert(H1a,Hypergeom);

The answer H1b it came up with is 

GAMMA(-s)*2^(1 + 2*b)*GAMMA(b)/(8*GAMMA(b + s)*2^(2*b));

which seems to be correct.

How to plot absolute value in dsolve?
absolute_plot.mw

Plotting in the first coordinate in the plane......

Hello there, 

Would please tell me how to pick up numerical vaules from answers given by 'solve()' command?

If you look at the worksheet (sorry for the error), one possible way is labeled by 'solution 1'. However, when I tried the expression in the 'attempt 1' label, I got an error. Therefore, I'm wondering if there is a way to extract the values from the answers, instead of using the 'rhs()' command. 


Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/q20210206.mw .
 

Download q20210206.mw

 

Best Regards, 

In Kwon Park

First 317 318 319 320 321 322 323 Last Page 319 of 2097