MaplePrimes Questions

I'm asked to solve the equations below simultaneously using fsolve.

f := x*exp((1 - x)*a);
f[2] := subs(x=f,f);
eq[1] := f[2] - x;
eq[2] := diff(f[2],x) + 1;

fsolve({eq[1],eq[2]},{x,a}):

fsolve doesn't seem to work here for some reason.

Any help help would be great!

Thanks

Hi Everybody,

I'm having some problems simulating an algebraic system in Maple.  I want to do this for a larger system of equation (~20 equations/20 variables, with 3 inputs), but I'd like to get an idea of the form this should be in.

So, using an example out of Maple help:

with(DynamicSystems);

sys1:=AlgEquation([y=sin(x)],[x],[y],discrete=true,sampletime=0.001);

inp1:=Vector[column]([1,2,3,4,5,6,7]) * 0.1;

res:=Simulate(sys1,[inp1]);

Error, (in DynamicSystems:-Simulate) should never be here

 

I don't understand what this error means.  Reading the example in the help files, says the second argument should be a vector of input values.  What I would assume this would do is plugin x = 0.1, then solve y=sin(0.1), and output y.

Am I missing some syntax, or is my inputs wrong?  There are examples of how to set up an algebraic system in the help files, but no examples of how to simulate them.

 

Thanks in advance for any help!

 

 

 

 

Hello all. I have a probably simple problem, that is drinving me totally crazy. I have a expression having:

 (sqrt(M+m)*sqrt(M-m).(sqrt(M+m)*sqrt(M-m))

 

and it refuses to simplify. I told maple assume(m>0, M>0), etc. But it doesn't want to simplify. Anyone has any ideas?

 

Regards,

Jelmew

 

Edit: uploaded the mw file, so it can be seen what the problem is.10.1.mw10.1.mw

[I added Physics to the tags.--Carl Love as moderator]

Hi, i'm trying to solve the simultaneous equations,

a[1]:=2*x^2 + 3*x^2 + x*y - x^2 + x;

a[2]:=3*y^2 + 4*x^2 - y;

eval(y,fsolve({a[1],a[2]},{x,y}));
0.

Even though y can be 0 it can also be 1/3 and two other complex numbers.

How do you get fsolve to show all four y solutions.

Secondly, how would i get maple to just to show the positive y solution ie. 1/3 only.

Hello,
my question may be simple but I don't find the answer in any help guide.
when I define a function I cannot use a linearalgebra expression such as Trace.
Here is an example of what I would like to do:




If anyone can help me...
Thank you

I need to plot the band structure of Graphene using Maple, Ive written out the eqn as given in the homework, but when i hit enter it says "error. unable to match delimiters"

 

i have no idea what that means, here is the eqn i have typed into Maple:

http://imageshack.us/photo/my-images/39/j7ri.jpg/

http://img39.imageshack.us/img39/733/j7ri.jpg

i have been given values for gamma and acc, do i just type them in after, E is a function of k (kx,ky,kz) do i put that in brackets after the E?

 

E(kx,ky,kz)

Error, (in Statistics:-NonlinearFit) invalid input: no implementation of NonlinearFit matches the arguments in call

after tried many times, got this error

 

x11 := [0.208408965651696e-3, -0.157194487523421e-2, -0.294739401402979e-2, 0.788206708183853e-2, 0.499394753201753e-2, 0.191468321959759e-3, 0.504980449104750e-2, 0.222150494088535e-2, 0.132091821964287e-2, 0.161118434883258e-2, -0.281236534046873e-2, -0.398055875132037e-2, -0.111753680372819e-1, 0.588868146012489e-2, -0.354191562612469e-2, 0.984082837373291e-3, -0.116041186868374e-1, 0.603027845850267e-3, -0.448778128168742e-2, -0.127561485214862e-1, -0.412027655195339e-2, 0.379387381798949e-2, -0.602550446997765e-2, -0.605986284736216e-2, -0.751396992404410e-2, 0.633613424008655e-2, -0.677581832613623e-2]:
y11 := [ -21321.9719565717, 231.709204951251, 1527.92905167191, -32.8508507060675, 54.9408176234139, -99.4222178124229, -675.771433486265, 42.0838668074923, -12559.3183308951, 5.21412214166344*10^5, 1110.50031772203, 3.67149699000155, -108.543878970269, -8.48861069398811, -521.810552387313, 26.4792411876883, -8.32240296737599, -1085.40982521906, -44.1390030597906, -203.891397612798, -56.3746416571417, -218.205643256096, -178.991498697065, -42.2468018350386, .328546922634921, -1883.18308996621, 111.747881085748]:
z11 := [ 1549.88755331800, -329.861725802688, 8.54200301129155, -283.381775745327, -54.5469129127573, 1875.94875597129, -16.2230517860850, 6084.82381954832, 1146.15489803104, -456.460512914647, 104.533252701641, 16.3998365630734, 11.5710907832054, -175.370276462696, 33.8045539958636, 2029.50029336951, 1387.92643570857, 9.54717543291120, -1999.09590358328, 29.7628085078953, 2.58210333216737*10^6, 57.7969622731082, -6.42551196941394, -8549.23677077892, -49.0081775323244, -72.5156360537114, 183.539911458475]:
a1 := Diff(x1(t),t) = k1*x1(t)+ k2*y1(t)+ k3*z1(t);
b1 := Diff(y1(t),t) = k4*x1(t)+ k5*y1(t)+ k6*z1(t);
c1 := Diff(z1(t),t) = k7*x1(t)+ k8*y1(t)+ k9*z1(t);
ICS:=x1(1)=x11[1],y1(1)=y11[1],z1(1)=z11[1];
sol:=dsolve({a1,b1,c1,ICS}, numeric, method=rkf45, parameters=[k1,k2,k3,k4,k5,k6,k7,k8,k9]);
ans:=proc(p1,p2,p3) sol(parameters=[x1=p1,y1=p2,z1=p3]); end proc:
tim := [seq(n, n=1..27)];
ExperimentalData := <<x11>|<y11>|<z11>>;
FitParams:=Statistics:-NonlinearFit(ans, ExperimentalData,initialvalues=[k1=0,k2=0,k3=0,k4=0,k5=0,k6=0,k7=0,k8=0,k9=0], output=parametervalues);

 

main_screened_Poisso.mw

In the attached Maple program I construct a matrix of which the entries involve numerical integration. Nothing difficult, I think, yet the ReducedRowEchelonForm is taking forever. What am I doing wrong?

expect to export a series of graphs, but no diagram,

 

then i debug to export one diagram, it is success, why in this case not export

https://drive.google.com/file/d/0B2D69u2pweEvcDZVZ0tsRTc2dTg/edit?usp=sharing

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, varx)
if numoflevel = 1 then
hello := 0;
for kk from 1 to nops(var) do
hello := hello + diff(hx[kk], varx[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, varx), varx[kk])*fx[kk];
od;
return hello;
end if;
end proc:
CheckRelativeRankZero := proc(h1, f1, g1,variables1,Count)
IsFinish := 0;
Result := 0;
for ii from 1 to 8 do
if IsFinish = 0 then
Lf2h := Lfh(ii,h1,f1,variables1);
Print(“Lf2h=”);
Print(Lf2h);
Lgf2h := Lfh(1,[seq(Lf2h,n=1..nops(variables1))],g1,variables1);
if Lgf2h = 0 then
print(“Lgf2h = 0”)
print(f1);
print(Lf2h);
print("find at ", ii);
IsFinish := 1;
Result :=Lf2h;
end if;
end if;
od;
return Result;
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;

