vv

12403 Reputation

19 Badges

8 years, 161 days

MaplePrimes Activity


These are answers submitted by vv

For the function x : [0,1] --> R you probably want the Fourier expansion on each of the N intervals [(n-1)/N, n/N], 1<=n<=N.

In this case, X(m,n) must be the Fourier coefficient associated to the restriction of x() to this interval.

v:=unapply(H*sin(w*t),t):
solve(v(t)=0,t,allsolutions);

 

 

#assuming w>0, the solutions in [a,b] are
sol:=%$_Z1=ceil(a*w/Pi)..floor(b*w/Pi):

eval(sol, [w=10,a=0.5,b=2]);

evalf(%);

v[i]:=unapply(H*sin(w*t+phi[i]), t);

(in this way, i will be evaluated)

As you know, the integral (antiderivative) is defined up to an additive constant; this constant coud be even complex.

In your case:

f:=int(u/(1-u),u);

g:=-u-ln(1-u):

combine(g-f) assuming u>1;

combine(g-f) assuming u<1;

simplify(%);

 

 

As you see, f and g differ by a complex constant and this constant depends on the domain.

Notice that for u>1 it is more convenient Maple's answer.

 

 Edit.

In calculus, the integral appears usually as -u-ln|u-1|
It is better suited for real u, but has the disavantage of being wrong if u is complex.

 

My previous assertion (the hint) is not correct.
One can only prove that if two of the three pairs of polynomials have a common root then the third pair also has a common root. But the three polynomials do not necessarily have a common root.
In my (incorrect) solution, Maple splitted the problem in 15 sub-cases which had to be verified, which I did, but being too lazy, only for half of them. Unfortunately, one of the other cases provided a counterexample for a,b,c.
The exact expressions for a,b,c are very complicated (many RootOfs), so I shall give only the approximations.

p:=a*x^11+b*x^4+c; q:=b*x^11+c*x^4+a; r:=c*x^11+a*x^4+b:
Digits:=20:
abc:=[a = -0.23463440749094831025+0.20142703184123511503*I,
           b = -0.45433251158473825754+0.92621981907035507390*I,
           c =  1]:

commonz:=proc(p,q,eps:=10^(-Digits+4))
local zp,zq,a,b,res:=NULL;
zp:=[fsolve(p,complex)]; zq:=[fsolve(q,complex)];
for a in zp do for b in zq do
if abs(a-b)<eps then res:=res,a fi;
od;od;
[res]
end:  # find the common approx roots of two polynomials

pp:=eval(p,abc): qq:=eval(q,abc): rr:=eval(r,abc):
zpq:=commonz(pp,qq); eval(pp,x=zpq[1]),eval(qq,x=zpq[1]);
      [0.97952994125249449394 + 0.20129852008866007914 I]
                     
zpr:=commonz(pp,rr); eval(pp,x=zpr[1]),eval(rr,x=zpr[1]);
 
      [0.34730525284482028554 - 0.93775213214708045843 I] 
     

zqr:=commonz(qq,rr); eval(qq,x=zqr[1]),eval(rr,x=zqr[1]);
      [0.52896401032696245736 + 0.84864425749475095047 I]
    
                 
So, any two polynomials have a unique common root but they are distinct!

 

It can be shown a little more, namely:
If two  (of the three) pairs of the polynomials p,q,r have a common root then all the three polynomials have a common root.
[Or, in an other formulation: if there exist complex x,y  such that p(x)=q(x)=0=p(y)=r(y)  then there exists z such that p(z)=q(z)=r(z)=0].

Note that a Maple solution takes almost the same amount of time as a "by hand" one.

I'll give only a hint.
There are two cases.
  a) If {a,b,c} is (a multiple of) the set {z: z^3=1} (i.e. roots of the unity of order 3), then the three polynomials are equivalent (they are constant multiples of a same polynomial) and there is nothing to prove.
  b)  Otherwise, show that a common root of the three polynomials is a root of the unity of order 3.

Just use simplify to get rid of the negative terms.

But a good idea would be to tell us what mathematical result do you want to use in order to obtain the convergence.

You have a sum of a series, not an equation.

The sum cannot be computed exactly, but you can approximate it with any precision: just use

evalf[20](sum((factorial(n)/factorial(2*n))^n, n = 1 .. infinity));

to get 20 decimals.

Note that your series converges very fast: the first 4 terms are enough for 20 correct digits!

 

I'd say that the solution is straightforward.

a*(x-m)+b*(y-n)=0 is a general equation of a line thru [m,n]; it can be normalized by a^2+b^2=1
and one may suppose f(0,0)>=0 (because f=0 and -f=0 produce the same line).

The distance from (0,0) to the line is exactly |f(0,0)|/sqrt(a^2+b^2) = f(0,0). So, the tangency condition is just f(0,0)=r. That's all.

Happy New Year!

 

Why not the exact solution?

sol1:=dsolve({ode,ics}):
plot(rhs(sol1),x=0..1);

a:=5: b:=3:
F := proc(u)
   plots[display](
   plot([sqrt(a^2*cos(u)^2+b^2*sin(u)^2)+ a*cos(t)*cos(u)-b*sin(t)*sin(u),
             sqrt(a^2*sin(u)^2+b^2*cos(u)^2)+ a*cos(t)*sin(u)+b*sin(t)*cos(u), t=0..2*Pi]),
   plot([sqrt(a^2*cos(v)^2+b^2*sin(v)^2),sqrt(a^2*sin(v)^2+b^2*cos(v)^2),v=0..u],color=blue));
end proc:
plots[animate](F, [u], u = 0 .. Pi,  scaling = constrained );

Strangely, if you simply remove the assumptions in your sheet, it works.

To compute the (linear!) fit, you don't need the presence in memory of the vectors X,Y.
It is enugh to have X,Y in a text file (each line containing x_i, y_i)  and read it line by line, e.g.

f:="c:/temp/xy.txt";
A:=Vector(5);B:=Vector(3);
line:=readline(f):
while line<>0 do
x,y:=op(sscanf(line,"%f%f"));
A := A + Vector([1,x,x^2,x^3,x^4]);
B := B + Vector([y,x*y,x^2*y]);
line:=readline(f);
od:
p:= <A[1],A[2],A[3];A[2],A[3],A[4];A[3],A[4],A[5]>^(-1).B:
p[1]+p[2]*t+p[3]*t^2;  # the linear fit (parabola)


You have in two places subs({r=x, s=t} instead of subs({x=r, t=s}.

Note that it is not a good idea to use exclusively ":" instead of ";". You will have no chance to debug the code.

Compute the antiderivative first.

J:=Int((4/3)*t^(3/2)/sqrt(x-t), t = 0 .. x);

int((4/3)*t^(3/2)/sqrt(x-t), t):
J = limit(%,t=x,left) - limit(%,t=0,right) assuming x>0;



Edit. Actually,

value(J) assuming x>0;

also works.

 

 

First 104 105 106 107 108 109 110 Page 106 of 111