0
$\begingroup$

I have three functions whose identity was verified, but WM doesn't behave itself equally with them.

The code is:

θ[x_] := Boole[x >= 0]
{R, L, C1, Rl, T, Um} := {500, 0.2, 2*10^(-10), 10^3, 10^(-3), 10};
{t1, t2, t3} := {T/2, T/3, T/6};
u1[t_] := Um/t3*(t*θ[t] - (t - t3) θ[t - t3] - (t - t2) θ[t - t2] + (t - t1) θ[t - t1])
U1[s_] := LaplaceTransform[u1[t], t, s]

A10[ω_] := Abs[U1[s]] /. s -> I*ω
Solve[A10[ω] == 0 && ω ∈ Interval[{10000, 20000}], ω]

A11[ω_]:=(1.2*10^5/ω^2)*Sqrt[2(Cos[10^(-3)ω/6])^3-2(Cos[10^(-3)ω/6])^2-2Cos[10^(-3)ω/6]+2]
Solve[A11[ω] == 0 && ω ∈ Interval[{10000,20000}],ω]

A12[ω_]:=Abs[-(6*10^4/ω^2)*(1-E^(-10^(-3)*I*ω/6)-E^(-10^(-3)*I*ω/3)+E^(-10^(-3)*I*ω/2))]
Solve[A12[ω] == 0 && ω ∈ Interval[{10000,20000}],ω]

Plot[A10[ω], {ω, 0, 80000}, PlotRange -> {{0, 80000}, {0, 0.004}}]
Plot[A11[ω], {ω, 0, 80000}, PlotRange -> {{0, 80000}, {0, 0.004}}]
Plot[A12[ω], {ω, 0, 80000}, PlotRange -> {{0, 80000}, {0, 0.004}}]
(*Plot performance velocity was compared by isolating each two plots with comment syntax*)

First phenomenon is that Solve[] doesn't process A11[ω]==0 equation correctly, returning {{ω -> {18849.6}}} instead of {{ω -> {6000 π}}} and raising such a message:

Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.

Second phenomenon is that Plot[] for A10[ω] performs unbelievably slow. Thus, I've got two questions...

  1. Why I observe problems with getting A11[ω]==0 roots?
  2. Why A10[ω] plot performance speed is so different from others?

Thanks in advance.

$\endgroup$
3

1 Answer 1

6
$\begingroup$

By typing 1.2*10^5 you are telling Mathematica to do things in floating point. Change this to 120000 and you get the desired exact form. To make it plot faster use Set (shortcut =) rather than SetDelayed (shortcut :=), that is, define

A10[ω_] = Abs[U1[s]] /. s -> I*ω

instead of

A10[ω_] := Abs[U1[s]] /. s -> I*ω

Now it plots almost instantly. (The only difference is the colon before the equals sign).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.