Plot of functions having big range on Y axis

Plot of functions having big range on Y axis - No plot when trying to plot functions having big range - Сообщения

#1 Опубликовано: 02.08.2023 06:50:48
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

I'm trying to reproduce the attached plot (coming from MathCAD) in SMath
and I'm not able to obtain a plot of the function nor even dividing the function by
1E+10 - I suspect a pb dealing big numbers - by the way I have also an error trying to use MAXIMA GNU.

Has anyone some idea/workaround?

Many Thanks

Plot_big_function.jpg
#2 Опубликовано: 02.08.2023 08:23:59
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Hi!
Please provide more information: source code, data, or a link with a function description.

Best,

Oscar
#3 Опубликовано: 02.08.2023 10:43:20
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Can you actually display the values of that function? Computing determinants isn't really a strength of SMath. Did you make sure to use MaximaTakeover(det) when trying Maxima?
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#4 Опубликовано: 02.08.2023 11:20:32
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

Dear All,

thanks for your quick reply.

Here attached the file so that you can see "hands-on" the issue.

For TMMT.sm (99 КиБ) скачан 43 раз(а).

I still suspect a limitation in plot function dealing with "big" numbers....but even dividing by 1E+08 (and even more...)
seems to work in this case (I made some other tests and, sometimes, this trick is useful).

As you understand I need a "visualization" of the function in order to "guide" the "solve" function (that seems
to work remarkably well w.r.t. MathCAD, by the way....but I cannot always be so lucky in this kind of problems...).

P.S. for mkraska
1) the name of detZ is, maybe misleading....in facts detZ calculate the determinant of a reduced matrix...and in any case
the function detZ(x) is defined directly by 4 functions
2) As you can see I can easily calculate the values of detZ(x) and find roots....BUT no plotting at all. By the way, due to complexity
of the function detZ(x), this last cannot be written explicitely....
3) I have difficulties to use Maxima for plotting (an error indicates that maxima.bat is apparently lacking in my -free- installation)...and, on the other side, I'm not allowed to install a new version of SMath without IT-manager support (he's actually in holydays...)....so, for the moment at least, no Maxima...


Last but not least: I'm a beginner (I discovered SMath 6 months ago and then I used it intensively, it's true) hence is possible that the way I have tackled the whole pb is not the most efficient (hence my issue with plotting...); so any suggestion, even completely changing the SMath sheet structure is welcome.

Thanks
#5 Опубликовано: 02.08.2023 11:42:45
overlord

overlord

548 сообщений из 1332 понравились пользователям.

Группа: Moderator

Units are good, always try to use them.
But plotting doesn't like units.
Get rid of them if you are plotting.

Regards

2023-08-02_17-41.png
1 пользователям понравился этот пост
Oscar Campo 02.08.2023 17:37:00
#6 Опубликовано: 02.08.2023 12:39:08
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

Thanks Overlord! First I tried to reproduce the image in your post: just ADDING the unit of measures (as I have always done in MathCAD...but evidently I have not learnt the lesson.....) something is plotted....so, additional question how do you add the line with conditional statement (if...) that, if I understand well define the window range (also very very interesting for my pb)?
#7 Опубликовано: 02.08.2023 13:56:07
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi. You can scale the plot choosing adequate units on it. With the exception of al_nleqsolve, there are not pure numerical solvers in SMath, but you can write your own one. It seems also that the limit for numerical evaluation of your function is about s = 160 kHz. Finally, it's true: native SMath plot can't handle very well long ranges, but XYPlot plugin can.

Click to enlarge

TMMT.sm (99 КиБ) скачан 45 раз(а).

Best regards.
Alvaro.
#8 Опубликовано: 03.08.2023 11:05:38
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

Dear ALL,

many thanks once more, as I have both solved the problem and, most of all (for a beginner like me), learnt something more...

In any case, it seems to me that each SMath installation has its own combination of "tricks" working (or not working...).

For Overlord, don't bother with my further question on range definition, I have found in the meanwhile....but still not working (see below)
Screenshot1.jpg

But once I combine the use of Plot native SMath function with unit scaling and range definition (as suggested and worked out by Razonar) and range definition...it works both with SMath native plot and with XY plot!!
Screenshot3.jpg
More, I tried to plot (with XY plot) the function for values higher than 160kHz; and, yes, something strange is happening for (see below); the same seems not using SMath Plot functionality
Screenshot2.jpg
In my specific case, at least, frequencies over 160 kHz are not so critical (the lowest ones are the most worrisome). So, for the moment as said, my problem is solved....next step is to further complexify the function detZ (Omega)...

It's well true that SMath is somewhat tricky, but, honestly, last MathCAD versions are not so error-free as it could be expected.....

Hope that your posts and my small tests/replies can be useful for other forum users.

