MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

So for the part of the erdos gallai theorem that says:


\sum^{k}_{i=1}d_i\leq k(k-1)+ \sum^n_{i=k+1} \min(d_i,k)

 

how could I translate this into maple? I'm assuming I'll need to use nested for...dos

If I have a list, how can I write a program to see is that list is graphical? So far I have

graphicalseq := proc (L::list)

local i::integer, N;

N := convert(L, `+`);


if type(N, odd) then print("Sequence is not graphical")


else if numelems(L)-1 < L[1] then print("Sequence is not graphical")
end if;


end if;

end proc;

I know I still have to keep going to determine whether the sequence is graphical, but I'm not sure how.

 I was thinking of trying to somehow use Havel-Hakimi's theorem, but again I'm not sure how. Any hints would be appreciated.  I can't use the is Graph Sequence function

Hi

I have to numerically solve this equation many (tens of thousands) of times for theta_n (as I vary different parameters, especially n):

tan(theta_n) - C_a*Z_0*(-v^2*(Pi*n-theta_n)^2/x_l^2+omega_a^2)*x_l/(v*(Pi*n-theta_n)) = 0

theta_n should be in [-pi/2, pi/2). It seems like solving this is the slowest single component of the chain of calculations (that follow this).

Currently I do it with this function:

get_theta_n_array:=proc(max_n::integer, omega_a::float, v::float, x_l::float, C_a::float, Z_0::float)
    local theta_n_array:=Array(
        select(x->Re(x)<evalf(Pi/2) and Re(x)>=-evalf(Pi/2), [seq(
        #NOTE: careful with fsolve - in some cases returns unevaluated equation
        fsolve(tan(theta_n) - C_a*Z_0*(-v^2*(Pi*n-theta_n)^2/x_l^2+omega_a^2)*x_l/(v*(Pi*n-theta_n)) = 0, theta_n) , n=1..max_n)]
        , real)
        ,datatype=float[8]);
    if ArrayNumElems(theta_n_array) <> max_n then
        printf("Bad Array Dimensions! Got too many or not enough solutions.");
        theta_n_array:="CHECK: get_theta_n_array()": #dirrrrty hack that will ring an alarm bell if array is not the right size
    end;
    theta_n_array;
end;

And call it like so (for say n=1000)

st:=time();
result:=get_theta_n_array(1000, 100e9, 1e8, 0.3, 20e-14, 50.0);
time()-st;

This will take say 3.5s on my PC.

Does anyone have any ideas how to speed this up? I would hope this to take at least an order of magnitude less time. I played with DirectSearch lib but that was not faster.

Also, I should note that this is the only portion of my code that is not thread safe (because of the fsolve call), which leads to "extra" slowdowns because I have to use Grid:-Map, instead of Thread:-Map when parallelizing, and more importantly because I can't compile the rest of the code (Grid:-Map is not compatible with compiled functions).

Let me know if you have any ideas...

thanks!

Hi all.

In the following program, i have normalized bernstein polynomials using gram- schmidt orthogonalization process and want to hybrid them with block pulse functions so that i have:

 

why the program is wrong?? where of it doesn't work properly?

please guide me

best wishes

OHB.mws

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

a := [x+1, x+2, x+3, x+4];

which command can remove polynomial x+2 from the list a;

to become

a := [x+1, x+3, x+4];

How can I find stepwise solution of the following integral?

Int(exp(-xi^2*b^2)*cos(xi^2*a*t)*cos(xi*x), xi = 0 .. infinity)

where xi greek letter.. 

Here was my search strategy to find the answer:

keyboard shortcut execute worksheet on http://www.mapleprimes.com/search/?term=keyboard%20shortcut%20execute%20worksheet

only found one thing http://www.mapleprimes.com/users/erik10/answers

Googled it found 

http://www.maplesoft.com/support/help/maple/view.aspx?path=worksheet%2Freference%2Fhotwin

