Bug SS-2347
2 votes

[Maxima] Result of Solve() can't be assigned

Created by Martin Kraska on 5/18/2016 6:39 PM Last Updated by Martin Kraska on 7/31/2017 12:40 AM
%
 (hrs)
Logged: 0   (hrs)

 Description

see http://en.smath.info/forum/yaf_postsm33336_SMath-Studio-0-98-5973--09-May-2016.aspx#post33336

    Martin Kraska (Monday, July 31, 2017 12:39 AM) #

The initial problem has been solved. The other problems mentioned in the discussion have to go to separate issues.

    Davide (Tuesday, September 13, 2016 1:35 PM) #

You're welcome :)

I've merged this nightly build in the main trunc (SVN 2185), so any further attempt to change can be made in the nightly build leaving this as milestone.

    Martin Kraska (Tuesday, September 13, 2016 10:44 AM) #

The test file runs cleanly except for the int(4) tests. We can't expect more at the moment.

Most graphics examples are rotten because of bad SVG display in ImageRegion or file access issues. The latter seem to be not really reproducible and may depend on multiple instances of SMath or multiple documents using the same maxima installation with a single temp dir. Perhaps I should try to generate session-specific temp dir names in maxima.bat.

Once the image region is fixed, I'll make a new portable distribution and start work on interactive handbook update and integrate your pages in the distribution.

Thanks a lot, Davide.

 

 

    Davide (Monday, September 12, 2016 1:59 PM) #

Takeover restored. There's a support for vector multiplication (it works just if written directly in the Maxima(...) argument). Not able to make it working though (called Maxima(load("vect")) before but I get a "circular rule attempted" from Maxima).

 

 

    Martin Kraska (Monday, September 12, 2016 1:36 PM) #

Applies to SVN 2175:

MaximaTakeover of det() works, because det() is not defined in Special functions.

The issue is reduced to

int(4), diff(2), diff(3) and sum(4)

diff(2) and diff(3) are not so important.

I attach a sheet, where I test takeover and use canvas definitions for int(4) and sum(4) to redirect evaluation to Maxima.

What is bad is that such definitions can't be undone,

    Martin Kraska (Sunday, September 11, 2016 10:08 PM) #

I confirm that the concept works. There is, however, some sort of "overshoot", because renaming is required only for those functions, where the preprocessing by SMath does harm to the further evaluation in Maxima.

diff(1) works

int(2) works

lim(3) works

Drawback of the concept:

- Many existing sheets must be changed

- Operator formatting for the functions and a concept for telling them from the native ones required.

To be honest, I am scared by this.

How about this:

- Provide Int(4), Diff(2), Diff(3), Sum(4), Det() as a temporary workaround for the impatiient user (operator formatting would not be required as in the end we would try to succeed with takeover again)

- keep MaximaTakeover, with accepting that it fails for some functions for now

- publish the plugin in the current form.

In the meantime, I would try to get the maxima side sorted out and perhaps some day we are back to takeover working.

As for the by-document sessions: There are also issues on the maxima side. we would need to make sure that the temp paths are distinct for the individual processes. I remember that I messed around with them for the portable distribution.

PS:

there are some new errors in the test file.

The string translation errors seem to be fixed.

 

    Davide (Sunday, September 11, 2016 7:36 PM) #

converted: Int, Diff, Sum, Lim, Det;

removed (still in the code): MaximaTakeover;

 

I agree that would be better to share Maxima within the plugin, even if I'm really not sure what could be safely removed and what not, there are a lot of directories and files. However if it is possible to do it I think that I can pack it with 7zip and I can try to write something to unpack it at the first run.

 

As for the Maxima sessions, as principle should be possible since each function knows his document, I have to see how.

    Martin Kraska (Sunday, September 11, 2016 4:33 PM) #

- sum does not work. SMath tries evaluation first and fails (error message)

- int(4) does not work. SMath tries numeric integration, which is a disaster if units are involved. Int should not be handled by SMath.