Best Regards

Fabio
#9 Опубликовано: 03.08.2023 12:17:35
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

In any case, it seems to me that each SMath installation has its own combination of "tricks" working (or not working...).


You can't be more right ! Since Studio is replaced by Solver 30405.
Most annoying are dead functions from fx menu.
minor(M,#) undefined, median undefined, medfit in the blue
slope(vx,vy) divide by 0, intercept(vx,vy) divide by 0.
More puzzling, per say, minor(M,#) works native Studio 6179/Solver 30405
On new Solver sheet minor(M,#) function is not defined.
That is detrimental wrt determinant.
Fortunately, most user codes work Solver 30405.

#10 Опубликовано: 03.08.2023 14:01:55
overlord

overlord

548 сообщений из 1332 понравились пользователям.

Группа: Moderator

Wrote

More, I tried to plot (with XY plot) the function for values higher than 160kHz; and, yes, something strange is happening for (see below); the same seems not using SMath Plot functionality


I asked that phenomenon to uni (author of XY Plot plugin).
It is caused by an algorithm to speed up plotting process.
If it really bothers you (it bothers me), there is a trick.
You can eliminate it by setting different start and end parameters.

Regards

2023-08-03_19-58.png
1 пользователям понравился этот пост
Oscar Campo 03.08.2023 15:01:00
#11 Опубликовано: 03.08.2023 16:07:57
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

More, I tried to plot (with XY plot) the function for values higher than 160kHz; and, yes, something strange is happening for (see below); the same seems not using SMath Plot functionality


Your 2nd plot looks a distorted Morlet.
In the attached you will have to reconstruct both graphs.
set sigma:= sqrt(16) ... span 'x' 2nd plot for convenience.
Plot X_Y ± 16 perfect.
Cheers ... Jean.

0Appendix Morlet.sm (14 КиБ) скачан 23 раз(а).

#12 Опубликовано: 03.08.2023 17:44:05
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

Thanks Overlord, thanks Jean for your posts....

For Overlord: what you propose, works but....have a look here below.....Файл не найден.Файл не найден.
The function seems to me too complex to make a study of the function (I mean limits, derives, max, min); but I'd like
to perform such a study 'cause I expect an "asymptotic" behavior for values higher than 162kHz (last zero)...maybe it's
this asymptotic behavior at the basis of the "strange" plot.

For Jean: interesting, I discovered something!! And even strange because.....my function comes from vibration of short hollow beams.

Best Regards and thanks again
#13 Опубликовано: 04.08.2023 07:44:22
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

The function seems to me too complex to make a study of the function (I mean limits, derives, max, min); but I'd like
to perform such a study 'cause I expect an "asymptotic" behavior for values higher than 162kHz (last zero)...maybe it's
this asymptotic behavior at the basis of the "strange" plot.
For Jean: interesting, I discovered something!! And even strange because.....my function comes from vibration of short hollow beams.


Lots of maths are not compatible with units.
Can you explicit the project in simple f(x)
attach an image so to code Solver 30405
I doubt it will accept symbolic Derivative
No problem to Derive via Infinitesimal Analysis.
No problem for min/max Golden ratio.
Cheers ... Jean.

#14 Опубликовано: 04.08.2023 08:50:05
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

Hi Jeans, thanks I'll take your remarks into consideration...

But now focus is on complexifying the problem (and relevant calculation times...).

You can make a calculation for a piecewise beam (instead than for a single beam):
you have just to multiply all the matrix Phi (you obtain for each piece of beam) each other...

Then the treatment is the same for the matrix you obtain as explained above.

For the moment I remark long time (longer than for Mathcad that arrived to process
30-pieces beam in 1h and 30')...I'm trying to "explicitate" and cut the functions
that I used to express implicitly....if suggestions, I'll be glad to test in practice!

Best Regards

Fabio
#15 Опубликовано: 04.08.2023 11:03:20
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi. Improved version. Can handle derivatives of detZ and find the real domain of that function ( 0 < ω < 163.0244 )

TMMT.sm (112 КиБ) скачан 28 раз(а).
TMMT.pdf (394 КиБ) скачан 32 раз(а).

Best regards.
Alvaro.
#16 Опубликовано: 04.08.2023 11:24:10
Fabbro

Fabbro

0 сообщений из 16 понравились пользователям.

Группа: User

Thanks RAZOR, I think that as soon as my IT Manager is back from holydays I'll ask for installation of portable version that include Maxima.

Best Regards
#17 Опубликовано: 04.08.2023 11:57:47
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi Fabbro. It can be obtained without Maxima, but it is much slower and less accurate.

TMMT without maxima.sm (113 КиБ) скачан 36 раз(а).

Best Regards.
Alvaro.
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений