Items tagged with programming programming Tagged Items Feed

I need some help fix my mathematics maple code problem , I define everything my Procedures,and procedures run is ok, but when I using call functions for another procedures  I can not operator my program . For sure procedures is work and correct. if somebody can help me , I really appreciate you help.

Greetings to all. I am writing to present a Maple computation that is somewhat of a programming challenge. A recent Post at Math.Stackexchange.Com asked to compute the number of inequivalent colorings of the vertices and edges of a regular hexagon with two colors available for the vertices and three colors for the edges (vertex colors different from edge colors) under the simultaneous action of the dihedral group D6 on the vertices and edges. This is a standard application of Burnside's Lemma and can be computed very straightforwardly using a negligible amount of computing resources. Important: this is the accepted method, it is documented at the MSE link and it works quite well. The answer is that there are 4183 unique configurations.

My purpose in this message is to propose the following task: write a program in your favorite programming language to verify this number by enumerating all possible configurations, computing the orbits of each, and tracking the orbits to eventually arrive at, we hope, the answer, 4183 as stated. This being MaplePrimes the programming language in question is Maple, of course. I implemented the enumeration method and it can be found in the attachments to this message. The algorithm takes about two minutes on the machine that I used and peak memory allocation is about 70 MB. This made for a frustrating debug cycle as it needed a two minute wait to see the result of the changes made to the source code. I therefore decided to use Perl instead of Maple. Imagine my surprise when the very same algorithm (consult attachment) implemented in Perl had a running time on the same machine of about three seconds, used a hash table of about 1.6MB and had resident memory footprint of 6MB. (In fact the hash table can be reduced to half size by simplifying the keys which makes them a bit more difficult to read during debugging.) Let me state it like this: Perl vs. Maple resulted in a speed gain of a factor of forty and a memory savings of 90 percent.

Now how to profit from this experience. A question naturally appears at this point: can we optimize the Maple code so as to bring it into the range of the parameters of the Perl? Here we permit all sorts of optimizations that may occur to the Maple coder other than using Burnside where the motivation is that for many of us including myself there always remain additional Maple programming techniques to learn and acquire. I hope this makes for an enjoyable exercise and I am looking forward to seeing a Maple implementation that can compete with the Perl. This is not code golf but conciseness is a plus.

hex-maple.txt

hex-pl.txt

Happy computing!

Best regards, Marko Riedel

PS: I suspect working with hash tables rather than sets may be a start.

I have two sets 

f:={1,2,3,4};

h:={1,2,4,5}

L=seq(i,i=1..4):

I want to program , if it is true that f[i] = h[i], then it prints f[i]. So the output should be {1,2}.

for i in L do
if evalb(f[i]=h[i]) then
print(f[i]);
end if;
end do;

I get no output. https://i.imgur.com/qA5hU3i.png

I tried changing the set f to list, f:= [1,2,3,4], still no output.

hi.please help me for remove error'' 

Error, illegal use of an object as a name''

 

thanks

PLATE.mw

   

Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

Error, illegal use of an object as a name

