MaplePrimes Questions

I need to use newtons method to solve this in maple if someone can help me i will be very thankfull

help required to find the value of u analytically

Dear friends, i want to solve inequalities as follow:

solve({0 < Q, 0 < delta, 0 < t, 0 < E[0], 0 < lambda[1], 0 < (lambda[1]^2*(Q+2*t+4*delta-4*E[0])+lambda[1]*(Q+2*t+3*delta-7*E[0])-3*E[0])/((lambda[1]^2-6*lambda[1]-6)*t), Q < -(3*delta*lambda[1]+2*t*lambda[1]-4*E[0]*lambda[1]+6*delta-3*E[0])/lambda[1], delta < E[0]*(4*lambda[1]+3)/(3*(lambda[1]+2)), t < -(3*delta*lambda[1]-4*E[0]*lambda[1]+6*delta-3*E[0])/(2*lambda[1]), lambda[1] < 1, (lambda[1]^2*(Q+2*t+4*delta-4*E[0])+lambda[1]*(Q+2*t+3*delta-7*E[0])-3*E[0])/((lambda[1]^2-6*lambda[1]-6)*t) < (lambda[1]*(-2*Q-4*t-2*delta+3*E[0])-lambda[1]^2*delta+lambda[1]^2*E[0]+2*E[0]-2*Q-4*t)/((lambda[1]^2-6*lambda[1]-6)*t) and (lambda[1]*(-2*Q-4*t-2*delta+3*E[0])-lambda[1]^2*delta+lambda[1]^2*E[0]+2*E[0]-2*Q-4*t)/((lambda[1]^2-6*lambda[1]-6)*t) < 1})

But, processing is very heavy and takes too much time! is there any alternative solution?

Thank you in advance.

I am in the process of rewriting a long program so that it invokes procs.  After each proc I write I want to test the proc, so am not interested in any further output.  So in the code I entered `quit` (12);  - which I obtained from the Maple 7 Help documentation.  ...and possibly for good measure:  done;   The system crashed and I had to start again.   I have looked on the MaplePrimes documentation.  There are a couple of posts which treat this as an amusement.  eg

subs(_=sscanf(D,%m)[],proc() _end)();   which I haven't been game to try yet.

  I am curious about the number 12.  In the Maple 7 documentation the output is meant to give some useful information regards bytes used, allocation, & time taken.  Maple 7 documentation says that the number between parentheses should be an nteger in the  range 0..255.  Does varying this number make any difference?

WARNING!  Running the following program could crash your system.  Save any work before trying it.

restart:  `quit` (12);

   I'm curious to know what that does on later versions.  I'm running Maple 7 on Windows 7, so I suspect some incompatibility.

Any comments, advice gratefully received.  David


 

 

C_t := -A(t)*omega[0]*(sigma-(diff(C(t), t)))-(1/4)*A(t)^5*beta[2]*omega[0]^2-(1/4)*A(t)^3*beta[1]*omega[0]^2-(1/2)*F[0]*cos(C(t))+5*alpha[2]*A(t)^5*(1/16)+3*alpha[1]*A(t)^3*(1/8) = 0;

-A(t)*omega[0]*(sigma-(diff(C(t), t)))-0.3297500000e-1*A(t)^5*omega[0]^2-0.8345000000e-1*A(t)^3*omega[0]^2-cos(C(t))+0.4059375000e-1*A(t)^5+.1249125000*A(t)^3 = 0

(1)

 

A_t := (1/2)*mu*A(t)*omega[0]+(diff(A(t), t))*omega[0]-(1/2)*F[0]*sin(C(t)) = 0;

0.5000000000e-2*A(t)*omega[0]+(diff(A(t), t))*omega[0]-sin(C(t)) = 0

(2)

 

F[0] :=2: w0 := 1: alpha[1]:=0.3331:alpha[2]:=0.1299:beta[1]:=0.3338:beta[2]:=0.1319:mu:=0.01:sigma=0:

sigma = `0:`

(3)

 

C_t;A_t;

-A(t)*omega[0]*(sigma-(diff(C(t), t)))-0.3297500000e-1*A(t)^5*omega[0]^2-0.8345000000e-1*A(t)^3*omega[0]^2-cos(C(t))+0.4059375000e-1*A(t)^5+.1249125000*A(t)^3 = 0

 

0.5000000000e-2*A(t)*omega[0]+(diff(A(t), t))*omega[0]-sin(C(t)) = 0

(4)

ICS:=[C(0)=0,D(C)=0,A(0)=1,D(A)=0]:

