C_R

1461 Reputation

19 Badges

4 years, 9 days

MaplePrimes Activity


These are answers submitted by C_R

Find attached a fix with

Don't ask me what's wrong with R.

Update: I have just seen that you found it.

Download MY_Code_fix.mwMY_Code_fix.mw

For a solution including C add this to the end of your worksheet

restart;
C = ((np/Kp + nw/Kw + ng/Kg)/(`ρg`*ng + `ρp`*np + `ρw`*nw))^(1/2);
isolate(%, ng);

The restart removes the assignement to C which is the reason for the output 0=0, which is a strange way of saying that the left hand side and the rigth hand side of the equation are identical.

The solution of your first isolate statement is correct

((np/Kp + nw/Kw + ng/Kg)/(`ρg`*ng + `ρp`*np + `ρw`*nw))^(1/2);
isolate(%, ng);
simplify(subs(%, `%%`));

 

Assuming that C is real valued there are 3 solutions if and only if C>1.

You can see this in the intersection points of the two curves.

There is no explicit for solution for the equation and therefore Maple returns the RootOf expression

eq := X = sin(C*X)

X = sin(C*X)

(1)

subs(C = 2, eq)

X = sin(2*X)

(2)

plot({lhs(X = sin(2*X)), rhs(X = sin(2*X))}, X = -1 .. 1)

 

solve(X = sin(2*X), X)

sin(RootOf(_Z-2*sin(_Z)))

(3)

solve(evalf(X = sin(2*X)), X, allsolutions)

.9477471335, -.9477471335, 0.

(4)

NULL

Download x_eq_sin_cx.mw

Update:

To be more precise I should have added that when C is increased fruther more roots apprear (with an increment of 2) as solutions in the interval -1..1.

 

  1. Use OCR text recognition to create a text file. Pay close attention to characters that may appear similar, such as D, O, Q, and 0.

  2. Preserve the first six characters for the comment character C and line numbers, as these are important for the goto jumps.

  3. Convert the Fortran code to C using a tool that eliminates all gotos. f2c is a commonly used tool for this purpose and supposed to replace gotos by flow statement (if while, ...). I have never used it.

  4. After translating to C, manually convert the code to Maple statements, as there seems to be no import feature for this.

Or see if the attached file (without OCR proofreading) makes any sense and can be used

LocalMin := proc (f::function, a::numeric, b::numeric, eps::numeric, t::numeric) local sa, sb, x, w, v, e, fx, fw, fv, m, tol, t2, r, q, p, u, fu; sa := a; sb := b; x := sa+.381966*(S8-sa); w := x; v := w; e := 0.; fx := f(x); fw := fx; fv := fw; m := .5*(sa+sb); tol := eps*abs(x)+t; t2 := 2.0*tol; while t2+(-1)*.5*(sb-sa) < abs(x-m) do r := 0.; q := r; p := q; if tol < abs(e) then r := (x-w)*(fx-fv); q := (x-v)*(fx-fw); p := (x-v)*q-(x-w)*r; q := 2.0*(q-r); if 0 < q then p := -p else q := -q end if; if q*(sa-x) < p and p < q*(sb-x) then d := p/q; u := x+d; if u-sa < t2 or sb-u < t2 then d := abs(tol) end if else if m <= x then d := sa-x else d := sb-x end if; d := .381966*d; u := x+d end if; if abs(d) < tol then u := x+abs(tol)*sign(d) end if else if m <= x then d := sa-x else d := sb-x end if; d := .381966*d; u := x+d; if abs(d) < tol then u := x+abs(tol)*sign(d) end if end if; fu := f(u); if fu <= fx then if x <= u then sa := x else sb := x end if; v := w; fv := fw; w := x; fw := fx; x := u; fx := fu else if u < x then sa := u else sb := u end if; if fu <= fw or w = x then v := w; fv := fw; w := u; fw := fu else if fu <= fv or v = x or v = w then v := u; fv := fu end if end if end if end do; return fx end proc

proc (f::function, a::numeric, b::numeric, eps::numeric, t::numeric) local sa, sb, x, w, v, e, fx, fw, fv, m, tol, t2, r, q, p, u, fu, d; sa := a; sb := b; x := sa+.381966*(S8-sa); w := x; v := w; e := 0.; fx := f(x); fw := fx; fv := fw; m := .5*(sa+sb); tol := eps*abs(x)+t; t2 := 2.0*tol; while t2+(-1)*.5*(sb-sa) < abs(x-m) do r := 0.; q := r; p := q; if tol < abs(e) then r := (x-w)*(fx-fv); q := (x-v)*(fx-fw); p := (x-v)*q-(x-w)*r; q := 2.0*(q-r); if 0 < q then p := -p else q := -q end if; if q*(sa-x) < p and p < q*(sb-x) then d := p/q; u := x+d; if u-sa < t2 or sb-u < t2 then d := abs(tol) end if else if m <= x then d := sa-x else d := sb-x end if; d := .381966*d; u := x+d end if; if abs(d) < tol then u := x+abs(tol)*sign(d) end if else if m <= x then d := sa-x else d := sb-x end if; d := .381966*d; u := x+d; if abs(d) < tol then u := x+abs(tol)*sign(d) end if end if; fu := f(u); if fu <= fx then if x <= u then sa := x else sb := x end if; v := w; fv := fw; w := x; fw := fx; x := u; fx := fu else if u < x then sa := u else sb := u end if; if fu <= fw or w = x then v := w; fv := fw; w := u; fw := fu else if fu <= fv or v = x or v = w then v := u; fv := fu end if end if end if end do; return fx end proc