"restart:Digits :=15: beta:=10:alpha:=100: xi:=.5: upsilon:=0.2841945289:n:=3: aa:=1:b:=1:N_x:=0.4:N_y:=0.4:N_xy:=0: hl2:=1:mu:=65.8e9:E:=169e9: delta0:=1:delta1:=1: mus:=3:D1:=2;h:=1: lambda:=0.1: D2:=5:A1:=-2:A2:=-2:A3:=-6:A4:=7:A5:=7:A6:=7:A7:=7:A8:=8:A9:=7:A10:=7:A11:=1: A12:=1:tau:=4.730040745:t:=0: g2:=sin(theta):g3:=cos(theta):g1:=cos(theta):a:=0.0:with(Student[Calculus1]): a1:=evalf((A1*ApproximateInt(g3^2,theta=a..1,method=simpson)  ) ) : a2:= evalf(A2*ApproximateInt(g3*((ⅆ)^2)/((ⅆtheta)^2)g3,theta=a..1,method=simpson)): a3:=evalf(A3*ApproximateInt(g3*g3,theta=a..1,method=simpson)) : a4:=evalf(A4*ApproximateInt(g3*g3,theta=a..1,method=simpson)) :a5:=evalf(A5*ApproximateInt(g3^2,theta=a..1,method=simpson)) : a6:=evalf(A6*ApproximateInt(((ⅆ)^2)/((ⅆtheta)^2)g3*g3,theta=a..1,method=simpson)) :a7:=evalf(A7*ApproximateInt(g3*g3,theta=a..1,method=simpson)): a8:=evalf(A8*ApproximateInt(g3^2,theta=a..1,method=simpson)):a9:=evalf(ApproximateInt(A9*(g3*g3 )     ,theta=a..1,method=simpson)) :a10:=evalf(A10*ApproximateInt(g3*g3,theta=a..1,method=simpson)):a11:=evalf(ApproximateInt(1,theta=a..1,method=simpson)):a12:=evalf(ApproximateInt(1*(1-1/2 (1)),theta=a..1,method=simpson)):dsys3 := { f3(x)*(a1)+ f3(x)*(a2)  +((ⅆ)^2)/((ⅆx)^2) f3(x)*(a3) +f3(x)*a4+ f3(x)*(a5) +((ⅆ)^2)/((ⅆx)^2) f3(x)*(a6) +f3(x)*a7= ((ⅆ)^2)/((ⅆx)^2) f3(x) *(a8)   + a9*(ⅆ)/(ⅆx) f3(x) +f3(x)*a10+ a11+a12  , f3(1) =0,f3(0) =0 , D^(1)(f3)(1) = 0, D^(1)(f3)(0)=0,D^(3)(f3)(1) = 0, D^(3)(f3)(0)=0}    :dsol5 := dsolve(dsys3, 'maxmesh'=2024, numeric,abserr=.0001, range=0..1, output=listprocedure):fy3:= eval(f3(x),dsol5):with(CurveFitting):fy33:=PolynomialInterpolation([[0,fy3(0)],[.1,fy3(0.1)],[.2,fy3(0.2)],[0.3,fy3(0.3)],[.4,fy3(0.4)],[.5,fy3(0.5)],[0.6,fy3(0.6)],[0.7,fy3(0.7)],[0.8,fy3(0.8)],[0.9,fy3(0.9)],[1,fy3(1)]],x): d1:=A1*ApproximateInt(((ⅆ)^6)/((ⅆx)^6)fy33*fy33,x=a..1,method=simpson)   :d2:= A2*ApproximateInt(((ⅆ)^4)/((ⅆx)^4)fy33*fy33 ,x=a..1,method=simpson)   :d3:=A3*ApproximateInt(((ⅆ)^2)/((ⅆx)^2)fy33*fy33,x=a..1,method=simpson): d4:= A4*ApproximateInt(fy33*fy33,x=a..1,method=simpson):d5:=A5*ApproximateInt(((ⅆ)^4)/((ⅆx)^4)fy33*fy33,x=a..1,method=simpson)  : d6:=A6*ApproximateInt(((ⅆ)^2)/((ⅆx)^2)fy33*fy33,x=a..1,method=simpson)    :d7:=A7*ApproximateInt(fy33*fy33,x=a..1,method=simpson)  :d8:=A8*ApproximateInt(((ⅆ)^2)/((ⅆx)^2)fy33*fy33,x=a..1,method=simpson)      :d9:=ApproximateInt(A9*(((ⅆ)^1)/((ⅆx)^1)fy33*fy33 )   ,x=a..1,method=simpson) :d10:=A10*ApproximateInt(fy33*fy33,x=a..1,method=simpson)    :d11:=evalf(ApproximateInt(1,theta=a..1,method=simpson)):d12:=evalf(ApproximateInt(1*(1-1/2 (1)),theta=a..1,method=simpson))  : d sys4 := { h3(theta)*(d1)+((ⅆ)^2)/((ⅆtheta)^2) h3(theta)*(d2)+((ⅆ)^4)/((ⅆtheta)^4) h3(theta)*(d3)+ ((ⅆ)^6)/((ⅆtheta)^6) h3(theta)*(d4)+h3(theta) *(d5)+ h3(theta) *(d6) +((ⅆ)^4)/((ⅆtheta)^4) h3(theta)*(d7)= h3(theta)*(d8)  +d9*(ⅆ)/(ⅆtheta) h3(theta)  +((ⅆ)^2)/((ⅆtheta)^2) h3(theta)*(d10)  +d11+d12   ,h3(1) = 0,h3(0) = 0 , D^(1)(h3)(1) = 0, D^(1)(h3)(0)=0,D^(3)(h3)(1) = 0, D^(3)(h3)(0)=0}  :dsol6 := dsolve(dsys4, 'maxmesh'=2024, abserr=.0001, range=0..1, numeric, output=listprocedure):g33:= eval(h3(theta),dsol6):with(CurveFitting):g3:=PolynomialInterpolation([[0,g33(0)],[.1,g33(0.1)],[.2,g33(0.2)],[0.3,g33(0.3)],[.4,g33(0.4)],[.5,g33(0.5)],[0.6,g33(0.6)],[0.7,g33(0.7)],[0.8,g33(0.8)],[0.9,g33(0.9)],[1,g33(1)]],theta):"

 

 

