MaplePrimes Questions

I have a say sum(F(k) ,k=1..n)  It fails unless n is an actual integer.  But sum(F(k), k=1..a) works. Then then eval(%,a=n) completes it. That is probably correct but not necessarily a valid assumption. Details in attached. Also it is hard to understand the error message.
 

restart

``

``

Sinta := (k^2+n^2-k)*n/((k^2+n^2-2*k+1)*(k^2+n^2))

(k^2+n^2-k)*n/((k^2+n^2-2*k+1)*(k^2+n^2))

(1)

Ai := sum(Sinta, k = 1 .. n)

-((1/2)*I)*(2*n^2+I*n)*Psi(n-I*n)/(4*n^2+1)+((1/2)*I)*(2*n^2-I*n)*Psi(n+I*n)/(4*n^2+1)+((1/2)*I)*(-2*n^2+I*n)*Psi(n+1-I*n)/(4*n^2+1)-((1/2)*I)*(-2*n^2-I*n)*Psi(n+1+I*n)/(4*n^2+1)+((1/2)*I)*(2*n^2+I*n)*Psi(-I*n)/(4*n^2+1)-((1/2)*I)*(2*n^2-I*n)*Psi(I*n)/(4*n^2+1)-((1/2)*I)*(-2*n^2+I*n)*Psi(1-I*n)/(4*n^2+1)+((1/2)*I)*(-2*n^2-I*n)*Psi(1+I*n)/(4*n^2+1)

(2)

Souta := n/(k^2+n^2-k)

n/(k^2+n^2-k)

(3)

NULL

sum(Souta, k = 1 .. n)

Error, (in assuming) when calling 'Dfnt_4'. Received: 'when calling 'Dfnt_4'. Received: 'when calling 'unknown'. Received: 'invalid input: Dfnt_4 expects its 3rd argument, fpts, to be of type Or(list, piecewise), but received 0'''

 

"(->)"

Error, invalid input: evalf[10] expects 1 argument, but received 0

 

 

 

This works

sum(Souta, k = 1 .. a)

