Maple 2017 Questions and Posts

These are Posts and Questions associated with the product, Maple 2017

hey everyone
i got a little problem here i really dont get it why my fsolve give me this error

Error, (in sqrfree) argument must be a polynomial or a rational function in {cf[-2], cf[-1], cf[0], cf[1]}
these are my variables :


cf[-2], cf[-1], cf[0], cf[1]}


thats part of my code :

res1;
(34.30563197 cf[-1] - 10.13498047 cf[0] + 5.197134649 cf[1]

   - 0.4714805434) (0.3095515346 cf[-2] + 0.3822521253) - (cf[-1](2.466022067

  ) + cf[0](-0.6605923783) + cf[1](1.076415647))^2

   - cf[-1](2.466022067) - cf[0](-0.6605923783)

   - cf[1](1.076415647) - 333.1166471 cf[-1] + 186.8672744 cf[0]

   - 128.6145289 cf[1] + 0.8737683108, (-39.73727883 cf[-1]

   + 26.25682759 cf[0] - 7.289811219 cf[1] - 0.3506934780)

  (0.4161980514 cf[-1] + 0.4402863507) - (cf[-1](0.3227083347)

   + cf[0](2.517826949) + cf[1](-0.7889944208))^2

   - cf[-1](0.3227083347) - cf[0](2.517826949)

   - cf[1](-0.7889944208) - 15.03436409 cf[-1]

   - 129.5665191 cf[0] + 68.25827819 cf[1] + 0.5888637790,

  (17.36111111 cf[-1] - 29.80788311 cf[0] + 17.36111111 cf[1]

   - 0.2500000000) (0.5000000000 cf[0] + 0.5000000000)

                                                            2
   - (cf[-1](-1.833333334) + cf[0](0.) + cf[1](2.333333334))

   - cf[-1](-1.833333334) - cf[0](0.) - cf[1](2.333333334)

   + 38.17276297 cf[-1] + 34.00261850 cf[0] - 77.23526300 cf[1]

   + 0.3750000000, (-3.548332053 cf[-1] + 12.78057007 cf[0]

   - 19.34221012 cf[1] - 0.1707008416) (0.5290914191 cf[1]

   + 0.5597136492) - (cf[-1](1.060931345) + cf[0](-1.540306477)

   + cf[1](-0.2297630675))^2 - cf[-1](1.060931345)

   - cf[0](-1.540306477) - cf[1](-0.2297630675)

   - 20.59209188 cf[-1] + 28.27859544 cf[0] + 40.45630289 cf[1]

         -10                      
   + 1 10    cf[-2] + 0.2254717519


fsolve({seq(res1[v] = 0, v = 1 .. 2*N+2)})     ( N here is 1 )

why i cant get the awenser and if you can plz solve it for me

i would be happy that anyone can give me an explanation with details

tnX a lot

Arian
 

 

I'm trying to figure out how to plot the following: if I have a region G in R^2, and two functions f <= g on G, I would like to plot the projection on the XY-plane in say one colour and the volume between f and g in another. For example, consider G the region between the parabolae y=x^2 and y=2-x^2, and f(x,y) = x+y+4 and g(x,y) = 25-x^2-y^2, just to name something. I'd also prefer the plot to be easy adaptable to other functions, e.g. with a different region G, different function descriptions for f and g but also, if possible, projection on one of the other two coordinate planes. Is there an easy way to do this?

In Maple 2017.2:

solve(x^3+x*a+2 > 0, [a, x]);
           [[a = -3, x < 1, -2 < x], [a = -3, 1 < x]]

solve(x^4+x*a+1 > 0, [a, x]);
Error, (in rootbound) 1st argument must be a polynomial with numeric coefficients

The first one clearly doesn't give the complete set of solutions. It can be made to work by adding conditions on a such as a>0.

I'm not sure if symbolic operations take index=real[i] into account or just silently ignore it:

limit(RootOf(_Z^3+a*_Z+2, index = real[1]), a = -infinity);
                               0

In fact the root grows as sqrt at -infinity.

 

Hello,

When starting Maple, i get an error message like:

 

All Drivers are up to date, Im running a system Win10-64Bit on a notebook.

 

Has anybody had the same problem?

Thanks in Advance

Download New_ReportGeneration_with_ExcelData.mw

Dear Users,

I have received a congratulations from a Mapleprime user for my post (on Finite Element Analysis - Basics) posted two years earlier. I  did not touch that subject for two years for obvious reasons. Now that a motivation has come, I have decided to post my second application using embedded components. This I was working for the past two years and with the support from Maplesoft technical support team and Dr.RobertLopez. I thank them here for this workbook has come out well to my satisfaction and has given me confidence to post it public.