``

 

Download PLATE.mw

Greetings to all. I am writing today to share a personal story / exploration using Maple of an algorithm from the history of combinatorics. The problem here is to count the number of strings over a certain alphabet which consist of some number of letters and avoid a set of patterns (these patterns are strings as opposed to regular expressions.) This counting operation is carried out using rational generating functions that encode the number of admissible strings of length n in the coefficients of their series expansions. The modern approach to this problem uses the Goulden-Jackson method which is discussed, including a landmark Maple implementation from a paper by D. Zeilberger and J. Noonan, at the following link at math.stackexchange.com (Goulden-Jackson has its own website, all the remaining software described in the following discussion is available at the MSE link.) The motivation for this work was a question at the MSE link about the number of strings over a two-letter alphabet that avoid the pattern ABBA.

As far as I know before Goulden-Jackson was invented there was the DFA-Method (Deterministic Finite Automaton also known as FSM, Finite State Machine.) My goal in this contribution was to study and implement this algorithm in order to gain insight about its features and how it influenced its powerful successor. It goes as follows for the case of a single pattern string: compute a DFA whose states represent the longest prefix of the pattern seen at the current position in the string as it is being scanned by the DFA, with the state for the complete pattern doubling as a final absorbing state, since the pattern has been seen. Translate the transitions of the DFA into a system of equations in the generating functions representing strings ending with a given maximal prefix of the pattern, very much like Markov chains. Finally solve the system of equations for the generating functions and thus obtain the sequence of values of strings of length n over the given alphabet that avoid the given pattern.

I have also implemented the DFA method for sets of patterns as opposed to just one pattern. The algorithm is the same except that the DFA does not consist of a chain with backlinks as in the case of a single pattern but a tree of prefixes with backlinks to nodes higher up in the tree. The nodes in the tree represent all prefixes that need to be tracked where obviously a common prefix between two or more patterns is shared i.e. only represented once. The DFA transitions emanating from nodes that are leaves represent absorbing states indicating that one of the patterns has been seen. We run this algorithm once it has been verified that the set of patterns does not contain pairs of patterns where one pattern is contained in another, which causes the longer pattern to be eliminated at the start. (Obviously if the shorter pattern is forbidden the so is the longer.) The number of states of the DFA here is bounded above by the sum of the lengths of the patterns with subpatterns eliminated. The uniqueness property of shared common prefixes holds for subtrees of the main tree i.e. recursively. (The DFA method also copes easily with patterns that have to occur in a certain order.)

I believe the Maple code that I provide here showcases many useful tricks and techniques and can help the reader advance in their Maple studies, which is why I am alerting you to the web link at MSE. I have deliberately aimed to keep it compatible with older versions of Maple as many of these are still in use in various places. The algorithm really showcases the power of Maple in combinatorics computing and exploits many different aspects of the software from the solution of systems of equations in rational generating functions to the implementation of data structures from computer science like trees. Did you know that Maple permits nested procedures as known to those who have met Lisp and Scheme during their studies? The program also illustrates the use of unit testing to detect newly introduced flaws in the code as it evolves in the software life cycle.

Enjoy and may your Maple skills profit from the experience!

Best regards,

Marko Riedel

The software is also available here: dfam-mult.txt

 

ANALYSIS AND DESIGN OF MACHINE FOUNDATION

 


restart

Loading Optimization

 

Loading LinearAlgebra  

 

Loading plots  

with(ScientificConstants):

Loading DynamicSystems  

with(Units:-Standard)

with(Units:-Natural)

with(StringTools)

FormatTime("%m-%d-%Y, %H:%M")

FormatTime("%m-%d-%Y, %H:%M")

(1)

NULL

Introduction

 

This document deals with vibration analysis and design of machine foundations subjected to dynamic load.

NULL

NULL

NULL

NULL

GetConstant(g);

standard_acceleration_of_gravity, symbol = g, value = 9.80665, uncertainty = 0, units = m/s^2

(2)