sol:=dsolve({C_t,A_t,ICS},[C(t2),D(C),A(t2),D(A)],type=numeric):

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

 

pRange:=0..20:

 Atime:=odeplot( sol, [t, A],t=pRange, numpoints=10000 ):

Atime;

odeplot(sol, [t, A], t = 0 .. 20, numpoints = 10000)

(5)

 


 

Download phase_plot.mw

rho := -2*K*(s+K)^2*k[e]*sinh((s+K)*x/d)/(s*d^2*(4*(s+K)^3*cosh((s+K)*h/d)*h/d^2-4*K*(s+K)*cosh((s+K)*h/d)*h/d+4*sinh((s+K)*h/d)*K))

l.mw

All variables are constant except s and x

I would like to ask, how can I translate a Maple worksheet to a Mathematica notebook.

Hi,

 

I'm working on coding questions and I want to realize a particular addition (sometimes called "Nim addition")
Here is an example in base 3

Let A=11 and B=21 two numbers written inbase 10.
I want to realize the operation "A plus B" defined this way

  1. write A and B in base 3 : A -> a=102  and B -> b=210
  2. do c=a+b just as if a and b were numbers in base 10 : c=312
  3. compute all digits modulo 3 : 312 -> 012 = 12
  4. write this number in base 10 : 12 -> 5

Then 11 plus 21 = 5


In Maple"s syntax :

A := 11:
B := 21:
a := convert(A, base, 3):   # returns [1, 0, 2]
b := convert(B, base, 3):   # returns [0, 1, 2]


# the simplest thing I found to implement operation 2 and 3 above is :
# 1/ convert each list into polynomials (let's say pa and pb)
# 2/ set pc = pa+pb mod 3
# 3/ convert pc into a list
#
# Instead of coding something like pa := add(a[k]*x^(k-1), k=1..numelems(a)),
# I found more astute to use the gfun package

sa := gfun[listtoseries](a, x, 'ogf'):  # returns x^2+2+O(x^3)
sb := gfun[listtoseries](b, x, 'ogf'):  # returns 2*x^2+x+O(x^3)
pc := convert(sa, polynom)+convert(sb, polynom) mod 3; # returns x+2


Unfortunately I can't use now gfun[seriestolist](pc, 'revogf') for pc is obviously not a serie !
Reciprocally sc := sa+sb mod 3 doesn't return x+2+O(x^3)

Then I'm trapped here and I don't know how to go further
(of course I know how to proceed if I build directly the polynoms associated to a and b ... but it is far less elegant)

Does anyone have some idea ?

This problems raise the following question: how can we add tho series ?
For instance sa+sb returns (x^2+2+O(x^3))+(2*x^2+x+O(x^3)) without, apparently, no way to simplify this into  x+2+O(x^3)


Thanks in advance

Currently, I have some definitions of modules and or functions in one worksheet, say A.

To reduce clutter in A, I'd like to open second worksheet, say B, and invoke the functions defined in A in the B worksheet. This way I keep the definitions in one worksheet, and the tests/trying them, in another worksheet.  I do this all the time in Mathematica. It useful, as I like to keep one notebook for just definitions, and second one for testing and calling the functions.

I just found out, that a function defined in worksheet is not "seen" in worksheet B.  I looked at options and settings, googled a little, but not able to find an option to allow me to do this. I tried Tools->General->Share one engine among all documents. Clicked Apply. But that still did not do it.  From worksheet B, it tells me it does know the function I am trying to call. Only in worksheet A it can see the function.

Is there an option to allow one to have the function definition be seen on all open worksheets?

I know I could save the functions as mpl files, and then load them in the second worksheet. But during development, the first method is easier.

Dear sir / madam

Hi
I'm a student of mechanical engineering and looking for some HPM ( homotopy perturbation method) maple codes with the related article to practice more in this field.
can I ask you for help?
unfortunately, I couldn't find any articles with maple solution about HPM.

sincerely
Aidin

Hi everybody,

I'm working with orthogonal or Bernstein polynomials and I would like to keep my results expressed in terms of such polynomials.
Here is a notional example.
 

with(orthopoly):
#  first example : the result of diff is of the desired form  (p*q)' =  p' * q + p * q'
p := H(2, x):
q := H(3,x):
pq;
    (4*x^2-2)*(8*x^3-12*x)
dpq := diff(pq, x);
    8*x*(8*x^3-12*x)+ (4*x^2-2)*(24*x^2-12)   
  
