MaplePrimes Questions

I am trying to solve this equation, I tried
 

restart; 
ListTools[Categorize]; 
L := []; 
for a to 20 do
 for b to 20 do 
for c to 20 do 
for d to 20 do 
for e to 20 do 
for f to 20 do 
for g to 20 do 
for h to 20 do 
if sqrt(a+b*sqrt(c+d*sqrt(e +f*sqrt(g)))) = h then L := [op(L), [a, b, c, d, e, f, g, h]] end if
 end do end do end do end do end do end do end do end do; nops(L)

where g is not a square of a integer number . I do not get any solutions for a long time. How to reduce timing to solve this equation?

 

In this code, there are 8 vectors, each vector has 5 points except vectors 7 and 8 with 4 points. I made their  (7 and 8) respective fifth point a string. However, this error statement pops up "Error, invalid input: log[10] expects its 1st argument, x, to be of type algebraic, but received 2.51E-10".

Can someone help me with the correction?

Thank you all and kind regards

 

restart;

B:=<<601,1201,2401,4801,9601>|<2.87E-19,7.94E-21,7.94E-23,1.03E-24,5.91E-26>|
    <2001,4001,8001,16001,32001>|<3.30E-2,5.37E-4,8.47E-6,1.33E-7,2.08E-9>|
    <183,365,728,1476,2910>|<4.58E0,7.54E-8,2.20E-11,4.95E-14,9.15E-15>|
    <1621,3020,6166,12022,"2222">|<2.95E-3,8.51E-6,3.39E-8,2.51E-10,"2.51E-10">>:

for i from 1 to 5 do
   B[i, 2] := log[10](B[i, 2]):                      
   B[i, 4] := log[10](B[i, 4]):         
   B[i, 6] := log[10](B[i, 6]):         
   B[i, 8] := log[10](B[i, 8]):

   B[i, 1] := log[10](B[i, 1]):                      
   B[i, 3] := log[10](B[i, 3]):         
   B[i, 5] := log[10](B[i, 5]):         
   B[i, 7] := log[10](B[i, 7]):

end do:  # computing the log of the max-error
B: # This is the table of values we'll plot.

T:=plot([B[..,[1, 2]],B[1..1,[1, 2]], B[.., [3, 4]],B[1..1,[3, 4]], 
     B[..,[5, 6]],B[1..1,[5, 6]],B[.., [7, 8]],B[1..1,[7, 8]]], 
    legend = ["","BFFM","", "BNM","", "BHM","", "ARKN"],
    #title="Efficiency Curve for Example 5",
    style = ["pointline","point","pointline","point","pointline","point","pointline","point"], 
    symbolsize = 15,axes = framed, 
    symbol = [box,box, circle,circle,solidbox, solidbox,solidcircle, solidcircle],
    color=[ red, red, gold,gold, blue, blue,black, black], 
    axis = [gridlines = [colour = green, majorlines = 1,linestyle = dot]], 
    labels = [typeset(log__10(`NFE`)), typeset(log__10(`Max Err`))]);

This question came to me when I answered in this thread  https://www.mapleprimes.com/questions/231603-Solve-Onevariable-Equation

The equation there is quite cumbersome, I extracted a shorter subexpression from it (I converted all floats to exact constants), but the  solve  command hangs when trying to solve it. fsolve  handles the equation easily. We can see that the equation  Eq  is quite simple and easy to solve even by hand. I ask this question in a separate topic, because this seems to be a serious bug in the  solve  command.

restart;
Eq:=1-1/(1+203808*exp(-342569/506*t)*(1/131537))^(131537/203808)=44983/56599;
solve(Eq);

                    

 

Edit. I noticed that the  isolate  command solves the problem, but of course the question remains open with  solve .

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.

 

Matlab has some great functions package which accomplishes:

  • This function saves a figure or single axes to one or more vector and/or bitmap file formats, and/or outputs a rasterized version to the workspace, with the following properties:
    - Figure/axes reproduced as it appears on screen
    - Cropped/padded borders (optional)
    - Embedded fonts (pdf only)
    - Improved line and grid line styles
    - Anti-aliased graphics (bitmap formats)
    - Render images at native resolution (optional for bitmap formats)
    - Transparent background supported (pdf, eps, png, tiff)
    - Semi-transparent patch objects supported (png, tiff)
    - RGB, CMYK or grayscale output (CMYK only with pdf, eps, tiff)
    - Variable image compression, including lossless (pdf, eps, jpg)
    - Optional rounded line-caps (pdf, eps)
    - Optionally append to file (pdf, tiff)
    - Vector formats: pdf, eps
    - Bitmap formats: png, tiff, jpg, bmp, export to workspace

 

  • Why don't we all together in this forum create a package like that? :) At least I  hope we can create for most important of the functions like cropping border etc. Many Maple users need a code like that.

 

  • I don't know whether we can quickly convert these codes to maple codes or not.  But maybe we use all code in this forum about this and create a new package.

Best regards.

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.

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.

First 322 323 324 325 326 327 328 Last Page 324 of 2308