g__SI := evalf(Constant(g, system = SI, units))

9.80665*Units:-Unit(('m')/('s')^2)

(3)

NULL

Richart and Lysmer's Model

 

Richart et al. (1970) idealised the foundation as a lumped mass supported on soil which is idealised as frequency independent springs which he described in term of soil parameter

dynamic shear modulus or shear wave velocity of the soil for circular footing when footings having equivalent circular radius. The Tables below shows the different values of spring and damping vlaues as per Richart and Lysmer.

NULL

In which, G = dynamic shar modulus of he soil and is given G = `ρ__s`*V__s^2 ; ν = Piosson's ratio of the soil; ρs = mass density of the soil; Vs = shear wave velocity of the soil obtained

from soil testing; g = acceleration due to gravity; m = mass of the machine and foundation; J = mass moment of inertia of the machine and foundation about the appropriate axes; K = equivalent spring stiffness of the soil; C = damping value of the soil; B = interia factor contributing to the damping factor; D = damping ratio of the soil; r = equivalent radius of a circular foundation; L = length of foundation, and B = width of the foundation.

NULL

NULL

NULL

Sketch

 

NULL

NULL

NULL

NULL

nu := .25

Table : Values of soil springs as per Richart and Lysmer (1970) model

 

NULL

NULL

SI No.

Direction

Spring value

Equivalent radius

Remarks

1

Vertical

K__z = 4*G*r__z/(1-nu)"(->)"

r__z = sqrt(L*B/Pi)"(->)"

This is in vertical Z direction

2

Horizontal

K__x = (32*(1-nu))*G*r__x/(7-8*nu)
"(->)"

r__x = sqrt(L*B/Pi)"(->)"

This induce sliding in horizontal X

2.1

Horizontal

K__y = (32*(1-nu))*G*r__y/(7-8*nu)
"(->)"

r__y = sqrt(L*B/Pi)"(->)"

This induce sliding in horizontal Y

3

Rocking

`K__φx` = 8*G*`r__φx`^3/(3*(1-nu))"(->)"

`r__φx` = (L*B^3/(3*Pi))^(1/4)"(->)"

This produces roxking about Y axis

3.1

Rocking

`K__φy` = 8*G*`r__φy`^3/(3*(1-nu))"(->)"

`r__φy` = (L^3*B/(3*Pi))^(1/4)"(->)"

This produces roxking about X axis

4

Twisting

`K__ψ` = 16*G*`r__ψ`^3*(1/3)"(->)"

`r__ψ` = ((B^3*L+B*L^3)/(6*Pi))^(1/4)
"(->)"

This produces twisting about vertical Z axis

 

NULL

NULL

NULL

NULL

NULL

Table : Values of soil damping as per Richart and Lysmer (1970) model

 

NULL

SI No.

Direction

Mass ratio (B)

Damping ratio and Damping values

Remarks

1

Vertical

B__z = .25*m__U*(1-nu)*g__SI/(`ρ__s`*r__z^3)
"(->)"

`ζ__z` = .425/sqrt(B__z)"(->)"C__z = 2*`ζ__z`*sqrt(K__z*m__U)"(->)"

This damping value is in vertical Z direction

2

Horizontal

B__x = (7-8*nu)*m__U*g__SI/((32*(1-nu))*`ρ__s`*r__x^3)
"(->)"

`ζ__x` = .288/sqrt(B__x)"(->)"

C__x = 2*`ζ__x`*sqrt(K__x*m__U)"(->)"

This damping value is in lateral X direction

2.1

Horizontal

B__y = (7-8*nu)*m__U*g__SI/((32*(1-nu))*`ρ__s`*r__y^3)
"(->)"

`ζ__y` = .288/sqrt(B__y)"(->)"

`ζ__y` = .288/((2.145204688-2.451662500*nu)*m__U*Units:-Unit(('m')/('s')^2)/((1-nu)*`ρ__s`*(L*B/Pi)^(3/2)))^(1/2)

(5.1)

NULLError, invalid left hand side in assignmentError, invalid left hand side in assignment

`ζ__ψ` = .5/(1+117.6798000*`J__ψ`*Units:-Unit(('m')/('s')^2)*6^(1/4)/(`ρ__s`*((B^3*L+B*L^3)/Pi)^(5/4)))

(5.2)

C__y = 2*`ζ__y`*sqrt(K__y*m__U)"(->)"

This damping value is in lateral Y direction

3

Rocking

