MaplePrimes Questions

Dear all
Using cubic spline interpolation to interpolate a given function I get  
the follwoing error
Warning, solving for expressions other than names or functions is not recommended.
Error, (in solve) list of unknowns contains repeated elements: [1, 0]

and  why the  spline funciton obtained by this code is different to the one given by Maple's built in package.

inter.mw

Thank you for any help 

I want to remove the term XY
f:=(x,y)->2*x²+xy+y²+4x-y-2=0;
eq := simplify(subs(x = X-9/7, y = Y+8/7, f(x, y)));
theta:=Pi/8;
ex := simplify(subs(X = cos(theta)*X-sin(theta)*Y, Y = sin(theta)*X+cos(theta)*Y, eq)); evalf(%);
How to obtain (3+sqrt(2))/2*X²+(3-sqrt(2))/2=36 ? Thank you.

 

Hello,

I have two ordiary differential equations to be solved numerically. One of the equations can be solved independently (no need to solve the 2nd differential equation). However, in order to solve the 2nd differential equation, I need the numerical solution from the 1st one. 

sol1:=dsolve({ode1,x(0)=x__0, D(x)(0)=x__1},numeric, x(t), parameters=[a,b,c])

sol1(parameters=[4,5,1])

Now, I need to solve the 2nd differential equation which will give me y(t), but the differential equation depends on the function of x(t). What is the syntax of dsolve which incorporates the solution of another differential equation?

 

 

Hello, 

How one would define a function of a function-- a functional?

Given

f(g(r)) := int(g(r), r)

I would like to get 

int(h(r+eps),r)

when I call it like

f(h(r+eps))

I could achieve this behaviour by substitions, but is there a nicer and shorter way of doing this?

Thanks in advance.

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.

First 441 442 443 444 445 446 447 Last Page 443 of 2427