with(DEtools):
Iter:= iterstructs(Permutation(list7), size=2):
Count := 1;
list8 := [];
while not Iter[finished] do
p:= Iter[nextvalue]();
I1 := 0;
I2 := 0;
if IsZeroMatrix(p[1]) = 0 and IsZeroMatrix(p[2]) = 0 then
group1 := Matrix(p[1]);
for ii from 1 to 3 do
for jj from 1 to 3 do
if group1[ii][jj] = 1 then
I1 := I1 + varlist[ii]*varlist[jj];
end if;
od;
od;
group2 := Matrix(p[2]);
for ii from 1 to 3 do
for jj from 1 to 3 do
if group2[ii][jj] = 1 then
I2 := I2 + varlist[ii]*varlist[jj];
end if;
od;
od;
f2:=[I1, I2];
g2:=[0,-1,1];
h2:=[x1,0,0];
Lf2h := CheckRelativeRankZero(h2,f2, g2, varlist, Count);
print(“Lf2h=”);
print(Lf2h);
RightSide := MatrixMatrixMultiply(Matrix([[0,diff(I2, varlist[3]),-diff(I2,varlist[2])],[-diff(I2, varlist[3]),0,diff(I2, varlist[1])],[diff(I2, varlist[2]),-diff(I2, varlist[1]),0]]), Matrix([[diff(I1, varlist[1])],[diff(I1, varlist[2])],[diff(I1, varlist[3])]]));
print(“RightSide”);
print(RightSide);
Lf2_h := Lfh(1, Lf2h, f2, varlist);
LgLf_h := Lfh(1,Lfh(1,h2,f2,varlist),g2, varlist);
if LgLf_h = 0 then
u:=0;
else
u := -Lf2_h/LgLf_h;
end if;
newsys := [Diff(x1(t),t) = subs(x3=x3(t),subs(x2=x2(t),subs(x1=x1(t),RightSide[1][1]))) + g[1]*u,
Diff(x2(t),t) = subs(x3=x3(t),subs(x2=x2(t),subs(x1=x1(t),RightSide[2][1]))) + g[2]*u,
Diff(x3(t),t) = subs(x3=x3(t),subs(x2=x2(t),subs(x1=x1(t),RightSide[3][1]))) + g[3]*u];
eval(plotsetup):
`plotsetup/devices`[jpeg]:=[jpeg,`plot.jpg`,[],[],``]:
plotsetup(jpeg, plotoutput=cat(cat(`testhamiplot`, Count),`.jpg`),plotoptions=`height=700,width=800`);
DEplot3d(value(newsys), [x1(t), x2(t), x3(t)], t = 0..1,[[x1(0) = 1, x2(0) = 1, x3(0) = 1]]);