`B__φx` = (.375*(1-nu))*`J__φx`*g__SI/(`ρ__s`*`r__φx`^5)
"(->)"

`ζ__φx` = .15/((1+`B__φx`)*sqrt(`B__φx`))
"(->)"

`ζ__φx` = .15/((1+11.03248125*(1-nu)*`J__φx`*Units:-Unit(('m')/('s')^2)*3^(1/4)/(`ρ__s`*(L*B^3/Pi)^(5/4)))*((11.03248125-11.03248125*nu)*`J__φx`*Units:-Unit(('m')/('s')^2)*3^(1/4)/(`ρ__s`*(L*B^3/Pi)^(5/4)))^(1/2))

(5.3)

Error, invalid left hand side in assignmentError, invalid left hand side in assignmentNULLError, invalid left hand side in assignment

.15/((1+11.03248125*(1-nu)*`J__φx`*Units:-Unit(('m')/('s')^2)*3^(1/4)/(`ρ__s`*(L*B^3/Pi)^(5/4)))*((11.03248125-11.03248125*nu)*`J__φx`*Units:-Unit(('m')/('s')^2)*3^(1/4)/(`ρ__s`*(L*B^3/Pi)^(5/4)))^(1/2)) = .15/((1+11.03248125*(1-nu)*`J__φx`*Units:-Unit(('m')/('s')^2)*3^(1/4)/(`ρ__s`*(L*B^3/Pi)^(5/4)))*((11.03248125-11.03248125*nu)*`J__φx`*Units:-Unit(('m')/('s')^2)*3^(1/4)/(`ρ__s`*(L*B^3/Pi)^(5/4)))^(1/2))

(5.4)

`C__φx` = 2*`ζ__φx`*sqrt(`K__φx`*`J__φx`)"(->)"

NULL

This damping value is for rocking about Y direction

3.1

Rocking

`B__φy` = (.375*(1-nu))*`J__φy`*g__SI/(`ρ__s`*`r__φy`^5)
"(->)"

NULL

`ζ__φy` = .15/((1+`B__φy`)*sqrt(`B__φy`))
"(->)"

.15/((1+`B__φy`)*`B__φy`^(1/2)) = .15/((1+`B__φy`)*`B__φy`^(1/2))

(5.5)

`C__φy` = 2*`ζ__φy`*sqrt(`K__φy`*`J__φy`)"(->)"

NULL

This damping value is for rocking about X direction

4

Twisting

`B__ψ` = `J__ψ`*g__SI/(`ρ__s`*`r__ψ`^5)"(->)"

`ζ__ψ` = .5/(1+2*`B__ψ`)"(->)"NULLError, invalid left hand side in assignmentError, invalid left hand side in assignmentNULLError, invalid left hand side in assignmentNULLError, invalid left hand side in assignment

.5/(1+117.6798000*`J__ψ`*Units:-Unit(('m')/('s')^2)*6^(1/4)/(`ρ__s`*((B^3*L+B*L^3)/Pi)^(5/4))) = .5/(1+117.6798000*`J__ψ`*Units:-Unit(('m')/('s')^2)*6^(1/4)/(`ρ__s`*((B^3*L+B*L^3)/Pi)^(5/4)))

(5.6)

`C__ψ` = 2*`ζ__ψ`*sqrt(`K__ψ`*`J__ψ`)"(->)"NULL

``

NULL

This damping value is valid for twisting about vertical Z axis

 

NULL

NULL

NULLNULL

(4)

``

NULL

Vertical Motion Considering damping of the Soil

 

For vertical direction the equation becomes that of a lumped mass having single degree of freedom when

deq := m__U*(diff(z(t), t, t))+'C__z'*(diff(z(t), t))+'K__z'*`#mi("z")` = P__0*sin(`ω__m`*t)

m__U*(diff(diff(z(t), t), t))+C__z*(diff(z(t), t))+K__z*`#mi("z")` = P__0*sin(`ω__m`*t)

(6.1)

NULL

t1 := subs(P__0*sin(`ω__m`*t)/m__U = F, expand(deq/m__U));

diff(diff(z(t), t), t)+1.085721853*(G*(L*B/Pi)^(1/2)*m__U/(1-nu))^(1/2)*(diff(z(t), t))/(m__U*(m__U*Units:-Unit(('m')/('s')^2)/(`ρ__s`*(L*B/Pi)^(3/2))-m__U*Units:-Unit(('m')/('s')^2)*nu/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2))+4*G*(L*B/Pi)^(1/2)*`#mi("z")`/(m__U*(1-nu)) = F