About the workbook

I have tried to improve the performance of a 2-Stroke gasoline engine to match that of a four stroke engine by using exhaust gas recirculation. Orifice concept is new and by changing the orifice diameter and varying the % of EGR, performance was monitored and data stored in Excel workbook. These data can be imported to Maple workbook by you as you want for each performance characteristic. The data are only my experimental and not authentic for any commercial use.

This Maple workbook generates curves from data for various experiments conducted by modifying the field variables namely Orifice diameter, % Exhaust gas Recirculation and Heat Exchanger Cooling. Hence optimum design selection is possible for best performance.

Thanks for commenting, congratulating or critisising!! All for my learning and improving my Maple understanding!! 

I have just installed jEdit. Have written 2 files.Started with "open in mode  maple". So text gets nicely coloured. Can save the files ok as .mpl. I have several questions
1) How do I make the code indent/format?

2)How should I test the code? Can jEdit show me errors? I am running jEdit and maple side by side. Save, Read, hit bug...

3)How do I format an imported .mpl from maple?

4)How do I get $include to work?

Testr1:=proc(a,b)
description "Jedit test";
local A,B;
A:=a;B:=b;
if is(A<B) then print ('smaller')
elif is(A>B) then print('bigger')
else print('cant_say')
end if;
return cos(A+B), sin(A-B),A,B;
end proc;
TestjEdit:=module()
option pagkage;
export Testr1;
$include "Testr1.mpl"
end module;
#imported file
Antisym := proc (V::{Matrix(3,3,shape = antisymmetric,algebraic), Vector(3)})
local M; description "converts vector to antisymmetric matrix and back"; if 
type(V,Vector) then M := Matrix(3,3,shape = antisymmetric); M[1,2] := -V[3]; M
[1,3] := V[2]; M[2,3] := -V[1] else M := Vector(3,[-V[2,3], V[1,3], -V[1,2]])
end if; M end proc;

restart

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trigonometry"

(1)

read "C:\\Users\\Ronan\\Documents\\jEdit\\Testr1.mpl"

proc (a, b) local A, B; description "Jedit test"; A := a; B := b; if is(A < B) then print('smaller') elif is(B < A) then print('bigger') else print('cant_say') end if; return cos(A+B), sin(A-B), A, B end proc

(2)

"print("'Testr1'")"

(3)

Testr1(2, 4)

cos(6), -sin(2), 2, 4

(4)

Testr1(x, 5)

cos(x+5), sin(-5+x), x, 5

(5)

Testr1(x, x+1)

cos(2*x+1), -sin(1), x, x+1

(6)

restart

read "C:\\Users\\Ronan\\Documents\\jEdit\\TestjEdit.mpl"

$include "Testr1.mpl";
^

Error, while reading ``C:\Users\Ronan\Documents\jEdit\TestjEdit.mpl``

 

TestjEdit:-Testr1(2, 1)

Error, `TestjEdit` does not evaluate to a module

 

``


 

Download Jedit_testing.mw
 

restart

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trigonometry"

(1)

read "C:\\Users\\Ronan\\Documents\\jEdit\\Testr1.mpl"

proc (a, b) local A, B; description "Jedit test"; A := a; B := b; if is(A < B) then print('smaller') elif is(B < A) then print('bigger') else print('cant_say') end if; return cos(A+B), sin(A-B), A, B end proc

(2)

"print("'Testr1'")"

(3)

Testr1(2, 4)

cos(6), -sin(2), 2, 4

(4)

Testr1(x, 5)

cos(x+5), sin(-5+x), x, 5

(5)

Testr1(x, x+1)

cos(2*x+1), -sin(1), x, x+1

(6)

restart

read "C:\\Users\\Ronan\\Documents\\jEdit\\TestjEdit.mpl"

$include "Testr1.mpl";
^

Error, while reading ``C:\Users\Ronan\Documents\jEdit\TestjEdit.mpl``

 

TestjEdit:-Testr1(2, 1)

Error, `TestjEdit` does not evaluate to a module

 

``


 

Download Jedit_testing.mw

 

Is there a way to solve these equations x+y = 373320 and z = (x+y) / 0.44 - y -  y* (1 - 0.99) for x,y,z in Maple or excel?

Even if we set y = 37320 - x 

and plug that in we get z= 37320/0.44 - (37320-x) - (37320 - x) * (1-0.99) there are still two unknown z and x

Maybe some optimization?  Thanx for any input

Would someone be able to explain this strange output?