n*Psi(a+1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(a+1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)+n*Psi(1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)

(4)

Ao := eval(%, a = n)

n*Psi(n+1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(n+1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)+n*Psi(1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)

(5)

"(->)"

n*Psi(n+.5000000000-.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)-1.*n*Psi(n+.5000000000+.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)-1.*n*Psi(.5000000000-.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)+n*Psi(.5000000000+.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)

(6)

````

``


 

Download Summation_problem.mw

Hi all, 

Still a new visualisation problem ...
I have two random variables X and Y linked together with a dependency structure named "Gumbel copula" (just a technical stuff, if you prefer replace the bold text by "two correlated gaussian RVs X and Y").

I would like to represent on a same figure:

  • the set {(x[n], y[n]), n=1..N} of a sample of size N drawn from the joint distribution of X and Y
    (a ScatterPlot does this very well, even if I use a plot(..., style =point) in the attached file
     
  • the empirical marginal distribution of X (Histogram), put below the line "y = min({y[n], n=1..N} )" and rotated by 180 degrees
     
  • the empirical marginal distribution of Y (Histogram), put left the line "x = min({x[n], n=1..N} )" and rotated counterclockwise by 90 degrees
     

The attached file gives you two examples.

Ideally, if it's not too much to ask, I would like to have the main axes placed in more adequate locations.
For instance, the option "axes=boxed" reject the axes on the left and bottom boundary of the box which contains the 3 plots (not very astute) ; on the other side the default locations of the axes seem better but one of them "cuts" a histogram ... not very smart.
In fact the position of the axes in the "scatter plot" part is good enough for me and I would like to "add" the two histograms without changing these axes.

Is there a solution to do that (I think I read here a rather close problem where a "zom" of a plot was put within this same plot?) ?
TIA


GumbelCopula.mw

The deltoid plane curve with parameter a  is the set of all points (x, y) in the plane satisfying the equation 
     (1)   (x^2+y^2)^2 - 8ax(x^2 - 3y^2) + 18a^2(x^2+y^2)=27a^4

and the same curve may be described by the parametric equations:

     (2)    
                  x = a (2 cos(t) + cos(2 t))
,      
                  y = a (2 sin(t) - sin(2 t))


(a) Using equation (1) and the command implicitplot graph the deltoid curves with parameters a = 1, 2, and 3 on the same axes.

(b) Using equations (2) and the plot command graph the deltoid curves with parameters a = 1, 2, and 3 on the same axes.

Remark: You will need to do some experimenting with the ranges of the plots and the option numpoints in question (a) to get a decent picture. Note that you can copy and paste equations (1) and (2) and with some judicious editing can save yourself the trouble of typing them. 


      

 

Using spacecurve I've created a diagram of two curves in space, they are reflections in the plane x=y (in this diagram they are labeled k[a1]=k[a2]). How can I add the plane to the diagram?

My intuition is to use 3dplot, and then combine them with display. The problem with that is that 3d plot wants a function of the form z=f(x,y) rather than x=y.

(here is the code for the diagram)

spacecurve({[(5*10^(-4)*100)/C[T], 100*10^(-3)/C[T], C[T]], [100*10^(-3)/C[T], (5*10^(-4)*100)/C[T], C[T]]}, C[T] = 10 .. 100, labelfont = [TIMES, 32], axesfont = [TIMES, 32], titlefont = [TIMES, 32], captionfont = [TIMES, 32], labels = [conjugate(k)[a1], conjugate(k)[a2], conjugate(C)[T]], tickmarks = [[0.1e-2 = k[a1], 5*10^(-3) = 5*k[a1], 10^(-2) = 10*k[a1]], [0.1e-2 = k[a1], 5*10^(-3) = 5*k[a1], 10^(-2) = 10*k[a1]], [0 = 0, 10 = (1/10)*C[T], 50 = (1/2)*C[T], 100 = C[T]]], view = [0 .. 0.1e-1, 0 .. 0.1e-1, 0 .. 100])

I am currently trying to evaluate the performance of different methods for the same calculation and use codegen:cost to give me an overview on the rough computational effort for the results. I stumbled over the function counts not matching my own count in the optimized Matlab code generated by Maple.

Minimal example:

with(codegen):
Fcn1 := sqrt(a):
cost(Fcn1);
Fcn2 := sqrt(sin(q)):
cost(Fcn2);

The first expression gives me "2*functions+multiplications", the second one "3*functions+multiplications".

So my question: Does anyone know, why the square root is counted as two functions while the sine is counted correctly as one?

Good day everyone,

I am trying to write a finite difference Method solution for an ODE and its giving me problem solving the algebraic simplifications generated. Please, any one with useful informations. Below is the attached file

FDM1.mw
 

restart

with(ODETools)

with(student)

with(plots)

with(plottools)

xmin := 0; xmax := 6

n := 60

`σ__1` := .5

ode:=diff(f(eta),eta$3)+f(eta)*diff(f(eta),eta$2)=0

diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta)) = 0

(1)

bc1:=df(xmin)=2*sigma__1;

df(0) = 1.0

(2)

bc2:=d2f(xmin)=0;

d2f(0) = 0

(3)

bc3:=d3f(xmax)=2;

d3f(6) = 2

(4)

dfde:=proc(h)(f[k+1]-f[k-1])/2/h;end proc:

dfde(h);

(1/2)*(f[k+1]-f[k-1])/h

(5)

d2fde2:=proc(h)(f[k+1]-2*f[k]+f[k-1])/h^2;end proc:

d2fde2(h);

(f[k+1]-2*f[k]+f[k-1])/h^2

(6)

d3fde3:=proc(h)(f[k+1]-3*f[k]+3*f[k-1]-f[k-2])/h^3;end proc:

d3fde3(h);

(f[k+1]-3*f[k]+3*f[k-1]-f[k-2])/h^3

(7)

d2fde2f:=proc(h)(f[k+2]-2*f[k+1]+f[k])/h^2;end proc:

d2fde2f(h);

(f[k+2]-2*f[k+1]+f[k])/h^2

(8)

d2fde2b:=proc(h)(f[k]-2*f[k-1]+f[k-2])/h^2;end proc:

d2fde2b(h);

(f[k]-2*f[k-1]+f[k-2])/h^2

(9)

 

dfdef:=proc(h)(f[k+1]-f[k])/h;end proc:

dfdef(h);

(f[k+1]-f[k])/h

(10)

h:=xmax/(n-1)

6/59

(11)

stencil:=subs(diff(f(eta),eta$3)=d3fde3(h),f(eta)=f[k],diff(f(eta),eta$2)=d2fde2,ode);

(205379/216)*f[k+1]-(205379/72)*f[k]+(205379/72)*f[k-1]-(205379/216)*f[k-2]+f[k]*(diff(diff(f[k], eta), eta)) = 0

(12)

bcEqs:=[subs(k=0,dfdef(h))=rhs(bc1),subs(k=0,d2fde2f(h))=rhs(bc2),
subs(k=n-1,d2fde2b(h))=rhs(bc3)];

[(59/6)*f[1]-(59/6)*f[0] = 1.0, (3481/36)*f[2]-(3481/18)*f[1]+(3481/36)*f[0] = 0, (3481/36)*f[59]-(3481/18)*f[58]+(3481/36)*f[57] = 2]

(13)

eqs:=Vector(n-2):
cnt:=0:

for k from 1 to n-2 do
    cnt:=cnt+1:
    eqs(cnt):=stencil;
end do:

eqs:

eqs := [op(convert(eqs, list)), op(bcEqs)]; vars := [seq(f[k], k = 0 .. n-1)]; map(print, eqs)

(205379/216)*f[2]-(205379/72)*f[1]+(205379/72)*f[0]-(205379/216)*f[-1] = 0

 

(205379/216)*f[3]-(205379/72)*f[2]+(205379/72)*f[1]-(205379/216)*f[0] = 0

 

(205379/216)*f[4]-(205379/72)*f[3]+(205379/72)*f[2]-(205379/216)*f[1] = 0

 

(205379/216)*f[5]-(205379/72)*f[4]+(205379/72)*f[3]-(205379/216)*f[2] = 0

 

(205379/216)*f[6]-(205379/72)*f[5]+(205379/72)*f[4]-(205379/216)*f[3] = 0

 

(205379/216)*f[7]-(205379/72)*f[6]+(205379/72)*f[5]-(205379/216)*f[4] = 0

 

(205379/216)*f[8]-(205379/72)*f[7]+(205379/72)*f[6]-(205379/216)*f[5] = 0

 

(205379/216)*f[9]-(205379/72)*f[8]+(205379/72)*f[7]-(205379/216)*f[6] = 0

 

(205379/216)*f[10]-(205379/72)*f[9]+(205379/72)*f[8]-(205379/216)*f[7] = 0

 

(205379/216)*f[11]-(205379/72)*f[10]+(205379/72)*f[9]-(205379/216)*f[8] = 0

 

(205379/216)*f[12]-(205379/72)*f[11]+(205379/72)*f[10]-(205379/216)*f[9] = 0

 

(205379/216)*f[13]-(205379/72)*f[12]+(205379/72)*f[11]-(205379/216)*f[10] = 0

 

(205379/216)*f[14]-(205379/72)*f[13]+(205379/72)*f[12]-(205379/216)*f[11] = 0

 

(205379/216)*f[15]-(205379/72)*f[14]+(205379/72)*f[13]-(205379/216)*f[12] = 0

 

(205379/216)*f[16]-(205379/72)*f[15]+(205379/72)*f[14]-(205379/216)*f[13] = 0

 

(205379/216)*f[17]-(205379/72)*f[16]+(205379/72)*f[15]-(205379/216)*f[14] = 0

 

(205379/216)*f[18]-(205379/72)*f[17]+(205379/72)*f[16]-(205379/216)*f[15] = 0

 

(205379/216)*f[19]-(205379/72)*f[18]+(205379/72)*f[17]-(205379/216)*f[16] = 0

 

(205379/216)*f[20]-(205379/72)*f[19]+(205379/72)*f[18]-(205379/216)*f[17] = 0

 

(205379/216)*f[21]-(205379/72)*f[20]+(205379/72)*f[19]-(205379/216)*f[18] = 0

 

(205379/216)*f[22]-(205379/72)*f[21]+(205379/72)*f[20]-(205379/216)*f[19] = 0

 

(205379/216)*f[23]-(205379/72)*f[22]+(205379/72)*f[21]-(205379/216)*f[20] = 0

 

(205379/216)*f[24]-(205379/72)*f[23]+(205379/72)*f[22]-(205379/216)*f[21] = 0

 

(205379/216)*f[25]-(205379/72)*f[24]+(205379/72)*f[23]-(205379/216)*f[22] = 0

 

(205379/216)*f[26]-(205379/72)*f[25]+(205379/72)*f[24]-(205379/216)*f[23] = 0

 

(205379/216)*f[27]-(205379/72)*f[26]+(205379/72)*f[25]-(205379/216)*f[24] = 0

 

(205379/216)*f[28]-(205379/72)*f[27]+(205379/72)*f[26]-(205379/216)*f[25] = 0

 

(205379/216)*f[29]-(205379/72)*f[28]+(205379/72)*f[27]-(205379/216)*f[26] = 0

 

(205379/216)*f[30]-(205379/72)*f[29]+(205379/72)*f[28]-(205379/216)*f[27] = 0

 

(205379/216)*f[31]-(205379/72)*f[30]+(205379/72)*f[29]-(205379/216)*f[28] = 0

 

(205379/216)*f[32]-(205379/72)*f[31]+(205379/72)*f[30]-(205379/216)*f[29] = 0

 

(205379/216)*f[33]-(205379/72)*f[32]+(205379/72)*f[31]-(205379/216)*f[30] = 0

 

(205379/216)*f[34]-(205379/72)*f[33]+(205379/72)*f[32]-(205379/216)*f[31] = 0

 

(205379/216)*f[35]-(205379/72)*f[34]+(205379/72)*f[33]-(205379/216)*f[32] = 0

 

(205379/216)*f[36]-(205379/72)*f[35]+(205379/72)*f[34]-(205379/216)*f[33] = 0

 

(205379/216)*f[37]-(205379/72)*f[36]+(205379/72)*f[35]-(205379/216)*f[34] = 0

 

(205379/216)*f[38]-(205379/72)*f[37]+(205379/72)*f[36]-(205379/216)*f[35] = 0

 

(205379/216)*f[39]-(205379/72)*f[38]+(205379/72)*f[37]-(205379/216)*f[36] = 0

 

(205379/216)*f[40]-(205379/72)*f[39]+(205379/72)*f[38]-(205379/216)*f[37] = 0

 

(205379/216)*f[41]-(205379/72)*f[40]+(205379/72)*f[39]-(205379/216)*f[38] = 0

 

(205379/216)*f[42]-(205379/72)*f[41]+(205379/72)*f[40]-(205379/216)*f[39] = 0

 

(205379/216)*f[43]-(205379/72)*f[42]+(205379/72)*f[41]-(205379/216)*f[40] = 0

 

(205379/216)*f[44]-(205379/72)*f[43]+(205379/72)*f[42]-(205379/216)*f[41] = 0

 

(205379/216)*f[45]-(205379/72)*f[44]+(205379/72)*f[43]-(205379/216)*f[42] = 0

 

(205379/216)*f[46]-(205379/72)*f[45]+(205379/72)*f[44]-(205379/216)*f[43] = 0

 

(205379/216)*f[47]-(205379/72)*f[46]+(205379/72)*f[45]-(205379/216)*f[44] = 0

 

(205379/216)*f[48]-(205379/72)*f[47]+(205379/72)*f[46]-(205379/216)*f[45] = 0

 

(205379/216)*f[49]-(205379/72)*f[48]+(205379/72)*f[47]-(205379/216)*f[46] = 0

 

(205379/216)*f[50]-(205379/72)*f[49]+(205379/72)*f[48]-(205379/216)*f[47] = 0

 

(205379/216)*f[51]-(205379/72)*f[50]+(205379/72)*f[49]-(205379/216)*f[48] = 0

 

(205379/216)*f[52]-(205379/72)*f[51]+(205379/72)*f[50]-(205379/216)*f[49] = 0

 

(205379/216)*f[53]-(205379/72)*f[52]+(205379/72)*f[51]-(205379/216)*f[50] = 0

 

(205379/216)*f[54]-(205379/72)*f[53]+(205379/72)*f[52]-(205379/216)*f[51] = 0

 

(205379/216)*f[55]-(205379/72)*f[54]+(205379/72)*f[53]-(205379/216)*f[52] = 0

 

(205379/216)*f[56]-(205379/72)*f[55]+(205379/72)*f[54]-(205379/216)*f[53] = 0

 

(205379/216)*f[57]-(205379/72)*f[56]+(205379/72)*f[55]-(205379/216)*f[54] = 0

 

(205379/216)*f[58]-(205379/72)*f[57]+(205379/72)*f[56]-(205379/216)*f[55] = 0

 

(205379/216)*f[59]-(205379/72)*f[58]+(205379/72)*f[57]-(205379/216)*f[56] = 0

 

(59/6)*f[1]-(59/6)*f[0] = 1.0

 

(3481/36)*f[2]-(3481/18)*f[1]+(3481/36)*f[0] = 0

 

(3481/36)*f[59]-(3481/18)*f[58]+(3481/36)*f[57] = 2

(14)

sol := fsolve([op(eqs)])

{f[-1] = 74076407.16, f[0] = 74076407.19, f[1] = 74076407.29, f[2] = 74076407.42, f[3] = 74076407.63, f[4] = 74076407.95, f[5] = 74076408.39, f[6] = 74076408.95, f[7] = 74076409.58, f[8] = 74076410.32, f[9] = 74076411.18, f[10] = 74076412.19, f[11] = 74076413.34, f[12] = 74076414.66, f[13] = 74076416.09, f[14] = 74076417.69, f[15] = 74076419.41, f[16] = 74076421.28, f[17] = 74076423.28, f[18] = 74076425.45, f[19] = 74076427.75, f[20] = 74076430.17, f[21] = 74076432.77, f[22] = 74076435.56, f[23] = 74076438.51, f[24] = 74076441.69, f[25] = 74076445.02, f[26] = 74076448.54, f[27] = 74076452.24, f[28] = 74076456.15, f[29] = 74076460.29, f[30] = 74076464.65, f[31] = 74076469.16, f[32] = 74076473.82, f[33] = 74076478.70, f[34] = 74076483.79, f[35] = 74076489.05, f[36] = 74076494.52, f[37] = 74076500.21, f[38] = 74076506.15, f[39] = 74076512.33, f[40] = 74076518.79, f[41] = 74076525.57, f[42] = 74076532.68, f[43] = 74076540.10, f[44] = 74076547.80, f[45] = 74076555.85, f[46] = 74076564.23, f[47] = 74076572.94, f[48] = 74076581.93, f[49] = 74076591.18, f[50] = 74076600.60, f[51] = 74076610.20, f[52] = 74076620.03, f[53] = 74076630.05, f[54] = 74076640.28, f[55] = 74076650.64, f[56] = 74076661.19, f[57] = 74076671.90, f[58] = 74076682.68, f[59] = 74076693.50}

(15)

``


 

Download FDM1.mw

 

Hello,

      I've been using frontend in conjuction with pdsolve to handle a very large system of PDEs; namely the system has many irrelevant functions that can be frozen with frontend, allowing pdsolve to solve it much quicker.

     However, I ran into a strange case, which I've included in the attached file. Namely, for this particular system of equations, the system is a PDE with respect to t, so I freeze functions of x. However, doing so produces incorrect results (labelled bad) compared to the unfrozen case (labelled good). The frontend command is working as expected (this can be verified by uncommenting the frontend/print commands); it seems that pdsolve is treating the frozen and unfrozen cases differently.

     Any idea why this behavior is occuring? (The obvious solution is to simply not use frontend here; again, I'm using this same code for much larger PDEs and frontend speeds up exceution by an order of magnitude).

Thanks!

MWE.txt

I have a system of nonlinear ODE and I solved them numerically using rkf45. the solution is in time domain and the variables are x, y and z.

I want to convert this solution from time domain to frequency domain. I know that I should do FFT, but I do not know how to do this. 

I tried to do this, but I found that I have to get the solution of x, y and z in the form of vector with respect to time. I am not sure if I understant this problem corectly.

Thanks in advance.

A sphere, radius one unit with centre at the origin of the x, y and z axes is cut along the planes x=0, y=0 and z=0 yielding 8 total pieces, none of which are cubes.

For a sphere radius 2, cut along the planes x=2,y=2,z=2, x=-2,y=-2,z=-2, you get  64 pieces of which 8 are cubes.

Derive an expression for the number of  pieces you will get with a sphere radius integer R, cut along the planes x,y,z=1, x,y,z=-1, x,y,z=2,…     x,y,z=R-1, x,y,z=1-R  

How many of those pieces will be cubes?

The question arose from slicing onions!

A := <<1|2|3>,<0|4|5>,<0|0|6>>;

V :=<1,2,3>;

c :=MatrixVektormutiply(A,v);

 

i want to create a vector for example from 0 to 20 by 0.5 step.and use it in my function would you please suggest me a way for do it.

Thanks All!!!!!!!

Dear Users!

Hope you would be fine. I want to construct system of equations by comparing the likes powers of x^i*y^j*t^k1*exp(k2*eta) for an expression H1 present in attached file. Please see the fix my problem. I shall be very thankful for your kind help. 

Help.mw

Hi all,

I use GraphTheory:-DrawGraph (Maple 2018)
Is there a simple way to suppress or modify the ellipses plotted around a vertex ?

(by "simple" I mean: without using plootools:-getdata and doing some ad hoc modifications)

Thanks for your help


BTW: I'm asking you this because DrawGraph returns poor results in some situations:

with(GraphTheory):
g := Graph({{"azertyuiopqsdfghjklmwxcvbn", 1}, {"azertyuiopqsdfghjklmwxcvbn", 2}}):
DrawGraph(g, style=tree, root="azertyuiopqsdfghjklmwxcvbn")

I would like to use Gröbner's method to study polynomial systems (with equality or (and) inequalities) in the case where the variables are REAL. It is known that in general the problem is much more complicated than in the complex case; in particular it is necessary to use gradient methods.
In Maple, we can use the patch "Raglib" (Lip6 laboratory). However "with (RAG)" does not work very well, even for "simple problems" like this one: the $ 9 $ real unknowns are $ X = [x_ {i, j}] \ in M_3 (\ mathbb {R} $. The  system to satify is $ X ^ TX = I_3, x [1,1] <1 / 2,3 / 10 <x [2,3] $, that is, $6$ polynomial equations and $2$ inequalities; clearly, a particular solution is a permutation of the canonical basis. The "HasRealSolutions" command does not provide any result after 2 hours 15 minutes of calculation. The "PointsPerComponents" command indicates that there are no solutions... 
It seems to me that we can also use "RegularChains" but I am not familiar with this library.

  Have you any ideas on these questions? Thank you in advance.
 

What is incorrect I am getting the error:


 

``

``

restart:

``

y := (diff(tau(t), t))^2

(diff(tau(t), t))^2

(1)

"(&PartialD;)/(&PartialD; (tau)) y"

Error, invalid derivative

"(&PartialD;)/(&PartialD; tau) y"

 

``


 

Download errr.mw

First 796 797 798 799 800 801 802 Last Page 798 of 2428