MaplePrimes Questions

Dear all,

here, I propose two methods for Adams Moulton Methos, but which one can I used.

The n-step Adams Moulton method to solve y'(x)=F(x,y(x)) is defined by the stencil

y(x+h)=y(x)+h *sum_{j=-1}^{n-1} beta_j F( x-j*h, y(x-j*h) ) + O(h^{n+2})

I want a procedure with single argument ''n'' that calculates and return the ''beta_i'' coefficients

I get two Methods. Which one correspond to my question please, and I don't understand the procedure proposed.

For me; the first give the iterative schemae used, but don't return the vector coefficients ( beta_i) and this methode method an interpolation of the function.

The second method, there is a function f, how this function is maded, and the same for the matrux A and the vector b...

the First Method:

> Adamsmoulton := proc (k::posint)

local P, t, f, y, n;

P := interp([t[n]+h, seq(t[n]-j*h, j = 0 .. k-2)], [f[n+1], seq(f[n-j], j = 0 .. k-2)], x);

y[n+1] = y[n]+simplify(int(P, x = t[n] .. t[n]+h))

end proc;

 

Second Method:

f:=proc(x,y) if x =0 and y=0 then 1 else x**y fi end;

n:=3; A:=matrix(n,n,(i,j)->f(1-j,1-i));

b:=vector(n, i->1/i);

linsolve(A,b);

 

I'm trying to run two statement sequences, one after the other, numerous times. I have the statement sequences:

 

>for j from 1 to N do

>S[j]:=V[j]+t;

>S[j]:=S[j]+3;

>end do:

 

>for j from 1 to N do

>if S[j]>99 then S[j]:=0

>end if:

>end do:

 

 

I can manage to run one of them multiple times, but when I try to encompass both of them within my 

 

>for counter from initial to final do statementsequence

end do:

 

it doesn't seem to work.

 

Thanks in advance

assume the word equation is

a_i *a_j - a_j *a_i = 0

how to find which permutation group is a_i and a_j

my understanding is to try all rotations

a book use underscript i and j

can i see them as upper script for i rotations which is shift i times to left for second row

and try all combination and composite them in two for loop? 

Whassup homies?

http://www.mathsisfun.com/puzzles/who-lives-in-the-city--solution.html

tried to solve this using C.Loves program, but didn't quite get their solution...

Who_Lives_in_the_Cit.mw

Vars:= [PN,Name, TV, Dest,Ages,Hair,Lives]:
PN:=[$1..5]:
Name:= [Bob, Keeley, Rachael, Eilish, Amy]:
TV:=[Simpsons, Coronation, Eastenders, Desperate, Neighbours]:
Dest:= [Fra, Aus, Eng, Afr,Ita]:
Ages:= [14, 21, 46, 52, 81]:
Hair:=[afro, long, straight, curly , bald]:
Lives:= [town, city, village, farm, youth]:
Con1:= Desperate=3: Con2:= Bob=1: Con3:= NextTo(Simpsons,youth,PN): Con4:= Succ(Afr,Rachael,PN): Con5:= village=52: Con6:= Aus=straight: Con7:= Afr=Desperate: Con8:= 14=5: Con9:= Amy=Eastenders: Con10:= Ita=long: Con11:= Keeley=village: Con12:= bald=46: Con13:= Eng=4: Con14:= NextTo(Desperate,Neighbours,PN): Con15:= NextTo(Coronation,afro,PN): Con16:= NextTo(Rachael,afro,PN): Con17:= 21=youth: Con18:= Coronation=long: Con19:= 81=farm: Con20:= Fra=town: Con21:= Eilish<>straight:

read "LogicProblem.mpl"; City:= LogicProblem(Vars): with(City);

 

we use modern computer algebra books

i) computer the GSO of (22,11,5),(13,6,3),(-5,-2,-1) belong to R^3.

ii)trace algorithm 16.10 on computer a reduced basis of the lattice in Z^3 spanned by the vectors form(i).

trace also the values of the d_i and of D, and compare the number of exchange steps to the theoretical upper bound from section 16.3

 

we use Modern Computer Algebra