(6.2)

NULL

(6.3)

By algebraically manipulating the expression, the form traditionally used by engineers is derived:

t2 := algsubs('C__z'/m__U = 2*zeta*omega, t1)

diff(diff(z(t), t), t)-(-1.085721853*(-G*(L*B/Pi)^(1/2)*m__U/(nu-1))^(1/2)*(diff(z(t), t))*nu+1.085721853*(-G*(L*B/Pi)^(1/2)*m__U/(nu-1))^(1/2)*(diff(z(t), t))+4.*G*(L*B/Pi)^(1/2)*`#mi("z")`*(-Units:-Unit(('m')/('s')^2)*(nu-1)*m__U/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2))/((nu-1.)*(-Units:-Unit(('m')/('s')^2)*(nu-1)*m__U/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2)*m__U) = F

(6.4)

NULL

t3 := algsubs('K__z'/m__U = omega^2, t2)

diff(diff(z(t), t), t)-(-1.085721853*(-G*(L*B/Pi)^(1/2)*m__U/(nu-1))^(1/2)*(diff(z(t), t))*nu+1.085721853*(-G*(L*B/Pi)^(1/2)*m__U/(nu-1))^(1/2)*(diff(z(t), t))+4.*G*(L*B/Pi)^(1/2)*`#mi("z")`*(-Units:-Unit(('m')/('s')^2)*(nu-1)*m__U/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2))/((nu-1.)*(-Units:-Unit(('m')/('s')^2)*(nu-1)*m__U/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2)*m__U) = F

(6.5)

This form includes the damping ratio , the natural frequency , and the external forcing term .  Consider only free vibration by setting

gen3 := subs(F = 0, t3)

diff(diff(z(t), t), t)-(-1.085721853*(-G*(L*B/Pi)^(1/2)*m__U/(nu-1))^(1/2)*(diff(z(t), t))*nu+1.085721853*(-G*(L*B/Pi)^(1/2)*m__U/(nu-1))^(1/2)*(diff(z(t), t))+4.*G*(L*B/Pi)^(1/2)*`#mi("z")`*(-Units:-Unit(('m')/('s')^2)*(nu-1)*m__U/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2))/((nu-1.)*(-Units:-Unit(('m')/('s')^2)*(nu-1)*m__U/(`ρ__s`*(L*B/Pi)^(3/2)))^(1/2)*m__U) = 0

(6.6)

NULL

sol1 := dsolve({gen3, z(0) = P, (D(z))(0) = V}, z(t))

z(t) = -(1000000000/1178791942081753609)*Pi*m__U*exp(-(1085721853/1000000000)*Units:-Unit(('s')/('m')^(1/2))*t/(Pi*((nu-1)^2/(`ρ__s`*L^2*B^2*G))^(1/2)*m__U))*(1085721853*V*Units:-Unit(('s')/('m')^(1/2))*((nu-1)^2/(`ρ__s`*L^2*B^2*G))^(1/2)*`ρ__s`*L^2*B^2-4000000000*(L*B/Pi)^(1/2)*Pi*nu*`#mi("z")`+4000000000*`#mi("z")`*Pi*(L*B/Pi)^(1/2))/(Units:-Unit(('s')/('m')^(1/2))^2*B^2*L^2*`ρ__s`)+(4000000000/1085721853)*`#mi("z")`*G*Pi*(L*B/Pi)^(1/2)*((nu-1)^2/(`ρ__s`*L^2*B^2*G))^(1/2)*t/((nu-1)*Units:-Unit(('s')/('m')^(1/2)))+(1/1178791942081753609)*(1085721853000000000*V*Units:-Unit(('s')/('m')^(1/2))*Pi*((nu-1)^2/(`ρ__s`*L^2*B^2*G))^(1/2)*m__U*`ρ__s`*L^2*B^2+1178791942081753609*Units:-Unit(('s')/('m')^(1/2))^2*P*`ρ__s`*L^2*B^2-4000000000000000000*(L*B/Pi)^(1/2)*Pi^2*m__U*nu*`#mi("z")`+4000000000000000000*`#mi("z")`*Pi^2*(L*B/Pi)^(1/2)*m__U)/(B^2*L^2*`ρ__s`*Units:-Unit(('s')/('m')^(1/2))^2)

(6.7)

NULL

NULL

 

Download Analysis_and_Design_of_Machine_Foundations_1.mw