#  second example : the result of diff is not exactly of the desired form (p*q)' =  p' * q + p * q'
# for  p' * q has been expanded

p := H(1,x)
q := H(3,x):
pq := p*q;
    2*x*(8*x^3-12*x)
diff(pq, x);
    16*x^3-24*x+ 2*x*(24*x^2-12)  
    
#  third example : here the result has been fully expanded
p := H(1,x)
q := H(2,x):
pq := p*q;
    2*x*(4*x^2-2)
diff(pq, x);
    24*x^2-4
   

First question : How could Iforce Maple to  preserve the form  p' * q + p * q' in all the situations ?

______________________________________________________________________


In the first test case the value of dpq (   8*x*(8*x^3-12*x)+ (4*x^2-2)*(24*x^2-12)    ) is not expressed in terms of Hermite polynomials.
I would like it to be, so I tried this ...

r := degree(dpq, x):
A := add(a__||k*H(k,x), k=0..r):
C := coeffs(expand(dpq-A), x)
S := solve(C, {seq(a__|-k, k=0..r)});
      {a0=48, a1=0, a2=72, a3=0, a4=10}
Hdpq := subs(S, A)
    160*x^4-192*z^2+24

...but  I had hope to obtain   Hdpq := 48*H(0,z)+72*H(2,z)+10*H(4,z), so here 
   48 + 72 * (4*z^2 - 2) + 10 * (16*z^4 - 48*z^2 + 12)
 

Second question : How could I prevent Maple to simplify the result os subs(S, A) ?




Thanks in advance

sys_ode := diff(I1(x), x) = -10*I1(x)+10*I2(x)+30, diff(I2(x), x) = -4*I1(x)+3*I2(x)+12;
print(`output redirected...`); # input placeholder
             d                                     
            --- I1(x) = -10 I1(x) + 10 I2(x) + 30,        >>> there are no sys_ode := before d\dx but when my friend do the same 
             dx                                                                  at another laptop it show.. and also i cant plot the graph.

               d                                 
              --- I2(x) = -4 I1(x) + 3 I2(x) + 12
               dx                                
dsolve([sys_ode]);
print(`output redirected...`); # input placeholder
          /                                           
         { I1(x) = exp(-5 x) _C2 + exp(-2 x) _C1 + 3, 
          \                                           

                   1                 4              \ 
           I2(x) = - exp(-5 x) _C2 + - exp(-2 x) _C1 }
                   2                 5              / 
ics := I1(0) = 0, I2(0) = 0;
print(`output redirected...`); # input placeholder
                      I1(0) = 0, I2(0) = 0
dsolve([sys_ode, ics]);
print(`output redirected...`); # input placeholder
           {I1(x) = -8 exp(-5 x) + 5 exp(-2 x) + 3, 

             I2(x) = -4 exp(-5 x) + 4 exp(-2 x)}
 

I can't get my answer when type Dx := Ky(0) , what to do?What the problem?

 

Worksheet:

 

 

As an exercise to gain familiarity with the maple programming platform, I am attempting to repackage a geometric algebra program written for Maple V as a module. I have attached file NewGlyph.mpl containing the initialization code for a module to support the GA routines in the package. The text file was created in the Maple code editor (Maple 2018) and loaded by reading it into a worksheet (configured for maple input instead of 2D math). I have two questions: one: how to get the GAinit procedure to execute completely, and two: to understand the puzzling warnings produced by the code editor.  The behaviour I observe when the module is loaded into a worksheet is: NewGlyph:= a maple id.  At this point the load=setup procedure has registered type blade, but not executed the remaining procedures in the setup routine. When I execute with(NewGlyph) the exported procedures are displayed properly.  However, I still have to execute the GAversion procedure and
the GA_addmetric procedure manually to properly initialize the metric table in the module. It would appear that the module load process permits the execution of the addtype procedure but not the output of the version procedure or the metric table constructor. Is there a way to autoexecute these procedures when the NewGlyph module is invoked by the with(NewGlyph) command? Are there any criteria for the kinds of processes that can be included using option load=setup? My second question concerns the compiler warning raised by the code editor.  It warns that "These names were used as global names but were not declared: blade, sig. Also "These local variable were assigned a value but not otherwise used: cleanup.

NewGlyph := module ()
description "Basic Geometric Algebra Functions";
local setup, cleanup;
global e;
export GAversion,GAinit, GAadd_metric,GAmetric,GAmv;
option package, load = setup, unload = cleanup;

