Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

using the code generator assistant I entered the following function

p := proc (z::(float[8]))

local a::integer, accm::(float[8]), k::integer, k1::(float[8]), c;
c := Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], order = C_order, datatype = float[8]);
k1 := 1;
c[1] := evalf(sqrt(2*Pi));
a := 12;
for k to a-1 do c[k+1] := evalf(exp(a-k)*(a-k)^(k-1/2)/k1); k1 := -k1*k end do;
accm := c[1];
for k to a-1 do accm := accm+evalf(c[k+1]/(z+k)) end do;
accm := accm*evalf(exp(-z-a)*(z+a)^(z+1/2));
return accm/z
end proc

the code-generated julia code follows

function input(z)
c = [0,0,0,0,0,0,0,0,0,0,0,0]
k1 = 1
c[0] = (sqrt(2 * pi))
a = 12
for k = 1:a - 1
c[k] = (exp(a - k) * (a - k) ^ (k - 1//2) / k1)
k1 = -k1 * k
accm = c[0]
for k = 1:a - 1
accm = accm + (c[k] / (z + k))
accm = accm * (exp(-z - a) * (z + a) ^ (z + 1//2))
return(accm / z)
end

two things are wrong

1: no end after loop end

2: array index starts at 0, it should be 1 and of course the array references should reflect that

 

btw, it would be nice to be able to enter code tags like [code] code here [/code]

OnesM:=Matrix(`%id`=119376536)

 

Anyone can solve this??

 

 

Many thanks!

I'm running calculations like this:

    N:=10000;
    f := (i,j)-> (some complicated procedure depending on i and j);
    M:= Matrix([Threads:-Seq([Threads:-Seq( f(i,j), j=1..N)], i=1..N)]);

I have a server with 20 cores, but each core has two threads, so this code should max out all 40 threads. But what I notice is only at most 20 threads being used at a time. 

I checked kernelopts(numcpus) returns 20. 

Does anyone have any advice on how to maximize my resource usage?

Hello,

Still on the thematic on simplification of trigonometric expression.

I would like to simplify this equation. Normally, for a mecanical point of view, this equation could be simplified a lot and namely the psi[1](t) and theta[1](t) variables should disappear.

The difference with the former posts is the fact that now each term (for example  2*sin(gamma0(t))*z0(t)*cos(beta0(t))*xb[1]) can regroup 2 terms in factor with the trigonometric part.

eq:=l2[1]^2 = 2*sin(gamma0(t))*z0(t)*cos(beta0(t))*xb[1]-2*sin(gamma0(t))*zp[1](t)*cos(beta0(t))*xb[1]+2*sin(gamma0(t))*y0(t)*sin(alpha0(t))*zb[1]-2*sin(gamma0(t))*yp[1](t)*sin(alpha0(t))*zb[1]+2*sin(gamma0(t))*x0(t)*cos(alpha0(t))*zb[1]-2*sin(gamma0(t))*xp[1](t)*cos(alpha0(t))*zb[1]-2*cos(gamma0(t))*z0(t)*cos(beta0(t))*zb[1]+2*cos(gamma0(t))*zp[1](t)*cos(beta0(t))*zb[1]+2*cos(gamma0(t))*y0(t)*sin(alpha0(t))*xb[1]-2*cos(gamma0(t))*yp[1](t)*sin(alpha0(t))*xb[1]+2*cos(gamma0(t))*x0(t)*cos(alpha0(t))*xb[1]-2*cos(gamma0(t))*xp[1](t)*cos(alpha0(t))*xb[1]+2*y0(t)*cos(alpha0(t))*cos(beta0(t))*yb[1]-2*yp[1](t)*cos(alpha0(t))*cos(beta0(t))*yb[1]-2*x0(t)*sin(alpha0(t))*cos(beta0(t))*yb[1]+2*xp[1](t)*sin(alpha0(t))*cos(beta0(t))*yb[1]-2*sin(psi[1](t))*cos(theta[1](t))*l3[1]*xb[1]+2*sin(psi[1](t))*sin(theta[1](t))*l3[1]*zb[1]-2*cos(theta[1](t))*cos(psi[1](t))*l3[1]*zb[1]-2*cos(psi[1](t))*sin(theta[1](t))*l3[1]*xb[1]-2*sin(gamma0(t))*y0(t)*sin(alpha0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]-2*sin(gamma0(t))*yp[1](t)*sin(alpha0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]+2*sin(gamma0(t))*yp[1](t)*sin(alpha0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]+2*sin(gamma0(t))*x0(t)*cos(alpha0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]-2*sin(gamma0(t))*x0(t)*cos(alpha0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]-2*sin(gamma0(t))*xp[1](t)*cos(alpha0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]+2*sin(gamma0(t))*xp[1](t)*cos(alpha0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]-2*cos(gamma0(t))*z0(t)*cos(beta0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]+2*cos(gamma0(t))*z0(t)*cos(beta0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]+2*cos(gamma0(t))*zp[1](t)*cos(beta0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]-2*cos(gamma0(t))*zp[1](t)*cos(beta0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]-2*cos(gamma0(t))*y0(t)*sin(alpha0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]-2*cos(gamma0(t))*y0(t)*sin(alpha0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+2*cos(gamma0(t))*yp[1](t)*sin(alpha0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]+2*cos(gamma0(t))*yp[1](t)*sin(alpha0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]-2*cos(gamma0(t))*x0(t)*cos(alpha0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]-2*cos(gamma0(t))*x0(t)*cos(alpha0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+2*cos(gamma0(t))*xp[1](t)*cos(alpha0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]+2*cos(gamma0(t))*xp[1](t)*cos(alpha0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+yb[1]^2+xb[1]^2+zb[1]^2+l3[1]^2+z0(t)^2+zp[1](t)^2+y0(t)^2+yp[1](t)^2+x0(t)^2+xp[1](t)^2+2*z0(t)*sin(beta0(t))*yb[1]-2*zp[1](t)*sin(beta0(t))*yb[1]-2*z0(t)*zp[1](t)-2*y0(t)*yp[1](t)-2*x0(t)*xp[1](t)-2*sin(gamma0(t))*y0(t)*cos(alpha0(t))*sin(beta0(t))*xb[1]+2*sin(gamma0(t))*yp[1](t)*cos(alpha0(t))*sin(beta0(t))*xb[1]+2*sin(gamma0(t))*x0(t)*sin(alpha0(t))*sin(beta0(t))*xb[1]-2*sin(gamma0(t))*xp[1](t)*sin(alpha0(t))*sin(beta0(t))*xb[1]+2*cos(gamma0(t))*y0(t)*cos(alpha0(t))*sin(beta0(t))*zb[1]-2*cos(gamma0(t))*yp[1](t)*cos(alpha0(t))*sin(beta0(t))*zb[1]-2*cos(gamma0(t))*x0(t)*sin(alpha0(t))*sin(beta0(t))*zb[1]+2*cos(gamma0(t))*xp[1](t)*sin(alpha0(t))*sin(beta0(t))*zb[1]-2*sin(gamma0(t))*z0(t)*cos(beta0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]-2*sin(gamma0(t))*z0(t)*cos(beta0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+2*sin(gamma0(t))*zp[1](t)*cos(beta0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]+2*sin(gamma0(t))*zp[1](t)*cos(beta0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+2*sin(gamma0(t))*y0(t)*sin(alpha0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]+2*sin(gamma0(t))*y0(t)*cos(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]+2*sin(gamma0(t))*y0(t)*cos(alpha0(t))*sin(beta0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]-2*sin(gamma0(t))*yp[1](t)*cos(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]-2*sin(gamma0(t))*yp[1](t)*cos(alpha0(t))*sin(beta0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]-2*sin(gamma0(t))*x0(t)*sin(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]-2*sin(gamma0(t))*x0(t)*sin(alpha0(t))*sin(beta0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+2*sin(gamma0(t))*xp[1](t)*sin(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*cos(theta[1](t))*l3[1]+2*sin(gamma0(t))*xp[1](t)*sin(alpha0(t))*sin(beta0(t))*cos(psi[1](t))*sin(theta[1](t))*l3[1]+2*cos(gamma0(t))*y0(t)*cos(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]-2*cos(gamma0(t))*y0(t)*cos(alpha0(t))*sin(beta0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]-2*cos(gamma0(t))*yp[1](t)*cos(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]+2*cos(gamma0(t))*yp[1](t)*cos(alpha0(t))*sin(beta0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]-2*cos(gamma0(t))*x0(t)*sin(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]+2*cos(gamma0(t))*x0(t)*sin(alpha0(t))*sin(beta0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]+2*cos(gamma0(t))*xp[1](t)*sin(alpha0(t))*sin(beta0(t))*sin(psi[1](t))*sin(theta[1](t))*l3[1]-2*cos(gamma0(t))*xp[1](t)*sin(alpha0(t))*sin(beta0(t))*cos(theta[1](t))*cos(psi[1](t))*l3[1]

Do you have some ideas so as to simplify this equation ?

N.B : Former posts on the topic of trigonometric simplification

http://www.mapleprimes.com/questions/209884-Simplification-Of-Trigonometric-Expression-II

http://www.mapleprimes.com/questions/209721-Simplification-Of-Trigonometric-Expressions

I put a worksheet attached in order to facilitate the troubleshooting.

Thanks a lot for your help

trigonometric_simplification.mw

 

Hi. I'm hacing trouble writing a maple procedure for the question below, can anyone help?

 

Write a maple procedure which takes as its input the vectoeat u1 and u2 and the eigenvectors lambda1 and lambda2 where u1,u2 are element of R^2 and the lambdas are real numbers.

If u1,U2 is linearly independent then the output is the matrix A an element of R^2x2 with the property that Au1= lambda1u1 and AU2=lambda2u2;

if u1,u2 is linearly dependent then the output is the statement "not an eigenbasis".

 

I I then have two inputs which I have to do but I'm not sure on how to write the procedure. Any help will be much appreciated.  

 

Thanks :)

 

 

Dear all,

I developed a program to solve f(x, y) = 0 and g(x, y) = 0, I obtained as results (x=2.726, y=2.126) . running the same program another time it gives (x=2.762, y=1.992). how to explain this?

> fsolve({f(x, y) = 0, g(x, y) = 0}, {x = 0 .. infinity, y= 0 .. infinity});

Thanks in advance.

after solved, 

diff(a(t), t) = diff(a(t), t)

diff(b(t), t) = 0

diff(c(t), t) = -b(t)/c(t)

 

there is a diff(a(t), t) term 

how to plot this kind of system?

can diff(a(t), t) be ignore so that only consider two equations, diff(b(t),t) and diff(c(t),t) ?

if so, i use below to plot, it can not show the arrow clearing , i can only see arrow near origin, but not far point

with(plots):
fieldplot([0, y/x], x = -2 .. 2, y = -2 .. 2);
fieldplot([0, y/x], x = -2 .. 2, y = -2 .. 2, arrows = SLIM,grid = [1, 1]);
fieldplot([0, y/x], x = -10 .. 10, y = -10 .. 10);

 about how to calculate vector field of system of 3 differential equations which in terms of a(t), b(t), c(t) , diff(a(t),t), diff(b(t),t), diff(c(t),t)?

is the only method is the express diff(a(t),t), diff(b(t),t), diff(c(t),t) in terms of a(t), b(t), c(t) ?

for example 

<diff(a(t),t), diff(b(t),t), diff(c(t),t)>

if result is

diff(a(t),t) = a(t)*b(t)

diff(b(t),t) =b(t)*c(t)

diff(c(t),t) =c(t)*a(t)

<a(t)*b(t), b(t)*c(t), c(t)*a(t)>

then

is it the vector field <a*b, b*c, c*a> ?

 

When I put maximize(cos(t)), everything is fine.

When I put maximize(cos(Pi)), everything is fine.

When I put maximize(cos(t*Pi)), it says invalid limiting point??? What went wrong?

 

I'm looking for the 3-D integral formulae for Convolution, and Cross Correlation, between pairs of functions, which are each in spherical polar coordinates, for implementation in a MAPLE worksheet. Each function is normalized and symmetric around the origin.

Thank you for your consideration.

sys := {diff(b(t),t) = 0,diff(c(t),t) = -b(t)/a(t)};
DEplot(sys, [b(t),c(t)], t=0..5, x=-5..5, y=-5..5);
Error, (in DEtools/DEplot) Option keyword (x) was not in the allowed set of options, consisting of: iterations, arrows, dirgrid, obsrange, scene, colour, linecolour, stepsize, a dependent variable range, a list of initial conditions or one of the allowed plot options: {animate, axes, color, colour, coords, font, scaling, style, symbol, title, view, animatecurves, animatefield, axesfont, dirfield, labelfont, linestyle, numframes, resolution, thickness, tickmarks, titlefont, xtickmarks, ytickmarks}, or one of the allowed dsolve/numeric options: {abserr, control, ctrl, initial, itask, maxder, maxfun, maxkop, maxord, maxpts, maxstep, method, mi..

diff(a(t), t) = diff(a(t), t);
diff(b(t),t) = 0;
diff(c(t),t) = -b(t)/a(t);

[diff(rhs(sol[1][2]), a(t)),diff(rhs(sol[1][2]), b(t)),diff(rhs(sol[1][2]), c(t))];
Error, (in VectorCalculus:-diff) invalid input: diff received a(t), which is not valid for its 2nd argument

 

 

hey guys Im new client in maple and today I was about check out the resualt of my mathematic quastion with maple.

I need a step by step solution and exact command to give me true resualts 

for example 

how can I expand a factorization like (x^2-y^2) to (x-y)(x+y)

in a little more  complicated form (cd-1)^2-(c-d)^2/(d^2)(c-1)=5 the value of c=?

for solve this problem I need to expand (cd-1)^2-(c-d)^2 than other expands & in the end value of c

I dont have anymore time for my mathemathic exam so know that how maple works in basic and intermadiate mathematic level is important to me

thank you guys

 

 

eq2 := b(t)*(diff(c(t), t))*(diff(a(t), t))+b(t)*(diff(a(t), t))+a(t)*(diff(c(t), t));
eq3 := a(t)*(diff(b(t), t))(diff(a(t), t))+b(t)*(diff(b(t), t))*(diff(c(t), t));
eq4 := b(t)*(diff(c(t), t))(diff(b(t), t))+a(t)*(diff(b(t), t))+b(t)*(diff(c(t), t));
dfieldplot([eq2,eq3,eq4],[t,x],t=0..5,a=-5..5,b=-5..5,c=-5..5);
dfieldplot([eq2,eq3],[t,x],t=0..5,a=-5..5,b=-5..5);
eq2a := eval(subs(c(t)=exp(t), eq2));
eq3a := eval(subs(c(t)=exp(t), eq3));
eq4a := eval(subs(c(t)=exp(t), eq4));
dfieldplot([eq2a,eq3a], [a(t), b(t)], t = -5 .. 5, a = -5 .. 5, b = -5 .. 5, arrows = SLIM, color = black, dirfield = [10, 10]);

Hey,

I think I found a bug concerning the useage of assume and alias:

restart:

alias(a=a(t),b=b(t));

a, b

(1)

assume(a(t),real);

getassumptions(a(t));

{((a(t))(t))::real}

(2)

assume(b(t),real);

getassumptions(a(t));

{((b(t))(t))::real}

(3)

getassumptions(b(t));

{((b(t))(t))::real}

(4)

 

 

 

Commenting out the alias command produces correct results. I am on linux with build 922027.

alias_bug.mw

First 150 151 152 153 154 155 156 Last Page 152 of 2097