C_R

3527 Reputation

21 Badges

6 years, 53 days

MaplePrimes Activity


These are replies submitted by C_R

@TechnicalSupport 

Thank you for the feedback. The below is what I had in mind to address transfer functions that start with 180 phase lag

with(DynamicSystems)

G := .9/s^2

.9/s^2

(1)

H := 2/(2+s)

2/(2+s)

(2)

PhasePlot(TransferFunction(G*H))

 

NULL

F:=G*H:
A:=PhasePlot(TransferFunction(G*H),output=data):
if (limit(subs(s=I*omega,F),omega=0)=Float(-infinity)) then A[..,2]:=A[..,2]-~360 end if;
plot(A,axis[1]=[mode=log]);

_rtable[36893490812442446412]

 

 

NULL

Download Phaseplot_workaround.mw

@acer 

That was tricky. It worked also for me. I should have asked earlier. Thank you!

By the way: Playing around with the file I send (to fully understand the behavior) crashed the Maple session that was running uneventful for 6 days.

@rquirt

It possible to have a close look at the code of PhasePlot with

showstat(DynamicSystems:-PhasePlot)

(I do not know if that is possible with Mapleflow.)

  11       phases := map2(map,z -> Re(argument(z)),Af);
  12       if not radians then
  13           phases := map(V -> evalf(180/Pi)*V,phases)
             end if;
  14       map(DynamicSystems:-PhasePlot:-unwrap,phases,radians)

The phase is calculated with the argument function which is defined over -pi..pi.
I think what is happening in your case is the following:

Phaseplot determines the first plot value for z with a phase value slightly lower than -180 (say -180.1111). For that z value the argument function determines 179.9999 degree.

Since it is the first value in a list of phase values the unwrap function cannot detect a phase jump larger pi (almost 2 pi in your case). Unwrap, which makes phase values smaler than -180 possible in your second example is therefore not effective on your first case.

The case where the phase is -180 degree for frequencies approching zero needs to be treated differently from Phaseplot.
Worth a software change request. It is clearly a weakness.

@sand15 

I send a SCR

@sand15 

Thank you for the answer. I still have it with Maple 2025. This seems to be a regression and migth explain other things I saw with typesetting recently that did not make sense to me.

I will report this.

kernelopts(version)

`Maple 2025.1, X86 64 WINDOWS, Jun 12 2025, Build ID 1932578`

(1)

`‰`;
`#mi("‰")`

`‰`

 

`#mi("‰")`

(2)

`‰`;
`#mi("‰")`;

`‰`

 

`#mi("‰")`

(3)

`‰`;
`#mi("‰")`;

`‰`

 

`#mi("‰")`

(4)
 

 

Download mi_reply.mw

@Anthrazit 

This is an impressive mail thread. You attracted the attention of many top shots. I could not find a round2 function but a Rnd2 which works nicely on units – with the difference of rounding to zero and returning floats (not integer). Not sure how important that is for you.

rnd2 := (x::realcons, n::integer) -> evalf[length(trunc(x)) + n](round(x*10^n)/10^n);
Rnd2 := (super, n::integer) -> evalindets(super, float, x -> rnd2(x, n));
Rnd2(1.25*Unit('mm'), 0);
                          1. Unit(mm)

Rnd2(0.25*Unit('mm'), 0);
Error, (in rnd2) invalid input: expected evalf[] index to be of type posint but received 0

From a natural language persepective Maple needs output 1 mm and even 0 mm because it reads as most pepole expect. Mathematically I do not see a need and we are used to things like this which from a dimensional persepective could be interpreted that the units of lhs and rhs do not fit

Engineering needs math, but math does not need engineering. However, how important is engineering for Maplesoft?
The topic is worth beeing discussed in a post. My current opinion is that the unit packages should handle 1 mm and 0 mm display ... somehow.

My personal number one unit painpoint is that convert/units cannot convert (naturally readable in- and output) x=1 m to x=1000 mm. For that, homebrew code is required. Awkward. My post on this did not resonnate so I assume that Maplesoft will put their priorities on something else. Too bad ... for me.

@Anthrazit 

OK understood. In Maple no unit means Unit(1).

is(round(1.25)=Units:-Unit(1))
                              true
Units:-Split(round(0.25));
Units:-Split(round(0.25*Unit('mm')));
Units:-Split(round(1.25*Unit('mm')))
                              0, 1

                              0, 1

                          1, Unit(mm)

If you want to preserve the unit in the second output, you could do it this way.

c:=0.25*Unit('mm');
`%*`(round~([Units:-Split(c)])[]);
                       c := 0.25 Unit(mm)

                       

This would also produce 1 * mm for the input 1.25 mm. Quite some effort. Both outputs can be used for further computations using the value command. What I do not like is the * which is not needed in this case.

@Anthrazit 

Can you clairfy the example?

round(1.25) = Unit();
Error, (in Unit) invalid input: Units:-Unit:-ModuleApply uses a 1st argument, expr, which is missing

Under Windows "worksheet" and command line mode use both the same mserver executable. The difference is the calling task which is the Java GUI in the first instance and the command line interface in the second instance. So maybe the levels of recursion do not occur in the mserver task but in the Java GUI.

Under Windows there is also an addtional mserver task running that does something in parallel. If you have the same und Linux: What happens when you kill this process (if possible)? Is Maple still crashing?

@sand15 

It looks different with 2025. Changing Ditigs also has an effect but less pronounced to what i have seen. 

Thanks for sharing

Stranger_things_reply.mw

@acer 

I send a software change request

@nm 

I use that from time to time (if I have no time or am out of options). It's better than simplify/symbolic, which I never use because I do not know what else simplify/symbolic does. However what makes me feel uneasy using it with products or quotients under roots is

sqrt(1/c)/sqrt(a/c)

(1/c)^(1/2)/(a/c)^(1/2)

(1)

(1@@0 = `@`(sqrt, 1@@0^2))((1/c)^(1/2)/(a/c)^(1/2))

(1/c)^(1/2)/(a/c)^(1/2) = (1/a)^(1/2)

(2)

subs(a = -1, c = 1, (1/c)^(1/2)/(a/c)^(1/2) = (1/a)^(1/2))

-I = I

(3)

NULL

Download sqrt_with_quotients.mw

@sand15 

Efficient way to extract the factors!

When I press Alt (left key to spacebar) nothing happens; i.e. no hotkeys appear at all. I remember this working but not exactly when.

@dharr 

Simplification with the context menu works on v(t) but not on v(10 s). The output (1) does not fit to what lprint returns. It looks to me as if the interface and not the kernel does something wrong. 

 

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