This is because the plugins loading routines has changed. Seems that takeover was working because a lucky combination in the plug-ins loading order; when Andrey changed it the first time, SS-2311 appeared, because int/diff/sum algorithm of SpecialFunctions plugin where fully replaced by the ones by Maxima (since Maxima replaces these functions only when activated, in the other cases functions were not-existing).

Andrey changed it again in SS 0.98.6080, making impossible to override functions from SpecialFunctions plugin. He said that he might reintroduce this possibility, but only if it allows the use of this feature in a realiable way (in other words, should be possible for any plugin or for no one; since is not clear what should be the rule that SS should follows to choose when to use an algorithm from a plugin instead of another, as for now he has enforced the 2nd choiche - no overrides)

Here we have 2 possible ways:

- open a feature request, trying to found a reliable way to drive what algorithm to choose when a function is defined in more than a plugin;

- change the names of the functions used in maxima (e.g. MaximaInt(4) or whatever);

 

OK, I understand. This also means that probably diff() is never really handed over to Maxima, but this is not evident, because native diff is quite good with simple expressions.

Alternative functions

The most important issue is to get Maxima int(4) to work. This would save a whole Handbook section on transforming integrals to dimensionless variables.

In order to be independent of Andrey's design decisions, we should follow the second option and just provide capitalized functions (Diff, Sum, Int(4)) .

Probably it would be a good idea to have visibly distinct yet nice operator forms for these functions, including cross product and diff,

Function redirection

In parallel it would be good to have the opportunity to override native functions. This override must be controlled by canvas commands, not by per sheet or per SMath instance settings, Otherwise testing would become a nightmare,

Something like provider(function, [plugin]). If called, it redirects the function to a particular module. If called without second argument, the function is reset to native.

If called without any argument or empty argument), a complete reset would be done.

This solves the problems of

- decision for SMath which version to use
- visibility of that decision to the user.

MaximaTakeover() was a prototype for this option.

- same problem with cross product

This is a problem of preprocessing, I guess. I'll look if I can provide a workaround.

 