let f=x^15-1 belong to Z[x]. take a nontrivial factorization f≡gh mod 2 with g,h belong to Z[x] monic and of degree at least 2. computer g*,h* belong to Z[x] such that   f≡g*h* mod 16 ,deg g*=deg g, g*≡g mod 2.

show your  intermediate. can  you guess some factors of f in Z[x]?

 

we use Modern Computer Algebra book  

trace algorithm 15.2 on factoring f=30x^5+39x^4+35x^3+25x^2+9x+2 belong to Z[x].choose the prime p=5003 in step.

I have this expression; f(a,c,n)=64a²n-16a⁴n-256c²n+32c⁴n-96a²c²+ 8a²c⁴+24a⁴c²-64a²n²+256a²-124a⁴+ 15a⁶+256n²+64a²c²n

such as "a" is between 0 and 2, "c" between 0 and 2 and "n" between 0 and 4.

How do I plot f(a,c,n) so that I can study its sign?

 

I have computed the infinite multiplication using Maple, $\Pi_{k=3}^{\infty} ( \cos (\frac{\pi}{k} ))$, as follows, but it resulted in 0! I wonder why this happened, although maple was using exact arithmetic.


    P := Product(cos(Pi/k), k = 3 .. infinity)   

    value(P)

Note that if I use floating-point instead, it gives me the right answer, 0.1149420449.


    evalf(P)
By the way, I did not expect such a situation! Exact arithmetic should be exact! I am multiplying non-zero numbers to each other, starting from $1/2$ to $1$ as $n \rightarrow \infty$. So it should not be zero! Why such a thing happened?

Dear all;

Special thanks for all the member who help me in Maple.

My last question is:

Write a maple procedure that solves for y(1) in the initial value problem y'(x)=f(y), y(0)=1

using a Numerical stencil based on the n^{th] order taylor series expansion of y.

The procedure arguments include an arbitrary function f, an integrer n, representing the accuracy of the taylor series expansion, and N representing the number of steps between x=0 and x=1.

 

 

 

Given a 2x2 matrix I am struggling to write a function that would return a list (a,b, a1, a2) of 2 complex numbers followed by 2 vectors such that the set of the 2 vectors is a basis for CxC and also Ab1=ab1, Ab2=Bb2 if these exist

 

Any ideas would be greatly appreciated

how to convert decimal to fraction without simplify

for example

convert(0.25, fraction)

expect 25/100, but not 1/4

Hi,

Please help me in solving system consist the three differential equations with three unknowns. I did already a few attempts, but I can not finish. Once in the final result was got RootOf and do not know what to do. I tried also numerically. I very very ask for some suggestions: ( 

with the boundary condition

parameters A,B,C are constans

 

1)

qa1 := A1*(diff(Tg(x), x, x))+A2*(diff(Tg(x), x))+(A3+A4)*Tg+A3*Tz+A4*Tw = 0;

eqa2 := B1*(diff(Tw(x), x, x))+B2*(diff(Tw(x), x))+(B3+B4)*Tw+B3*Tz+B4*Tg = 0;

eqa3 := C1*(diff(Tz(x), x, x))+(C3+C4)*Tz+C3*Tg+C4*Tw = 0

2)

On paper, the system of three equations with three unknowns I changed to system of two equations with two unknowns but still nothing. 

A[1] := 2, 

eqa1 := A[1]*C[1]*(diff(z(x), x, x, x, x))/C[3]+A[2]*C[1]*(diff(z(x), x, x, x))/C[3]+(A[1]*C[3]+A[1]*C[4]+A[3]*C[1]+A[4]*C[1])*(diff(z(x), x, x))/C[3]+(A[1]*C[3]+A[1]*C[4])*(diff(z(x), x))/C[3]+(A[3]*C[3]+A[3]*C[4]+A[4]*C[3]+A[4]*C[4]+A[3]*C[3])*z(x)/C[3]+A[1]*C[4]*(diff(y(x), x, x))/C[3]+A[2]*C[4]*(diff(y(x), x))/C[3]+(A[3]*C[4]+A[4]*C[4]+A[4]*C[3])*y(x)/C[3] = 0;