http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/expressions/executeworksheet

http://scipp.ucsc.edu/~haber/webpage/maple_cheatsheet.pdf

Don't see a keyboard shortcut. 

What is the keyboard shortcut to execute entire worksheet? Is there a name for this action of executing the whole worksheet? 

 

What did you search and click to find the answer? 

Hello everybody,

 

I find a answer on that subject at this link: http://www.mapleprimes.com/maplesoftblog/95508-Monte-Carlo-Pi

But for starting easy, I try this:

with(RandomTools[MersenneTwister]);
directpi := proc (n)
local i, x, y, N;
N := 0;
Digits := 2;
for i to n do
x := GenerateFloat();
y := GenerateFloat();
if x^2+y^2 < 1 then
N := N+1:
end if:
end do:
N;
end proc;


evalf(directpi(4000)/(1000.0), 4);

                             3.176

I would like to know if this code is appropriate and if it is possible to have a random number between -1 to 1 so it will be easier to plot the points in the square with the circle inside.

 

Thank you.

--------------------------------------
Mario Lemelin
Maple 18 Ubuntu 13.10 - 64 bits
Maple 18 Win 7 - 64 bits messagerie : mario.lemelin@cgocable.ca téléphone :  (819) 376-0987

I am Maple 15 student edition user and the packages is not loaded when I use the execute all command from the GUI. I have to manually press the enter key to have by package loaded before I use a function defined in the package. How can I work around this issue?

Thanks

P.S: You can see the Maple document attached to this post.

NumericalSimulation.mw

A := Matrix(3, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 2, (2, 2) = 2, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 6, (3, 3) = 4, (3, 4) = 0});
print(`output redirected...`); # input placeholder
Matrix(%id = 4436610626)
RowSpace(A);
print(`output redirected...`); # input placeholder
RowSpace(Matrix(%id = 4436610626))

 Why is this failing to give the row space? I copied and pasted it from the tutorial on this and it seems to run in the tutorial but not when I copy and paste it outside the tutorial? 

tutorial http://www.maplesoft.com/support/help/maple/view.aspx?path=LinearAlgebra%2FRowSpace

See picture

http://i.imgur.com/eQtEJU4.png?1

 

In general what is the best way to share maple code with users on this forum ? The above copy and paste looks messy. 

 

Hello,

 

A flate metal plate lies on an xy plane such that the temperature T at (x,y) is given by T=10(x^2+y^2)^2 , where T is in degrees and x and y are in centimeters.

Find the instantaneous rate of change of T with respect to distance at (1,2) in the direction of

a) the x-axis

b) the y-axis

I'm trying to solve this system of ODEs by Laplace transform. 

> de1 := d^2*y(t)/dt^2 = y(t)+3*x(t)

> de2 := d^2*x(t)/dt^2 = 4*y(t)-4*exp(t)

with initial conditions 

> ICs := y(0) = 2, (D(y))(0) = 3, x(0) = 1, (D(x))(0) = 2

 

Using 

> deqns := de1, de2

and

> var := y(t), x(t)

 

I need to solve it for both y(t) and x(t), I have tried this by:

> dsolve({ICs, deqns}, var, method = laplace)

And

> dsolve({ICs, deqns}, y(t), method = laplace)

> dsolve({ICs, deqns}, x(t), method = laplace)

 

However I get this error message:

Error, (in dsolve/process_input) invalid initial condition

 

Any help is appreciated

Hi Maple friends.

Maple tends to spit out results(which comprise of variables) in very complicated forms, and I have to use the context menu to select 'simplify' to reduce them.

Is there a setting which will automatically simplify Maple's output?

Thanks in advance.

test.mw

can someone please look at this modified C.Love code, hopefully the problem i'm having is self explanatary.

In Maple 15 is it possible to differentiate with respect to say x - y instead of x

 

Thanks

4 5 6 7 8 9 10 Last Page 6 of 1066