setup := proc ()
TypeTools:-AddType(`blade`, proc (a) type(a, indexed) and op(0, a) = 'e' end proc);
GAversion();
GAinit();
end proc;
setup();
cleanup:=proc()
TypeTools:-RemoveType(`blade`);
end proc;

GAinit := proc()
global `&@`, `&.`, `&^`, `&x`, `&s` , `&/`, `&l`, `&v`;
protect('`&@`','`&.`', '`&^`', '`&x`', '`&s`', '`&/`', '`&l`', '`&v`');
GAadd_metric('default', signum, -infinity, infinity);
GAadd_metric('SA', proc () 1 end proc, 1, 3);
GAadd_metric('STA', proc (i) `if`(i = 0, 1, -1) end proc, 0, 3);
GAadd_metric('MSTA', proc (i) `if`(modp(i, 4) = 0, 1, -1) end proc, 0, infinity);
GAadd_metric('Homogeneous', proc () 1 end proc, 0, infinity);
GAadd_metric('Conformal', proc (i) `if`(i = -1, -1, 1) end proc, -1, infinity);
GAmetric('default');
end proc:

GAversion := proc ()
print(`GA Package`);
print(`Version 2.0`);
print(`Written by: Mark Ashdown, maja1@mrao.cam.ac.uk`);
print(`Extended by: Alan Macdonald, macdonal@luther.edu`);
print(`Re-Packaged for Maple 2018 by: Ian McCreath`);
end proc;

GAadd_metric := proc (fred::name, signature::procedure, minind::{integer, infinity}, maxind::{integer, infinity})
global MetricTable;
unprotect('MetricTable');
MetricTable['fred'][sig] := eval(signature);
if maxind < minind then
ERROR(`The minimum index is greater than the maximum index`)
end if;
MetricTable['fred'][min] := minind;
MetricTable['fred'][max] := maxind;
protect('MetricTable');
print(`The GA package knows about metric ` . fred . `.`)
end proc:

GAmetric := proc (a::name)
global Metric, Sig, MetricTable, MinIndex, MaxIndex;
if member([a], [indices(MetricTable)]) then
unprotect('Metric', 'Sig', 'MinIndex', 'MaxIndex');
Metric := a;
Sig := MetricTable[Metric][sig];
MinIndex := MetricTable[Metric][min];
MaxIndex := MetricTable[Metric][max];
protect('Metric', 'Sig', 'MinIndex', 'MaxIndex');
print(`Metric is now set to: ` . Metric)
else
ERROR(`The metric ` . a . ` is unknown to the GA package`)
end if
end proc:

# Creates multivector with name x of with grade or set of grades g with
# indices ind
GAmv := proc(x::name,g::{nonnegint,set(nonnegint)},ind::set(integer))
local i;
if g::set then
add(procname(x,i,ind), i=g)
elif g > nops(ind) then
ERROR(`grade too large for number of indices.`)
elif g=0 then
x[NULL]
else
add(x[op(i)]*e[op(i)], i=combinat:-choose(sort([op(ind)]),g))
end if
end:

end module;

Download NewGlyph.txt

 

 

restart:
ode:=-diff(y(x),x,x)+(1/4)*y(x)-4*exp(-x)=0:
init:=y(0)=0,y(1)=0:
exact:=dsolve({ode,init},y(x)):
N:=8:
trial:=sum(c[i]*x^i,i=1..N):
residual:=lhs(subs(y(x)=trial,ode)):
R:=simplify(residual):
sys:=[]:
for i from 1 to N  do sys:=[op(sys),int(R*x^i,x=0..1)=0];    
od:
sys:
vars:=seq(c[i],i=1..N):
A,b:=LinearAlgebra[GenerateMatrix](sys,[vars]):
sol:=solve({op(sys)},{vars}):
assign(sol):
trial:

# if i am plotting the graph exact and trial i am getting the error, separately if i am plotting the graph of exact i am getting the plot, similarly exact - trial error
trial_fun:=unapply(trial,x):
exact_fun:=unapply(rhs(exact),x):
evalf(trial_fun(1)-exact_fun(1)):
plot(exact,trial,x=0..1):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct
plot(trial,x=0..1,legend['trial']):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct



#error calculation

plot(exact-trial,x=0..1):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct


restart:

restart:

Eqn:=-diff(y(x),x,x)+(1/4)*y(x)-4*exp(-x)=0:
BCs:=y(0)=0,y(1)=0:
dsolve({Eqn,BCs},y(x)):
assign(%):y:=unapply(y(x),x):
plot(y(x),x=0..1);
 

 

First 531 532 533 534 535 536 537 Last Page 533 of 2142