Good Morning Mapleprime Community,

Would anybody please help in the attached worksheet. I'm trying to use the new function in Maple that is the clicable method, but I was having problem in some of my output such as zeta_y and zeta_phi as this two equations are generating an error message.

 

Regards,

Moses

hi,

i'm trying to figure out where i did a mistake by coding reducedEchelonForm.

with(LinearAlgebra):
reduced:=proc(M)
 local l:=1, m:=RowDimension(M),n:=ColumnDimension(M),i,j; # l current column
 for i from 1 to m do # going trough every row item
  if n<l then # ColumnDimension need to be bigger than current column
   return M;
  end if;
 j:=i; # given current row item
 while M[j,l]=0 do # search for first rom item unequal zero
  j:=j+1;
  if m<j then # end of row
   j=i;
   l=l+1;
   if n<l then # end of rows and columns -> finish
    return M;
  end if;
 end if;
end do;
M:= perm(m,n,j,i).M; #permute row j and i
if not(M[i,l]=0) then # multiply row i with M[i,l])^(-1)
 M:= multiplikation(m,n,i,(M[i,l])^(-1)).M;
end if;
for j from 1 to m do # subtract every row j with row i for M[j,l]-times
 if not(j=i) then
  M:= addition(m,n,j,i,-M[j,l]).M;
 end if;
end do;
l:=l+1; # increase l by 1, next iteration i increase either
end do;
end proc:

 

Hint: perm(...),multiplikation(...) and addition(...) are the elementary matrices. They are working.

 

Now i got an error by running it: 

L:=Matrix(2,3,[1,2,3,4,5,6]);
reduced(L);
Error, (in reduced) invalid left hand side in assignment

Can someone explain me these error? And maybe a hint what i need to fix in my code?

Greets felix

the expression

sN=a1+a2+...+aN

for k from 1 to N do

psum=psum+a(n);

end do;

s[k]:=psum;

end do:

 

how do we transform this using only one loop?

 

thanks

Hello all,

here the programme I think there are some mistakes couldnot know where please any comment will be helpful:

# Firstly, set the size limit for the grid, which shall define how many
# points there are in both the vertical and horizontal direction
size=40;
# limit is a variable used to set an unobtainable upper bound
limit=size+1;
# x defined, starting at 1, and two other variables ud (upper diagonal) and
# dd (downward diagonal) begin at 0. All three are used to iterate through
# line creation

x=1;
ud=0;
dd=0;
# Iteration through x, using the line function to create a number of
# horizontal lines up to the limit point

while(x<(limit))
line([0, size], [x, x]);
x=x+1;
end

# Now iterating through the diagonals pointing upwards, using two sets of
# lines, both starting from the line going through the origin. The first
# iterates through the lines that pass through positive x values at y=0,
# the second iterates through the lines passing through negative x values
# at y=0
# ud must be increased by 2 each time to ensure that equilateral triangles
# are formed.

while(ud<(limit))
line([(ud), (size)], [0, (size-ud)]);
line([0, (size-ud)], [(ud), (size)]);
ud=ud+2;
end

# Similar to before, except this time iterating through downward pointing
# diagonals.

while(dd<(limit))
line([(dd), 0], [0, (dd)]);
line([(size), (dd)], [(dd), (size)]);
dd=dd+2;
end

# xvector and yvector set up as two vectors holding x and y co-ordinates of
# points respectively.

xvector = zeros(1, limit);
yvector = zeros(1, limit);

# Reinitiallising x and y values for iterative purposes.

x=0;
y=0.5;
n=1;

# The program now iterates through potential y values for the potential
# points. Then it tests the value of y to see what orientation the lattice
# is at that point, then randomly selects x values to enter, iterating
# between all the possible x values in the orientation before moving on to
# the next y value.

while(y<size)
if(mod(y,1)==0.5)
x=0.5;
while(x<size)
z=rand;
if(z>0.5)
xvector(n) =x;
yvector(n) =y;
n=n+1;
end
x=x+1;
end
elseif(mod(y,2)==1)
x=0;
while(x<size)
z=rand;
if(z>0.5)
xvector(n) =x;
yvector(n) =y;
n=n+1;
end
x=x+2;
end
else
x=1;
while(x<size)
z=rand;
if(z>0.5)
xvector(n) =x;
yvector(n) =y;
n=n+1;
end
x=x+2;
end
end
y=y+0.5;

end

# The program then enters the two co-ordinate vectors saved previously into
# the scatter function.