restart;
sol:=int(1/(x*sin(x)),x);
algsubs(x=t,sol);

How did Maple manage to obtain this? I tried tracing but it did not help me figure it out.  If it is of any help:

int(1/sin(x),x);

It seems algsubs got confused somewhere?

 

 

Maple 2017.2, windows.

 

 

I am learning how to use Threads. I looked for an example code in Start / Programming / Example: Task Model and Multithreaded Programming. I found a MandelBrot code, which I was able to change a value in the If -then statement to run in Threads or no Threads mode. I added a time() function to get a sense of the execution time. The results are about 140s with Threads and 91s with no Threads. I would have thought that the execution time would be smaller in the Threads mode than in the no Threads mode. Did I assume incorrectly that I was creating a Threads and no Threads situations by modifying the if-then statement? Or is this not good example? Here is the code:

Threads_Ex3a.mw

Hi. I would like to learn to use your package. The example  document for it not running (for me). Included a screen shot and my test document. Basicially It would like to import .mpl procedures and use them as the exports of a module/package. I have no experience with code editors and this is the first time I have tried to use the code edit region. Also whathat does the (**) mean/do?

Edit: I redid the documet.

restart

with(CodeBuilder)

[Build, Directory, Export, File, Import, Mint, Read, Regions, Version]

(1)

"Directory("interface('worksheetdir')")"

"C:\Users\Ronan\AppData\Local\Temp\Rtestm"

(2)

Regions()

["Rtestm.mpl", "NewTest.mpl", "NewTest_ModuleApply.mpl"]

(3)

libname

"C:\Program Files\Maple 2017\lib", "C:\Users\Ronan\maple\toolbox\CodeBuilder\lib", "C:\Users\Ronan\maple\toolbox\personal\lib"

(4)
Rtestm := module ()

_m2199891725024

["C:\Users\Ronan\AppData\Local\Temp\Rtestm\Rtestm.mpl", "C:\Users\Ronan\AppData\Local\Temp\Rtestm\NewTest.mpl", "C:\Users\Ronan\AppData\Local\Temp\Rtestm\NewTest_ModuleApply.mpl"]

``

NewTest:=module()

"This is a NEW TEST"

_m2199890918688

``

``

ModuleApply:=proc()

proc () print("This is a NEW TEST") end proc

``

"" CodeBuilder:-Build"('mint','maplet', 'infolevel'=2,  'prefix' = "#!",  'main' = "Rtestm.mpl");"

mint, maplet, infolevel = 2, prefix = "#!", main = "Rtestm.mpl"

(5)

Rtestm:-Rtest()

"this is a test"

(6)

""Rtestm:-NewTest"()"

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry"

(7)

restart

Read*"C:\\Users\\Ronan\\AppData\\Local\\Temp\\Rtestm\\Rtestm.mpl"

Read*"C:\Users\Ronan\AppData\Local\Temp\Rtestm\Rtestm.mpl"

(8)

Rtestm:-Rtest()

Error, Rtest is not a command in the Rtestm package

 

Rtestm:-NewTest()

Error, NewTest is not a command in the Rtestm package

 

``

Download 1-CodeBuilder_Pkg_test.mw

@Joe Riel 

I want ot add an annotation to a plot using the drawing facility. Then I export the plot. My problem is that I cannot increase the viewport of the plot without also increasing the size of the plot. For example the code:

plot(20-(20*(1/10))*P, P = 0 .. 10, labels = ["Q", "P"], scaling = constrained, tickmarks = [5, 3], size = [600, 400])

 

produces this plot:

I have constrained the plot and used the size option which together have the side effect of giving me more horizontal space. But this is a wretched hack! I want to size the viewport of the plot so I can write on it.

 

For sqrt(-1), Maple returns I. Why not -I? I understand why in general Maple does not, and should not, return both signs, because sqrt is defined with a branch cut - specifically out along the negative real axis:

FunctionAdvisor(branch_cuts,sqrt(s));

But as +I and -I lie symmetrically around the branch cut, I do not understand why +I should be chosen in favor of -I. Neither the square of +I or of -I crosses the branch cut, which is,  I guess, the standard way to select a unique value, although both squares end up on the branch cut itself - the latter fact leading to the following more general consideration:

I do not understand why the square root of any negative real number (the above being just a specific case) should at all be assigned any meaning when lying as they do on the branch cut itself. I think it would be more sensible if Maple raised an error, telling you that the branch cut needs to be changed/moved if any value is to be assigned. Which leads me to the following question:

Can the branch cut of the logarithm, and thus of sqrt as well, be changed/moved? I would like it to lie out along the negative imaginary axis.