(1)

NULL


Download bard.mw

Good luck

Add this to your worksheet

EQlist := [eq10, eq11, eq12, eq13, eq14, eq15, eq16]:
{seq(i = op(0, i), i in indets(%, function(identical(t))))};
subs(%, EQlist);

The line in the middle creates a replacement set for any set of equations.

Taking x<=y and y<=z as the two inequaltities the region inside the cube looks like this

Here I have only added two equations to Kitonums answer for the cube

plots:-implicitplot3d(max(x - y, -y + z, -x, x - 1, -y, y - 1, -z, z - 1), x = -0.5 .. 1.5, y = -0.5 .. 1.5, z = -0.5 .. 1.5, style = surface, shading = z, axes = normal, grid = [100, 100, 100]);

Update:

I made a sign error in the above plot command. It should be

plots:-implicitplot3d(max(x - y, y - z, -x, x - 1, -y, y - 1, -z, z - 1), x = -0.5 .. 1.5, y = -0.5 .. 1.5, z = -0.5 .. 1.5, style = surface, shading = z, axes = normal, grid = [100, 100, 100])

The ployhedron above only has 4 surfaces. Therefore 4 inequalties are sufficient.

0 <= x and z <= 1 and x <= y and y <= z
plots:-implicitplot3d(max(x - y, y - z, -x, z - 1), x = -0.5 .. 1.5, y = -0.5 .. 1.5, z = -0.5 .. 1.5, style = surface, shading = z, axes = normal, grid = [100, 100, 100]);

The forget command can be used to clear remember tables and therefore free memory.

You could try it within the loop before the next iteration.

Its not fully clear what you want to achieve. Partly because your model does not simulate, and so the result window does not show the structure of your assembly.

However, I can give some recommendations:

  • Make yourself familiar with the flexible beam component with simple cases. It’s a sophisticated component with many parameters that must be set correctly. I have attached double-sided clamped beams which can serve as a first building block to simulate an over-constrained structure.
  • Try to model one rail before adding the second rail.
  • Instead of using the flexible beam frame component use several flexible beam components. I.e. wherever you add a support (a sleeper) or a force, split the flexible beam in two parts. This makes life easier, and a better approximation can be achieved with overall fewer elastic coordinates (see next bullet point).
  • Pay attention to the elastic coordinates. For an over-constrained structure, you need higher numbers. EC=1 won’t work for your problem (and also not for the attached models). Set also elastic coordinates to zero that you do not need to speed up calculation.
  • Make sure that the profile of the rail is correctly oriented to the coordinate frames you use.
  • Each time you increase the complexity of your model save a version.

I hope this helps

 

Double_sided_clamped_beam.msim

Double_sided_clamped_beam_with_prismatic_joint.msim

If your question is about designing a block diagram:

To model something in MapleSim, you need a design or concept. Do you have something like that?

If so, then each (essential) functional element has to be represented by MapleSim components. These components could be referred to as blocks but they are special in the sense that connections between components do not have arrows (the components are acausal).

If you really want a block diagram with arrows like in Simulink you have to use MapleSims Signal Blocks (but then you miss out the simplicity of physical modeling with MapleSim).

If your question is about importing existing block diagrams:

Here is a recent post on MapleSim BlockImporter.

You have to connect the prescibel motion drivers for translation and rotation in series.

See the attached
Spatial_Motion2_fix.msim

If your block is a linear time invariant system you could try to export it to a file with the option S-function.

If this file is readable you could try to extract the coefficients and enter them into Transferfunction component of MapleSim.

See help(componentLibrary,signalBlocks,continuous,TransferFunction)

I do not have Simulink so I can't try it myself.

Using a reduced set of assumptions

f:=(theta*x-1)*(1-x)*(1+beta*x^2)-y;
params:=theta=5,y=2/10;
assump:=0<beta,beta<1;
solve({subs(params,f),assump},x);

Maple 2023 returns the 4 roots within 0<beta<1. I could not manage to reduce the number of roots with the other assumptions. The assumption 1/5<x<1 does not fit to the 3rd and 4th root which seem to be complex. Maple somehow cannot detect this.

Nothing in the help system.

I got this from the web:

In Maple, debugger/no_output is a command-line option that can be used to suppress the output produced by the Maple debugger. When the debugger command is used to debug a Maple procedure or module, Maple will normally print debugging information to the console or worksheet as the program executes. However, by adding the no_output option to the debugger command, you can suppress this output.

I don't know if it makes sense. Apparently it's from Maple 2021 but all the links are broken.

Your are trying to solve this

solve([x[1]/2, (2*x[2])/9, -1], {x[1], x[2], x[3]});

Solve does not return an answer because of the thrid "equation" and the subsequent command throws an error.

Pasting your code snippet in 2D-Math and converting it to 1D-Math results in

`??` := 1;
`??` := 2;
`??` := 3;
`??` + `??`;
                            ?? := 1

                            ?? := 2

                            ?? := 3

                               6

All Babyloninan numerals are replaced by a double tofu (i.e. internaly represented by the symbol `??`). There are no individual representations for 𒐕, 𒐖 and 𒐗. Since the last assignment to `??`is 3 the sum becomes 6.

The fact that the Maple paraser converts some unicode characters to `??` means nothing else that not all characters are supported at the moment.

&#9785;

1 2 3 4 5 6 7 Page 3 of 7