MaplePrimes Questions

I have the command;

> restart: Digits:=20: N:=10000: M:=100: x_max:=1: r_min:=2.5:
> r_max:=4: for n from 0 to N do r:=r_min+n/N*(r_max-r_min):
> x:=evalf(x_max*rand()/10^12):for m from 0 to M do x:=r*x*(1-x): od:
> X[n]:=x: od:
> with(plots):
> bifpoint:=[seq([r_min+j/N*(r_max-r_min),X[j]],j=0..N)]:
> pitchf:=pointplot(bifpoint,symbol=point):display(pitchf);

 

This plots the bifurcation diagram for the logistic model f(x) = r*x*(1-x).

How do i plot the bifurcation diagram for f(x) = r*(8 - 2*x^2). 

I've tried just replacing the function but it does not work.

 

 

we were given a function that counts the number of primes among the arguments after the
rst and returns the result in the rst argument. When calling this, you must make sure
that the rst argument is a name. 

this is it.

cp := proc (YY) local count, i ;
print("nargs=", nargs, "args=", args) ;
count := 0 ;
for i from 2 to nargs do
if isprime(args[i]) then
count := count+1 ;
end if ;
print("i=", i, "count=", count) ;
end do ;
print("count=", count) ;
YY := count ;
end proc ;

EX: cp('noprimes',2,4,5,6,7,9,19)

and this works grand, but then we were given this function with slight adjustments to it and asked to fix it. the hints we were given were to try and forve evaluation at the right places.

This is the function we have to fix...

xcp := proc (count) local i;
print("nargs=", nargs, "args=", args) ;
count := 0 ;
for i from 2 to nargs do
if isprime(args[i]) then
count := count+1 ;
end if ;
print("i=", i, "count=", count) ;
end do ;
print("count=", count) ;
end proc ;

 

any help is appreciated!

Greetings to all.

I have run into a curious numeric event while computing Master theorem recurrences at this math.stackexchange.com link.

I do have to say that this one has me worried. I am referring to Maple 15 (X86 64 LINUX).

Try the following program in a new Maple session.

T := proc(n)
option remember;
    if n = 0 then return 0 end if; 9*T(floor(1/3*n)) + n*(1 + ilog[3](n))^3
end proc;

T_ex := proc(n)
local m, d;
option remember;
    d := convert(n, base, 3);
    m := ilog[3](n);
    add(3^j*(1 + m - j)^3*add(d[k + 1]*3^k, k = j .. m), j = 0 .. m)
end proc;

T(3^22-1)-T_ex(3^22-1);

The result is the following error message:

Error, (in T_ex) invalid subscript selector

Now try it again, in a new Maple session, but enter the following command first.

Digits := 50;

Now the result is

0

Consider the following program:

T := proc(n)
option remember;
    if n = 0 then return 0 end if; 9*T(floor(1/3*n)) + n*(1 + ilog[3](n))^3
end proc;

T_upper := proc(n)
local m;
option remember;
    m := ilog[3](n); 3^(2*m + 2)*sum(3^(-j)*j^3*(1 - 3^(-j)), j = 1 .. m + 1)
end proc;

T(3^22-1)-T_upper(3^22-1);

The result is

-30454808964204479209326

But if you precede the program with the command

Digits:=50;

the result is once more

0

This is reproducible (restart Maple every time) and quite frankly, seems rather serious to me. Could someone please look into this.

 

Marko Riedel

Hi. I'd like to find the solution closest to zero for sum(abs(f(k, m, n)+g(k, m, n)), n = i .. j) , when a < m, n < b . 

Have trouble wrapping my head around how to do that and would appreciate any help.

Even better would be to find a solution where the maximum absolute value of f(k, m, n) + g(k, m, n) is minimized for n = i .. j) and when a < m, n < b , but I'm guessing the sum would be easier, and close enough.

Maybe I'm barking up the wrong tree getting this done with Maple, but I'm hopeful.

Thank you for looking

Dear experts;

How can I solve this problem with maple?

restart:


 X[3](0):=6.3096*10^9;
 c:=0.67;
 d:=3.7877*10^(-8);
 delta:=3.259*d;
 lambda:=(2/3)*10^8*d;
 R[0]:=1.33;
 p:=(c*X[3](0)*delta*R[0])/(lambda*(R[0]-1));
beta:=(d*delta*c*R[0])/(lambda*p);