Update I: Concerning -1 lying on the branch cut itself, there is no issue, see my 'ups' in the reply to the answer by John May. But redefining the branch cut is still relevant.

Update II: Perhaps the issue raised is not all that trivial, after all. At least, it is "a subject of papers and debate", as Alejandro Jakubi formulated it in an email to me, pointing me to the article 'Function evaluation on branch cuts', by Rich and Jeffrey.

I was trying to answer a question by torabi 25, August 14, 2017 to speed up his calculations. I got this idea of converting the original code to a procedure - that was not easy, run the procedure and obtain a value of time() to establish a baseline, and making sure the answer from the procedure was the same as from torabi 25. So far so good. Then I would compile the procedure, execute it, and get another value for time(). Hopefully the compiled procedure will be faster than the uncompiled procedure. I am close, but - please see if you can fix my compiler error. Thanks!


 

restart

pa := proc (k::integer, h::float, N::float, nu::float, E_m::float, E_c::float, rho_m::float, rho_c::float, d::(Matrix()))::float; local lambda_m::float, lambda_c::float, mu_m::float, mu_c::float, Z::float, U::float, S::float, e2::float, f::float, W::float, z::float, b::integer, alpha::integer, beta::integer; lambda_m := nu*E_m/((1+nu)*(1-2*nu)); lambda_c := nu*E_c/((1+nu)*(1-2*nu)); mu_m := E_m/(2+2*nu); mu_c := E_c/(2+2*nu); Z := rho_m+(rho_c-rho_m)*(1/2+z/h)^N; U := lambda_m+(lambda_c-lambda_m)*(1/2+z/h)^N; S := mu_m+(mu_c-mu_m)*(1/2+z/h)^N; e2 := 0.; for alpha from 0 to k-2 do for b from 0 to k-2 do for beta from 0 to k-1 do f := 2*S*d[beta+1, alpha+1]*W(beta)*sqrt(alpha+1/2)*orthopoly:-P(alpha, z)*d[2, b+1]*sqrt(b+1/2)*orthopoly:-P(b, z); e2 := e2-(int(f, z = -(1/2)*h .. (1/2)*h)) end do end do end do end proc

NULL

k := 6; h := 1.; N := .5; nu := .3; E_m := 7.0*10^10; E_c := 3.80*10^11; rho_m := 2702.; rho_c := 3800.; d := Matrix([evalf([0, 0, 0, 0, 0, 0, 0, 0]), evalf([sqrt(3), 0, 0, 0, 0, 0, 0, 0]), evalf([0, sqrt(15), 0, 0, 0, 0, 0, 0]), evalf([sqrt(7), 0, sqrt(35), 0, 0, 0, 0, 0]), evalf([0, sqrt(27), 0, sqrt(63), 0, 0, 0, 0]), evalf([sqrt(11), 0, sqrt(55), 0, sqrt(99), 0, 0, 0]), evalf([0, sqrt(39), 0, sqrt(91), 0, sqrt(143), 0, 0]), evalf([sqrt(15), 0, sqrt(75), 0, sqrt(135), 0, sqrt(195), 0])], datatype = float[8])

time(pa(k, h, N, nu, E_m, E_c, rho_m, rho_c, d))

2.156

(1)

pa(k, h, N, nu, E_m, E_c, rho_m, rho_c, d)

-0.3192307695e12*W(1)+0.4396880666e12*W(3)-0.1474586302e12*W(5)-0.9235575679e11*W(2)+0.1979090107e12*W(4)

(2)

# Original Answer:        -3.192307692*10^11*W(1)+4.396880662*10^11*W(3)-1.474586301*10^11*W(5)-9.235575669*10^10*W(2)+1.979090105*10^11*W(4);NULL

cpa := Compiler:-Compile(pa)

Error, (in Compiler:-Compile) Array parameter types must specify a hardware datatype

 

time(cpa(k, h, N, nu, E_m, E_c, rho_m, rho_c, d))

0.

(3)

cpa(k, h, N, nu, E_m, E_c, rho_m, rho_c, d)

NULL


 

Download for_(5).mw

 

There seems to be a bug with improper integration:

integrate(cos(t)*exp(-x*t),t=-infinity..infinity)

gives

0

Substituting any number for x, or assuming x >= 0  (or x<=0) does give the correct result,

The problem also persists when assuming x>-1 (or x>-Maple_floats(MIN_FLOAT))

mathcontainerUses_Doubt.mw
 

