Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline pwi  
#1 Posted : 07 July 2021 14:08:40(UTC)
pwi

Rank: Newbie

Groups: Registered
Joined: 09/08/2019(UTC)
Posts: 6
Poland
Location: Gdańsk

Hi,

in my recent calculations I needed to have a function that takes two funtions as parameters
and calculates some values. Something like:

k_f(s;c)=s(1)*c(8)

k_f(sin; cos)=

Trying this in SMath Studio unfortunately failed.

Is is possible to implement such a thing in SMath Studio?

Yours,

Pawel Wierzba







Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Davide Carpi  
#2 Posted : 07 July 2021 14:32:56(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Yes it is possible, see the attached image

2021-07-07 13_32_01-SMath Studio - [Documento1_].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline pwi  
#3 Posted : 07 July 2021 15:31:23(UTC)
pwi

Rank: Newbie

Groups: Registered
Joined: 09/08/2019(UTC)
Posts: 6
Poland
Location: Gdańsk

Thank you very much. Indeed, it works, even with functions with more arguments than one.

Sorry for asking a question about something that has already been implemented.
Offline Jean Giraud  
#4 Posted : 07 July 2021 15:36:02(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Make it infinite algo style.

InfiniteAlgoStyle.PNG
Offline pwi  
#5 Posted : 07 July 2021 16:11:06(UTC)
pwi

Rank: Newbie

Groups: Registered
Joined: 09/08/2019(UTC)
Posts: 6
Poland
Location: Gdańsk

Thank you for the advice. Fortunately, standard way of defining functions is well known to me.
Unfortunately, I had to pass functions as arguments, rather than define them the "standard way".

I had several functions and some coefficients to be calculated, based on them.
Something like the example below.


If done the standard way, it would involve a LOT of writing.

Edited by user 07 July 2021 16:20:06(UTC)  | Reason: could not get the image to display

Offline Jean Giraud  
#6 Posted : 07 July 2021 16:49:47(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: pwi Go to Quoted Post
Unfortunately, I had to pass functions as arguments, rather than define them the "standard way".
I had several functions and some coefficients to be calculated, based on them.
Something like the example below.

Attach the document for understanding that mystic doing.
Offline loha  
#7 Posted : 07 July 2021 19:23:49(UTC)
loha


Rank: Advanced Member

Groups: Registered
Joined: 13/09/2011(UTC)
Posts: 63
Location: Kolkata

Was thanked: 9 time(s) in 9 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post
Yes it is possible, see the attached image

2021-07-07 13_32_01-SMath Studio - [Documento1_].png


Beautiful!
I wonder why Jean is not so enthousiastic?
Offline Jean Giraud  
#8 Posted : 07 July 2021 19:28:17(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
... should have been posted ~ 2 hours ago.

Algo.PNG
Offline oscampo  
#9 Posted : 07 July 2021 19:31:32(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 238
Man
Colombia
Location: Cali, Colombia

Was thanked: 79 time(s) in 60 post(s)
Originally Posted by: pwi Go to Quoted Post
Thank you for the advice. Fortunately, standard way of defining functions is well known to me.
Unfortunately, I had to pass functions as arguments, rather than define them the "standard way".

I had several functions and some coefficients to be calculated, based on them.
Something like the example below.


If done the standard way, it would involve a LOT of writing.


Great!
SMath has that awesome characteristic, so you can use that "standard way" for defining functions.

Good luck with your job!
Offline Razonar  
#10 Posted : 07 July 2021 21:22:21(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: pwi Go to Quoted Post
...
I had several functions and some coefficients to be calculated, based on them.
Something like the example below.
...
If done the standard way, it would involve a LOT of writing.


Hi. You can try a for loop with something like this in the body

Clipboard01.jpg

Best regards.
Alvaro.
Offline Jean Giraud  
#11 Posted : 07 July 2021 21:31:59(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: pwi Go to Quoted Post
If done the standard way, it would involve a LOT of writing.

Make it algo style as exemplified.
At this point, you are missing a link ... what link ?
Before integration, you must plot the integrand.
That will avoid the Simpson integrator to result scrap.
Visit/search 'Samples' for more integrators [Adaptive, Romberg].


Offline Jean Giraud  
#12 Posted : 08 July 2021 00:02:38(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
sanity.PNG
Offline Jean Giraud  
#13 Posted : 08 July 2021 02:17:37(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
... Smath is a CAS, an advanced CAS
i.e: like competitive CAS, Smath is not a click_click_done.

sanitysanity.PNG
Offline overlord  
#14 Posted : 08 July 2021 02:56:00(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post
Yes it is possible, see the attached image

Interesting solution, promising to be very useful.
I wonder if it could be done with other functions.
It would really shorten a lot of thing if was possible.
Especially with external plugins function calls.

Regards

2021-07-08_02-52.png
Offline pwi  
#15 Posted : 08 July 2021 14:36:54(UTC)
pwi

Rank: Newbie

Groups: Registered
Joined: 09/08/2019(UTC)
Posts: 6
Poland
Location: Gdańsk

Originally Posted by: Jean Giraud Go to Quoted Post

At this point, you are missing a link ... what link ?
Before integration, you must plot the integrand.
That will avoid the Simpson integrator to result scrap.
Visit/search 'Samples' for more integrators [Adaptive, Romberg].


Originally Posted by: Jean Giraud Go to Quoted Post
... Smath is a CAS, an advanced CAS
i.e: like competitive CAS, Smath is not a click_click_done.


Thank you for help, especially the comment about potential problems
with the integrator and illustrative examples.

Starting to study other integrators [Adaptive, Romberg], as advised.

I wish I could click a few "THANK" buttons for help, but on my two browsers
(Opera and Edge) they simply generate an error message.Sad

Offline Jean Giraud  
#16 Posted : 08 July 2021 15:45:19(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: pwi Go to Quoted Post
Thank you for help, especially the comment about potential problems
with the integrator and illustrative examples.

I posted the wrong image ... that's the right one.
Don't drop dead by how far simple integration can fly in the blue !

SanityIntegration.PNG
Offline Jean Giraud  
#17 Posted : 08 July 2021 20:44:44(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: pwi Go to Quoted Post
Thank you for help, especially the comment about potential problems with the integrator and illustrative examples.

The 'thanks' button' never worked.
1. The previous image as *,sm
2. My Integration tool box.
Please, don't hesitate for + ... Jean

Integral 000000000000 vectorsf(j,k,a,b).sm (14kb) downloaded 13 time(s).
Integral 00000000 MASTER ToolBox.sm (478kb) downloaded 12 time(s).

Offline overlord  
#18 Posted : 08 July 2021 22:25:50(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 post(s)
Looks like line() mysteriously solve the issue.
I have come across similar to this behavior before.

Regards

2021-07-08_22-24.png

Edited by user 08 July 2021 22:27:22(UTC)  | Reason: Not specified

Offline Razonar  
#19 Posted : 08 July 2021 23:21:01(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: overlord Go to Quoted Post
Looks like line() mysteriously solve the issue.
...


Hi. For help understanding what's happen: that behavior is similar to the SetDelayed in Wolfram Mathematica language: https://www.wolfram.com/...-and-delayed-values.html

Best regards.
Alvaro.

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.