ode:=diff(x[1](t), t)=(lambda-d*x[1](t)-(1-beta*x[1](t)*x[3](t)*(psi[1](t)-psi[2](t))/A[1])*beta*x[1](t)*x[3](t)),
 diff(x[2](t), t) =((1-beta*x[1](t)*x[3](t)*(psi[1](t)-psi[2](t))/A[1])*beta*x[1](t)*x[3](t)-delta*x[2](t)),
 diff(x[3](t), t) =((1+psi[3](t)*p*x[2](t)/A[2])*p*x[2](t)-c*x[3](t)),diff(psi[1](t), t) =-1+1/A[1]*beta^2*x[1](t)*(x[3](t))^2*(psi[1](t)-psi[2](t))^2-psi[1](t)*(-d+beta^2*(x[3](t))^2*(psi[1](t)-psi[2](t))/A[1]*x[1](t)-(1-beta*x[1](t)*x[3](t)*(psi[1](t)-psi[2](t))/A[1])*beta*x[3](t))-psi[2](t)*(-beta^2*(x[3](t))^2*(psi[1](t)-psi[2](t))/A[1]*x[1](t)+(1-beta*x[1](t)*x[3](t)*(psi[1](t)-psi[2](t))/A[1])*beta*x[3](t)),
 diff(psi[2](t), t) =1/A[2]*psi[3](t)^2*p^2*x[2](t)+psi[2](t)*delta-psi[3](t)*(psi[3](t)*p^2/A[2]*x[2](t)+(1+psi[3](t)*p*x[2](t)/A[2])*p),
 diff(psi[3](t), t) = 1/A[1]*beta^2*(x[1](t))^2*x[3](t)*(psi[1](t)-psi[2](t))^2-psi[1](t)*(beta^2*(x[1](t))^2*(psi[1](t)-psi[2](t))/A[1]*x[3](t)-(1-beta*x[1](t)*x[3](t)*(psi[1](t)-psi[2](t))/A[1])*beta*x[1](t))-psi[2](t)*(-beta^2*(x[1](t))^2*(psi[1](t)-psi[2](t))/A[1]*x[3](t)+(1-beta*x[1](t)*x[3](t)*(psi[1](t)-psi[2](t))/A[1])*beta*x[1](t))+psi[3](t)*c;

ics := x[1](0)=5.5556*10^7, x[2](0)=1.1111*10^7,x[3](0)=6.3096*10^9,psi[1](100)=0,psi[2](100)=0,psi[3](100)=0;

dsolve([ode, ics],numeric);?????????????????????????

Please help me

ode.mws

Hi every one,

Q1:

I tried to get the max $ min of a following function:

 

l:=1:alpha:=1:b:=100:k:=20:

eq1 := (alpha+(l+alpha)*u+alpha*k*u^2)*a =
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2))):

I did this code but it seems it didnt work for this equation

maximize(eq, u=1..12, location);

minimize(eq, u=1..12, location);

Also, I think about solving the cubic i feel i'm so close to the solve but couldn't

factor((rhs-lhs)(eq1));

eq:=collect(%,u);

Q:=(a,u)->eq;sol:=evalf(solve(Q(a,u),u)): S:=array([],1..3): S[1]:=sol[1]:S[2]:=sol[2]:S[3]:=sol[3]:

Q2:

the same thing wanted to get the maximum and the minimum of the function v

here the code

restart;
eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=v=alpha*b*(1+u+k*u^2)/(alpha+(l+alpha)*u+alpha*k*u^2);
factor((rhs-lhs)(eq1));
eq1:=collect(%,u);
params:={l=10,alpha=0.5,b=100,k=20};
U:=[solve(eval(eq1,params),u)]; #3 solutions for u
#plots:-complexplot(U,a=0..20,style=point); #plot in the complex u-plane
vua:=eval(solve(eq2,v),params): #v expressed in terms of u and a
V:=eval~(vua,u=~U): #the 3 solutions for v in terms of a

## PLOT the function V
plot(V,a=0..75,v=0..100,color=black,labels=[a,v],axes=boxed,numpoints=90,linestyle=1,font=[1,1,18],thickness=2,tickmarks=[4,4],view=[0..65,25..100]);

I do appricaited any advises

function [y g] = ques5
% using Simpson Formula to approximate the integration
% input:
% f(x): [a b]


end
% use Euler formula to compute function y
for i = 1:N
    if i ==1

legend('numerical y','exact y','numerical g','exact g')

function g = f2g(a,b)
% f(x) = x
g = (b-a)/6*(a + 4*(a+b)/2 + b);


ican use matlab to solve this problem but not maple
please help

Minimize doesn't work with dsolve porcedure?

experiment_real.mw

tr := proc (x, y)::integer; tr := x+y; result := x^(2+y) end proc

Warning, `result` is implicitly declared local to procedure `tr`

 

tr(5, 5)

78125

(1)

with(Optimization); Minimize(tr(x, y), x = 0 .. 1000, y = 1 .. 1, initialpoint = {x = 25, y = 1})

[0.117556065072605623e-15, [x = HFloat(4.898709434833346e-6), y = HFloat(1.0)]]

(2)

xxx := 97.39391293; yyy := -1.588898710

