Post a reply
Note:If not registered, provide any username. For more comfort, register here.
Message body:
Enter your message here, it may contain no more than 60000 characters. 

:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.

Topic review - Symbolic computation in a procedure
Author Message
  Post subject:  Re: Symbolic computation in a procedure  Reply with quote
Almost any command in Singular needs to be called with (may be empty) parentheses.
The return command is not exception from this rule. So put the ( ), and it works as desired.
> proc test123()  {
> ring A = 0,(v(1..2)),dp;
> test123();

Hint: To make this proc independent of the names of the variables, write:
> proc test1234()  {
> ring rdp = 0,(x,y),dp;
> test1234();
Post Posted: Mon Feb 20, 2017 3:18 pm
  Post subject:  Symbolic computation in a procedure  Reply with quote

I am new to singular and have much more experience in mathematica and maple. One thing that separates singular from the other CAS I know is that indeterminates (I call them "symbols") have to be iniitated in a ring before doing any kind of algebra. Now suppose I create a procedure, in here it seems that singular does not care if the ring variables have not been defined. But what confuses me is that the following does not work

proc test123()
  return v(1)*v(2);

ring A = 0,(v(1..2)),dp;

I'm not really sure how to use the ring variables in the procedure and the documentation does not make me any wiser. Any help would be appreciated. I am trying to ports most of my codes (algebraic geometry for kinematics) to singular because this gives me the opportunity to continue using a free CAS and distribute this to interested people (without requiring them to have maple) and I am slowly getting annoyed of maples slowness (commandline execution gets slower after every new version of maple and older maple are known to be difficult when operating system updates). I also like and feel more comfortable with the C/C++ structure of singular.
Post Posted: Mon Feb 20, 2017 11:52 am

It is currently Tue Nov 20, 2018 1:14 pm
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group