eqa2 := B[4]*C[1]*(diff(z(x), x, x))/C[3]+(B[4]*C[3]+B[4]*C[4]+B[3]*C[3])*z(x)/C[3]+B[1]*(diff(y(x), x, x))+B[2]*(diff(y(x), x))+(B[4]*C[3]+B[4]*C[4]+B[3]*C[3])*y(x)/C[3] = 0;

row := eqa1, eqa2;

sol := dsolve({row}, {y(x), z(x)});

 

Thank you very much for your help.

Ewa.

Dear all,

I need to compute the error, How to define the error between the exact and approximation.

 

                               d              
                              --- y(x) = -y(x)
                               dx             
                               y(x) = exp(-x)

 

I have a problem in this code, my goal is to compute the error between the approximate solution obtained by RK3 and Exact  and E ( approximation by RK3).

How to definie the error and prouve that the error is O(h^4)  ( with one step) and the global error is O(h^3).

Thank you  for helping me.

 

 

 

Hi,

I have a problem with dsolve in the following code

restart;
>
n:=20;
m:=1;
cc:=-200;
zzeta:=0.1;
sefr1:=0.3;
sefr:=0.2;
MM:=0;
lambda:=0.1;
Br:=1;
nn:=3;
>
>
#u(tau):=tau;
u(tau):=421.7129935*tau-2217.587728*tau^2+8897.376593*tau^3-27612.59182*tau^4+64248.00336*tau^5-1.083977605*10^5*tau^6-10.57029600-1.080951714*10^6*tau^13+7.999517316*10^5*tau^14-4.788741005*10^5*tau^15+2.309563748*10^5*tau^16+26511.11102*tau^18-5959.001794*tau^19+1.148523882*10^5*tau^7-95.23809524*tau^21+4.545454545*tau^22-9435.563781*tau^8-2.587683745*10^5*tau^9+6.473880128*10^5*tau^10+948.0272727*tau^20-88660.41892*tau^17-1.008692404*10^6*tau^11+1.175504242*10^6*tau^12;
>
>
B := 1+(2*(1-zzeta))*Br*(int(tau*(diff(u(tau), tau))^2, tau = (1/2)*zzeta*(1-zzeta) .. 1/2*(1-zzeta)));
eq4 := 4*B*u(tau)-(1+zzeta)*(diff(tau*(diff(theta(tau), tau)), tau))/tau-(1+zzeta)*Br*(diff(u(tau), tau))^2;


theta(tau):=sum(p^ii*theta[ii](tau),ii=0..nn);
HH:= p*((4*(1+(2*(1-zzeta))*Br*(int(tau*(diff(u(tau), tau))^2, tau = (1/2)*zzeta*(1-zzeta) .. 1/2-(1/2)*zzeta))))*u(tau)-(1+zzeta)*(diff(theta(tau), tau)+tau*(diff(theta(tau), tau, tau)))/tau-(1+zzeta)*Br*(diff(u(tau), tau))^2)+(1-p)*(diff(theta(tau),tau$2)):
eq5:=simplify(HH):
eq6:=collect(expand(eq5),p);

eq7:=
convert(series(collect(expand(eq5), p), p, nn+1), 'polynom');


for ii to nn do
ss[ii] := (coeff(eq7, p^ii)) ;
print (ii);
end do;

ss[0]:=diff(theta[0](tau), tau, tau);

icss[0]:=theta[0](zzeta/(2*(1-zzeta)))=0, D(theta[0])(1/(2*(1-zzeta)))=1;

dsolve({ss[0], icss[0]});
theta[0](tau):= rhs(%);


for ii to nn do
ss[ii]:=evalf[5](ss[ii]);
icss[ii]:=theta[ii](zzeta/(2*(1-zzeta)))=0, D(theta[ii])(1/(2*(1-zzeta)))=0;
dsolve({ss[ii], icss[ii]});
theta[ii](tau):=rhs(%);
end do;

I would be most grateful if you help me to find this problem.

Thanks for your attention in advance

 

First 1465 1466 1467 1468 1469 1470 1471 Last Page 1467 of 2434