-1.588898710

(3)

xx := 100;

3

(4)

trool := proc (leng, alpha)::integer; global psi, zx, zy, xx, yy, xxx, yyy, sa, ca, ps, Vx, Vy, vx, vy, ode, ics, XX, YY, trool, G, str, start, ds; sa := evalf(sin(alpha)); ca := evalf(cos(alpha)); ps := evalf(evalc(Im(evalc(str*(x+I*y)-((1/2)*I)*G*ln(x+I*y-start)/Pi)))); psi := ps; xxx := evalf(xx+leng*ca); yyy := evalf(yy+leng*sa); Vx := diff(psi, y); Vy := -(diff(psi, x)); vx := Re(evalf(subs(x = xxx, y = yyy, subs(vvx = Vx, vvx)))); vy := Re(evalf(subs(x = xxx, y = yyy, subs(vvy = Vy, vvy)))); proc (X) options operator, arrow; X(t) end proc; proc (Y) options operator, arrow; Y(t) end proc; zx := proc (t) options operator, arrow; evalf(subs(x = X(t), y = Y(t), subs(vvx = Vx, vvx))) end proc; zy := proc (t) options operator, arrow; evalf(subs(x = X(t), y = Y(t), subs(vvy = Vy, vvy))) end proc; ode := diff(X(t), t) = zx(t), diff(Y(t), t) = zy(t); ics := X(0) = xxx, Y(0) = yyy; ds := dsolve([ode, ics], type = numeric, [X(t), Y(t)], method = rkf45, maxfun = 0, output = listprocedure, abserr = 0.1e-3, relerr = 0.1e-3, minstep = 0.1e-1); XX := rhs(ds[2]); YY := rhs(ds[3]); trool := XX(0.1e-3) end proc:

with(Optimization); Minimize(trool(alpha, leng), assume = nonnegative, alpha = 0 .. 2*Pi, leng = .2 .. 2, iterationlimit = 1000, initialpoint = {alpha = 1, leng = 1})

Error, (in XX) parameter 'alpha' must be assigned a numeric value before obtaining a solution

 

alpha = 0 .. 2*Pi, leng = .2 .. 2, output = solutionmodule

alpha := 1; leng := 1; XX(10)

HFloat(100.54666738117751)

(5)

``

trool(1, 11)

HFloat(100.00711298362239)

(6)

psi

3.*y-11.93662073*ln((x-100.)^2+y^2)

(7)

``

 

Download experiment_real.mw

with trool procedure minimize dosent work .... and its make me realy sad, couse i need to optimize alpha and leng in other (big one) porcedure with same dsolve.

get this errors:
"Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)"
"Error, (in XX) parameter 'alpha' must be assigned a numeric value before obtaining a solution"

after running the code below, run

f2:=[ x3^2, x3*x2];
g2:=[0,-1,1];
h2:=[x1,0,0];
Lf2h := Lfh(1,h2,f2, varlist);

got


Error, (in Lfh) invalid subscript selector

can not see where is wrong

 

Code:

 

restart;

with(combinat):

list1 := permute([a, b, a, b, a, b], 3);

list1a := subs(b=1,subs(a=0, list1));

n := 3;

list1a := permute([seq(seq(k,k=0..1),k2=1..n)], n);

list2 := permute([a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h], 3);

list3 := subs(h=18,subs(g=17,subs(f=16,subs(e=15,subs(d=14,subs(c=13,subs(b=12,subs(a=11,list2))))))));

list3 := permute([seq(seq(k,k=11..18),k2=1..3)], 3);

Iter:= iterstructs(Permutation([seq(seq(k,k=11..(10+nops(list1a))),k2=1..3)]), size=3):

list3b := [];

while not Iter[finished] do

     p:= Iter[nextvalue]();

     list3b := [p, op(list3b)];

end do:

list5 := Matrix(nops(list1a)*nops(list3), 1);

count := 1;

for n from 1 to nops(list3) do

        temp1 := subs(1=list1a[1],list3[n]);

        for k from 11 to nops(list1a)+10 do

                temp1 := subs(k=list1a[k-10],temp1);

        od;

        list5[count] := temp1;

        count := count + 1;

od;

Lfh := proc(numoflevel, hx, fx, var)

if numoflevel = 1 then

        hello := 0;

        for kk from 1 to nops(var) do

                hello := hello + diff(hx[kk], var[kk])*fx[kk];

        od;

        return hello;

else

        hello := 0;

        for kk from 1 to nops(var) do

                hello := hello + diff(Lfh(numoflevel-1, hx, fx, var), var[kk])*fx[kk];

        od;

        return hello;

end if;

end proc:

CheckRelativeRankZero := proc(h1, f1, g1,variables1,Count)

IsFinish := 0;

