Items tagged with exact

restart:with(plots):
eq:=(diff(f(eta),eta$2))-a*f(eta)+b*(1+diff(f(eta),eta)^2)^(-1/2)=0;
bc:=f(1)=0,D(f)(0)=0;
ans := dsolve(eq);

I thought I would share some code for computing sparse matrix products in Maple.  For floating point matrices this is done quickly, but for algebraic datatypes there is a performance problem with the builtin routines, as noted in http://www.mapleprimes.com/questions/205739-How-Do-I-Improve-The-Performance-Of

Download spm.txt

The code is fairly straightforward in that it uses op(1,A) to extract the dimensions and op(2,A) to extract the non-zero elements of a Matrix or Vector, and then loops over those elements.  I included a sparse map function for cases where you want to map a function (like expand) over non-zero elements only.

# sparse matrix vector product
spmv := proc(A::Matrix,V::Vector)
local m,n,Ae,Ve,Vi,R,e;
n, m := op(1,A);
if op(1,V) <> m then error "incompatible dimensions"; end if;
Ae := op(2,A);
Ve := op(2,V);
Vi := map2(op,1,Ve);
R := Vector(n, storage=sparse);
for e in Ae do
n, m := op(1,e);
if member(m, Vi) then R[n] := R[n] + A[n,m]*V[m]; end if;
end do;
return R;
end proc:
# sparse matrix product
spmm := proc(A::Matrix, B::Matrix)
local m,n,Ae,Be,Bi,R,l,e,i;
n, m := op(1,A);
i, l := op(1,B);
if i <> m then error "incompatible dimensions"; end if;
Ae := op(2,A);
Be := op(2,B);
R := Matrix(n,l,storage=sparse);
for i from 1 to l do
Bi, Be := selectremove(type, Be, (anything,i)=anything);
Bi := map2(op,[1,1],Bi);
for e in Ae do
n, m := op(1,e);
if member(m, Bi) then R[n,i] := R[n,i] + A[n,m]*B[m,i]; end if;
end do;
end do;
return R;
end proc:
# sparse map
smap := proc(f, A::{Matrix,Vector})
local B, Ae, e;
if A::Vector then
B := Vector(op(1,A),storage=sparse):
else
B := Matrix(op(1,A),storage=sparse):
end if;
Ae := op(2,A);
for e in Ae do
B[op(1,e)] := f(op(2,e),args[3..nargs]);
end do;
return B;
end proc:


As for how it performs, here is a demo inspired by the original post.

n := 674;
k := 6;
A := Matrix(n,n,storage=sparse):
for i to n do
  for j to k do
    A[i,irem(rand(),n)+1] := randpoly(x):
  end do:
end do:
V := Vector(n):
for i to k do
  V[irem(rand(),n)+1] := randpoly(x):
end do:
C := CodeTools:-Usage( spmv(A,V) ):  # 7ms, 25x faster
CodeTools:-Usage( A.V ):  # 174 ms
B := Matrix(n,n,storage=sparse):
for i to n do
  for j to k do
    B[i,irem(rand(),n)+1] := randpoly(x):
  end do:
end do:
C := CodeTools:-Usage( spmm(A,B) ):  # 2.74 sec, 50x faster
CodeTools:-Usage( A.B ):  # 2.44 min
# expand and collect like terms
C := CodeTools:-Usage( smap(expand, C) ):

Compute the following multiple integral exactly and/or with 10 correct significant digits

Int(  exp( - add(x[i],i=1..10)^3),  seq(x[i]=0..1, i=1..10) );

  The problem is suggested by a previous post.

I try to find the exact (symbolic) value of

(-2*sqrt(7)-4)*EllipticK((1/8)*sqrt(2)*(-3+sqrt(7)))^2+4*EllipticE(-(1/8)*sqrt(2)*(-3+sqrt(7)))*sqrt(7)*EllipticK((1/8)*sqrt(2)*(-3+sqrt(7)))

I tried 'simplify' with different options and 'convert'. It would be pi=3.141... as numerical approximation suggests.

Many thanks.

EF.3.mwHi, I want to ask that how to find the exact solution of equation without applying any technique

Hello,

Good day.

How to avoid float(undefined) for v3, v4,v5 in this problem.

Thank you in advance.

Try_for_Second_Grade_Fluid.mw

hello,

restart:

ODE:=diff(T(z),z$2)+A1*(S-1/L+1/L*exp(-L*z))*diff(T(z),z)+A2*T(z)=0;

bcs:=T(0)=1,T(infinity)=0;

bcs:=T(0)=1,T(A3)=0;

dsolve({ODE,bcs});

where, A1, A2, A3, L, S are all constants.

i get an exact solution but is there any way around to get a more compact solution?

 

 

hey friends am stuck with some code. My code is correct and am trying to find exact solution but not able to see output. Please kindly check it and let me know exact_solution.mw

hi friends am using maple 13 which is unable to find exact solutions for pdes

because for exact solution i should have maple 15 but am not able to install that so please can anyone of u can find exact sloution for me of the pde

pde := diff(U(x, y), x, x)-3*(diff(U(x, y), y, y))+16 = 0 where boundary conditions are

U=0 on x=1,-1

U=0 on x=1,-1

diff(U(x, y), y) = -U on y=1, -1< x

diff(U(x, y), y) = U on y=-1, -1< x

Hi friends. Am trying to plot a graph that shows the difference between cubic spline, crank 
nicolson and exact soution in 2d through this command but am not able to get it. 
Whereas table is mentioned below at t=0.05
x	cubic	 crank	  exact
0.05 0.0879 0.0855 0.0756
0.15 0.2514 0.2446 0.2194
0.25 0.3807 0.3708 0.3417
0.35 0.4625 0.4512 0.4305
0.45 0.4928 0.4815 0.4773
0.55 0.4747 0.4646 0.4733
0.65 0.4151 0.4609 0.4305

Can we find exact solution of PDE with help of maple?

If it is yes the please let me how to write commands for parabolic pde 

ut=k uxx with boundary conditions u(0,t)=u(l,t)=0 and initial condition u(x,0)=e-x

consider:

assume(k[f1]>0,k[f2]>0,k[f2]>k[f1],h_bar>0,m>0);
 
h_bar:=1.0545e-34;m:=0.10938e-31;n[0]=1e28;


> eq1:=n=(k[f1]^3+k[f2]^3)/6/Pi^2;

> eq2:=e*V=h_bar^2/2/m*(k[f2]^2-k[f1]^2);

> solve({eq1,eq2},{k[f1],k[f2]});

in the final command i get a very messy numerical&symbolic results like

{k[f1] = 1016612041.*
(-1.*RootOf(9456017282782496601177464289*n^2*Pi^4...

 Hi 

I am usign dsolve for maple to give my a fuction z(t) . Maple solves the differential equation but i want maple to give me the exact number for specific t values z(60) and so on. But maple is given as an answer z(60) and not a number 

Can someone help me to generate the same, identical grpah over several periods in x-axis? In exact term, I mean that I need to plot a periodical grpah, that repeats itself over the interval? It is like given a periodical function and now have to draw it many times...(function can be any form, not only sine and cosine)
 

1 2 Page 1 of 2