restart; d[1] := [2.36, 26.90], [2.75, 30.0], [3.14, 31.9], [3.53, 32.8], [3.93, 33.4], [4.32, 32.8], [4.71, 31.9]

[2.36, 26.90], [2.75, 30.0], [3.14, 31.9], [3.53, 32.8], [3.93, 33.4], [4.32, 32.8], [4.71, 31.9]

(1)

NULL

d[2] := [2.36, 32.40], [2.75, 34.90], [3.14, 36.90], [3.53, 38.00], [3.93, 38.40], [4.32, 37.8], [4.71, 36.5]

[2.36, 32.40], [2.75, 34.90], [3.14, 36.90], [3.53, 38.00], [3.93, 38.40], [4.32, 37.8], [4.71, 36.5]

(2)

d[3] := [2.36, 27.9], [2.75, 28.3], [3.14, 30.0], [3.53, 30.9], [3.93, 31.3], [4.32, 30.8], [4.71, 29.7]

[2.36, 27.9], [2.75, 28.3], [3.14, 30.0], [3.53, 30.9], [3.93, 31.3], [4.32, 30.8], [4.71, 29.7]

(3)

y := a*x^2+b*x+c; for i to 3 do d[i] := [d[i]]; c[i] := CurveFitting[LeastSquares](d[i], x, curve = y) end do

HFloat(8.047886108501745)+HFloat(11.793324911833839)*x-HFloat(1.5172878997894277)*x^2

(4)

 

curve1 := [c[1], c[2]]; k[1] := [1, 2]; curve1p := [d[1], d[2]]; l[1] := "plot 1"

"plot 1"

(5)

curve2 := [c[2], c[3]]; k[2] := [2, 3]; curve2p := [d[2], d[3]]; l[2] := "plot 2"

"plot 2"

(6)

curve3 := [c[1], c[3]]; k[3] := [1, 3]; curve3p := [d[1], d[3]]; l[3] := "plot 3"

"plot 3"

(7)
Table 1

 

xlabel := "Brake Power"; ylabel := "Efficiency"

"Efficiency"

(8)

p1 := plot(curve1, x = 2.0 .. 5.0, labels = [xlabel, ylabel], labeldirections = ["horizontal", "vertical"], color = [black], linestyle = [1, 2], thickness = [3, 1], title = Title, caption = "Fig. 1 cool  Example 1", legend = ["curve1", "curve2"]); p2 := plot(curve1p, style = point, color = [black], symbol = [soliddiamond, box], symbolsize = 10); plots:-display(p1, p2)

 

p1 := plot(curve2, x = 2.0 .. 5.0, labels = [xlabel, ylabel], labeldirections = ["horizontal", "vertical"], color = [black], linestyle = [1, 2], thickness = [3, 1], title = Title, caption = "Fig. 1 cool  Example 1", legend = ["curve1", "curve2"]); p2 := plot(curve2p, style = point, color = [black], symbol = [box, point], symbolsize = 10); plots:-display(p1, p2)

 

p1 := plot(curve3, x = 2.0 .. 5.0, labels = [xlabel, ylabel], labeldirections = ["horizontal", "vertical"], color = [black], linestyle = [1, 2], thickness = [3, 1], title = Title, caption = "Fig. 1 cool  Example 1", legend = ["curve1", "curve2"]); p2 := plot(curve3p, style = point, color = [black], symbol = [soliddiamond, point], symbolsize = 10); plots:-display(p1, p2)

 

 

"for j from 1 to 3 do  print( Report on l[j]); for i in k[j] do x1(i):=solve((&DifferentialD;)/(&DifferentialD; x)c[i]);  y1(i):=eval( c[i], [x = x1(i)]):  print( Maximum brake thermal efficiency of,y1(i) "%"occurs at brake power value of , x1(i)kW);  end do;  end do;"

Maximum*brake*thermal*efficiency*of, HFloat(30.964188366461613)*"%"*occurs*at*brake*power*value*of, 3.886317459*kW

(9)

NULL


 

Download mathcontainerUses_Doubt.mw

Can any one state the uses of mathcontainer?

1. It can store only one algebraic expression at a time?

2. Can it handle list of algebraic expressions?

3. Can it store list data points (x,y) for a list of curves?

4. Can there be any use for click to edit this component?

More than a simple Yes or No a simple example for each yes answer would be very helpful.

I enclose a document with list of coordinates for for three curves, expression for curve fitting, three expressions derived for these plot points (coordinates), a command for optimum y for each of the three curves (maximum y and corresponding x value), 

Thanks for answering.

Ramakrishnan V

First 30 31 32 33 34 35 36 Last Page 32 of 40