for ii from 1 to 8 do

        if IsFinish = 0 then

        Lf2h := Lfh(ii,h1,f1,variables1);

        Lgf2h := Lfh(1,[seq(Lf2h,n=1..nops(variables1))],g1,variables1);

        if Lgf2h = 0 then

                print(f1);

                print(Lf2h);

                print("find at ", ii);

                IsFinish := 1;

                return Lf2h;

        end if;

        end if;

od;

return 0;

end proc:

IsZeroMatrix := proc(h1)

Iszero := 1;

for ii from 1 to 3 do

for jj from 1 to 3 do

        if h1[ii][jj] <> 0 then

                        Iszero := 0;

        end if

        od;

od;

return Iszero;

end proc:

with(combstruct):

list6:= convert(list5, list):

list7 := [];

for ii from 1 to nops(list6) do

if list6[ii] <> 0 then

        list7 := [list6[ii], op(list7)];

        end if;

od;

with(LinearAlgebra):

with(VectorCalculus):

varlist := [x1, x2, x3];

Iter:= iterstructs(Permutation(list7), size=2):

Count := 1;

http://homepages.lboro.ac.uk/~makk/MathRev_Lie.pdf

ode1 := Diff(f(x),x$2)+2*Diff(f(x),x)+f(x);
with(DEtools):
with(PDETools):
gen1 := symgen(ode1);
with(PDEtools):
DepVars := ([f])(t);
NewVars := ([g])(r);
SymmetryTransformation(gen1, DepVars, NewVars);

Error, invalid input: too many and/or wrong type of arguments passed to PDEtools:-SymmetryTransformation; first unused argument is [_xi = -x, _eta = f*x]


generator1 := rhs(sym1[3][1])*Diff(g, x)+ rhs(sym1[3][2])*Diff(g, b)

what is X1 and X2 so that [X1, X2] = X1*X2 - X2*X1 = (X1(e2)-X2(e1))*Diff(g, z) ?

is it possible to use lie group to represent a differential equation, and convert this group back to differential equation ? how do it do?

 

how to find symmetry z + 2*t*a, when you do not know before taylor calcaulation?

fza := z + 2*t*a;
fza := x;
fza := z + subs(a=0, diff(fza,a))*a;

I want  to verify the following function expression

is indeed an antiderivative of the function expression

where  A>0 with B^2-4*A*C<0.

I have tried the command

>diff((2),x);simplify(%);

where (2) is the label of the antiderivative expression.  But the result is very awkarward and lengthy. How could I verify the antiderivative expression is indeed an antiderivative of the other function by using Maple 17? 

 

How can I've shaded region with non-linear inequality, I have some potential function like V(r)=(1-2Me-2lr+q2e-4lr) and I want to shade area between this & x-axis,

when I'm doing it with inequlityplot, it says that inequality should be linear.

Hello,


First of all, I've searched already a bit around, but couldn't find a similar topic, so I thought I'd open a new one. Also, English isn't my main language, so terminology may be wrong, but I hope you'll still understand what I want to say.

So, I have this procedure:

restart;
functions:= proc(n)
local L, list, p, f, sum, i, part, g, normg, x:
L:=1/sqrt(2):
list:=[L]:

for p from 2 to n do
f := x**(p-1):
sum := 0:

for i from 1 to (p-1) do
part:= int(list[i]*f*(x+1),x=-1..1)*list[i]:
sum := sum + part:
end do:

g:= f-sum:
normg:= sqrt(int(g^2*(x+1),x = -1..1)):
L:=g/normg:
list := [op(list), unapply(L,x)]:
end do:
list;
end proc:

What this procedure does, is calculating n orthonormal functions (but that doesn't really matter here). The result is a list of functions, or should be. What I get when I enter e.g. functions(5), is a list of very weird functions with 'nexpr' and more, instead of some polynomials.
When I replace the 'unapply(L,x)' in the 4th last line by just 'L', I do get the correct expressions, but I can't manage to calculate the function values for those. The expression just gets returned. By the way, I can't do that in the situation before the edit either.

So what I eventually want to do, is calculating some function values for each function in the list, or (if this isn't the right terminology) in Maple code e.g.:

f:= x -> x^2 + 3*x;
f(3);
(The result should be 18 in this case)

Could someone help me? :)

Jeroen

Two questions:

The algortihms that Groebner[Basis] uses at each step computes some "tentative" or "pseudo-basis". The "tentative" basis is not a Groebner basis but it is in the ideal generated by the original system of polynomial eq.

1) Is this correct ? Provided this is correct, then

2) How can one retrive the last "tentative" basis?
 If I just use timelimit I can abort the computations but how can one retrive the last computation?

 

 

Please respond me by email, thanks.

wingwatson7@gmail.com

 

First 1491 1492 1493 1494 1495 1496 1497 Last Page 1493 of 2426