- Problems with file access (image files, display of images in image region works only once for a given file name.

I see the file is created but not loaded in the image region plugin; if I change the name another file is created and it is loaded (I guess is a bug in that plugin),

Good that you could reproduce that. I wasn't sure of clean test environment.

- Unterscore translations seem to be inconsistent but that does not harm.

Probably fixed (see attachment).

I'll try that, thank you.

 

There are some other issues with Maxima, which I am not happy with.

- one Maxima session per SMath instance instead of one per open document.

- Plugin being not self-contained. It should carry it's own Maxima installation in the plugin dir. Then it could be installed as any other plugin. One could considerably shrink the Maxima size by leaving out the GUI and the docs

 

    Davide (Sunday, September 11, 2016 1:51 PM) #

- sum does not work. SMath tries evaluation first and fails (error message)

- int(4) does not work. SMath tries numeric integration, which is a disaster if units are involved. Int should not be handled by SMath.

This is because the plugins loading routines has changed. Seems that takeover was working because a lucky combination in the plug-ins loading order; when Andrey changed it the first time, SS-2311 appeared, because int/diff/sum algorithm of SpecialFunctions plugin where fully replaced by the ones by Maxima (since Maxima replaces these functions only when activated, in the other cases functions were not-existing).

Andrey changed it again in SS 0.98.6080, making impossible to override functions from SpecialFunctions plugin. He said that he might reintroduce this possibility, but only if it allows the use of this feature in a realiable way (in other words, should be possible for any plugin or for no one; since is not clear what should be the rule that SS should follows to choose when to use an algorithm from a plugin instead of another, as for now he has enforced the 2nd choiche - no overrides)

Here we have 2 possible ways:

- open a feature request, trying to found a reliable way to drive what algorithm to choose when a function is defined in more than a plugin;

- change the names of the functions used in maxima (e.g. MaximaInt(4) or whatever);

 

- same problem with cross product

This is a problem of preprocessing, I guess. I'll look if I can provide a workaround.

 

- Problems with file access (image files, display of images in image region works only once for a given file name.

I see the file is created but not loaded in the image region plugin; if I change the name another file is created and it is loaded (I guess is a bug in that plugin),

 

- Unterscore translations seem to be inconsistent but that does not harm.

Probably fixed (see attachment).

 

    Martin Kraska (Sunday, September 11, 2016 3:07 AM) #

Looks really good, great work, Davide

Do you see a chance to solve the problem with SMath side preprocessing of expressions (throwing error messages or doing rubbish before asking Maxima to do the job)?

Then I'd say the plugin is ready for the gallery again, Otherwise, it might still be useful but should have beta status (anyways it is merely a concept demonstrator.)

Seems that I have to revise my plans. I was not convinced that the Maxima plugin would work again in the near future and started to prepare a new distribution based on current SMath without Maxima.

Here some first test results:

- diff problem gone.

- no crash any more.

- Results assignment works.

- Draw regions seem to work.

- sum does not work. SMath tries evaluation first and fails (error message)

- int(4) does not work. SMath tries numeric integration, which is a disaster if units are involved. Int should not be handled by SMath.

- same problem with cross product

- Problems with file access (image files, display of images in image region works only once for a given file name.

- Unterscore translations seem to be inconsistent but that does not harm.

    Davide (Sunday, September 11, 2016 12:28 AM) #

Apparently was the wrong branch (the main)... I've atttached the other. Exception for insert dialogs fixed plugin-side.

I don't know why this difference about plugins in portable vs install, something to investigate...

    Martin Kraska (Saturday, September 10, 2016 10:07 PM) #

Calling the Maxima Debug Window from the insert menu throws an exception.

I can recover and the Debug Window seems to work

    Martin Kraska (Saturday, September 10, 2016 9:59 PM) #

The installation succeeded. However, it seems that it is an old version. The settings window should have a "select folder" button and the Draw Regions are missing,

The SVN Structure has two branches (folder structures), Which one did you use?

    Martin Kraska (Saturday, September 10, 2016 9:38 PM) #

Would like to test the plugin with the portable version. However, it seems that there are quite some differences in plugin support between the installer and the portable version. Some plugins don't install, others complain at restart of SMath.

Is there a point in using the portable version currently for testing?

I guess that these are issues of the online gallery providing outdated versions to the portable version.

    Davide (Saturday, September 10, 2016 8:19 PM) #

Please test the attached plugin. If doesn't opens new issues we may ask Andrey to publish it.

    Martin Kraska (Tuesday, May 24, 2016 12:54 AM) #

Hi Davide,

great to see that there are chances to re-animate the Maxima plugin. I installed the dll and confirm the above screenshot.

Using Plugin Maxima Test.sm from the activebook I identified the following problems:

  • SMath native diff() is corrupted even if it is not taken over by Maxima
  • sum() seems to not handle undefined arguments
  • Maxima can't handle the scaled vector cross product any more (this was a workaround for an SMath bug)
  • Underscores in variable names seem to have changed their translation to Maxima (whyever)
  • MaximaDefine wraps a list around it's results. That is new (and strange)
  • File operations like CurrentDir and using the Imageregion to display graphics seem to crash Maxima.
  • If the return value from Maxima is assigned to some variable, then Maxima might not be called at all.
  • Some strange translation problems...

I attach a Version of the test with some comments.I saw that quite something happened to the logics of function evaluation and this caused quite some problems. Among them the test functions in the sheet being unreliable.

 

    Davide (Monday, May 23, 2016 2:40 AM) #

Fixed using isUndefinedArgumentSupported = true in all the arguments of: Solve, LinSolve, Algsys

Please let me know if there are other functions where it is needed to enable this feature.

Tested using portable from latest Nightly Build + Maxima-5.34.1 + Attached plugin