Count := Count +1;
end if;
end do:

Hi, I am trying to write a procedure that inputs two matrices (A,B) and vector (C), it then multiplies C by A, and thenC by B and adds these to the array, it then multiplies each other them by A and B and adds them to the array etc up to (N-1)^2 (N will be given), this is what I hve so far, I am trying to write an if loop inside to say if it's already in the array then do not add it again but i'm unsure. Any help would be appreciated thanks!

 

proc_cerny1:=proc(A::Matrix,B::Matrix,C::Vector,N)
local x, S, i, j, T, R, y;
x:=(N-1)^2;
S:=Array([]);
S[0]:=C;
i:=0;
j:=0;
while (i<(2^N)) do
T=S[i].A;
S[j]=T;
j=j+1;
R=S[i].B;
S[j]=R;
i=i+1;
for y from 0 to j do
if (S[y]=T) then
S[i]=S[i]-T;
fi:
od:
print(S);
end proc:

My question is: how to find the coordinates of the vertices of a dodecahedron?
I can find the  coordinates of the vertices of a tetrahedron as the solutions of a certain polynomial system in 8 variables (see  tetrahedron.mw for details).
However, that approach seems not to work for a dodecahedron. A new idea is required.

PS. Of course, I have in mind a regular dodecadron.

Hello.

I am novice here and I have an question about export animations frames into sequence of postscript files. I don't googled nothing about this theme.
Here is my question:

Is there an option to convert the animated picture into  sequence of separate images and then (eg using the program cycle) save this images as separate PostScript images? I know the possibility of exporting to GIF file and then converting them into PS file. But I do not have a PS file with a sequence of bitmap images. I would sufficed for me to be able to see a separate frame of animation (through any index).

Thanx Jaroslav Hajtmar

eq1 := y=−26.21231979∗z+15.42332896+13.22411533∗e−.6786000000∗x

eq2 := y=−25.98077423∗z+14.81943362+13.53858145∗e−.6569000000∗x

# Comparing both equations, eliminating y

# Putting z= 0.5044

fsolve(eval(rhs(eq1) = rhs(eq2), z = .5044))

I even done manually as well

-26.21231979*(0.5044)+15.42332896+13.22411533*e^(-.6786000000*x) =
 -25.98077423*(0.5044)+14.81943362+13.53858145*e^(-.6569000000*x)

I cannot find x value?  

But it doesn't evaluate the value of x. Any other solution.

Edit : My main task is to calculate value of x by putting any value of z This is just an example

Say I have the following loops:

for C from 1 to 10 do
    r:=[]:
    for K from 2 to 10 do
    r:=[op(r),2*K+2*C-3];
    end do:
    print(r);
end do:

for C from 1 to 10 do
    r:=[]:
    for K from 2 to 10 do
    r:=[op(r),K*C+K+C-2];
    end do:
    print(r);
end do:

I wonder how could I write a procedure, say use expressions "2*K+2*C-3" and "K*C+K+C-2" as input arguments?

so I can call up like :

 

myfun(K*C+K+C-2) or myfun("K*C+K+C-2")

myfun(2*K+2*C-3)

 

I dont care whether the output(s) are lists, tables, or matrices.

My main difficulty is to get the expression to be procedure inputs.

Though if the output can be a  10 by 9 matrix, it's better.

Thanks,

 

casper

 

Using the fsolve commmand how does one solve for just the positive solutions and remove the dublicate values?

Thanks

First 1496 1497 1498 1499 1500 1501 1502 Last Page 1498 of 2433