hold;
scatter(xvector, yvector);

Hi,

I have a linear mathematical model that is in deterministic form, but actually one of the input parameters has a stochastic nature and follows a log normal distribution function. and I need to include this in the formulation. Please help me with this questions:

1) Do I need to use stochastic programming methods to solve it? if yes, how?

2) How can I include the distribution function in my model?

3) Can I solve the these kinds of problems using Maple?

Hi, currently im using maple 15

the coding did work but it is not the same with the answer
here, i attach the coding with the answer

coding:
derivation := proc (A, n)
local i, j, k, t, s1, s2, m, D, sols, eqns, Andre;
eqns := {};
D := matrix(n, n);
Andre := matrix(n, n);
for i to n-1 do
for j from i+1 to n do
for m to n do
s1 := sum(A[i, j, k]*D[m, k], k = 1 .. n);
s2 := sum(A[k, j, m]*D[k, i]+A[i, k, m]*D[k, j], k = 1 .. n);
eqns := `union`(eqns, {s1 = s2})
end do end do end do;
sols := [solve(eqns)];
t := nops(sols);
for i to t do
for j to n do
for k to n do
Andre[k, j] := subs(sols[i], D[k, j])
end do end do;
print(Andre)
end do end proc

the maple result showing:

> AS1 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 1, 2) = 1]);

> derivation(AS1, 2);
[D11 0]
[D21 D22]

> AS2 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 1, 1) = 1, (1, 2, 2) = 1]);
> derivation(AS2, 2);
[0 D12]
[D21 D22]

the maple should showing

> derivation(AS1, 2);
[D11 0]
[D21 2D11]

> AS2 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 1, 1) = 1, (1, 2, 2) = 1]);
> derivation(AS2, 2);
[0 0]
[D21 D22]

please help., thank you

Is it possible to create a sumif function, like the one in excel?

For bonus in my one class, we are required to change the code in a program to have it produce another row when running Neville's Method. We need to, after it runs initially, have it ask "Run another time? Y/N" and type 'Y' or 'N' for Yes or No. If No, it ends the program. If yes, we need to have it input another x(i) and f(x(i)) without having to input all the other data points again. Here is what I have so far (this is just the additional part we have to add, not the whole code):

 print(`Do you want another point? Type Y or N.`):
  J := scanf(` %c`)[1]:print(`Entry = `):print(J):
  if J = "Y" or J="y" then
  AGAIN := "Y":
  AGAIN = "Y" or AGAIN = "y":
        OUP := default:
      fprintf(OUP, `NEVILLE'S METHOD\n `):
       fprintf(OUP, `Table for P evaluated at X = %12.8f , follows: \n`, X):
       fprintf(OUP, `Entries are XX(I), Q(I,0), ..., Q(I,I) `):
       fprintf(OUP, `for each I = 0, ..., N where N = %3d\n\n`, N):
       for I1 from 0 to N+1 do
         fprintf(OUP, `%11.8f `, XX[I1]):
         for J from 0 to I1 do
           fprintf(OUP, `%11.8f `, Q[I1,J]):
         od:
         fprintf(OUP, `\n`):
        od:
    if J="Y" or J="y" then
         AGAIN := Y:
             if AGAIN = Y or AGAIN = y then
                 #N=N+1:
                  if N > 0 then
                  OK := TRUE:
                 for I1 from N to N+1 do
                        print(`Input X(i) and F(X(i)) for i = `):print(I1):
                        print(`separated by a space `):
                       XX[I1] := scanf(`%f`)[1]:
                       Q[I1,0] := scanf(`%f`)[1]:print(`Entries are`):print(XX[I1],Q[I1,0]):
                  od:
                else
                  print(`Number must be a positive integer `):
               fi:


            else
                AGAIN := No:     
         fi:
         fi:
    else
        print(`Ok thanks`):
 fi:

Not sure what I am doing wrong and any help is appreciated. Thanks.

How do I write a procedure to find a root of f(x)=0 in the vicinity of a given value x0. The procedure should initially use the rearrangement method to produce a linearly convergent sequence of values, and should, when appropriate, switch to Aitkin's Method. The input for the procedure should be the re-arranged function and the velue for x0. The output should be the root and the number of iteration taken. The procedure should check that re-arrangement will converge. This program should do in Maple V Release5.

Thank you for your help.

 

the program is not recognized kthe program is not recognized the k

1 2 3 4 5 6 7 Last Page 1 of 9