Why Doesn't "clear all" Clear the Assumptions from the Symbolic Engine?

According to the doc page assumptions
  • To clear all objects in the MATLAB workspace and close the Symbolic Math Toolbox™ engine associated with the MATLAB workspace resetting all its assumptions, use this command
  • clear all
Comment: I think the doc page would be clearer if that clause replaced "resetting" with "clearing".
But
syms x
assume(x < 1)
assumptions
ans = 
clear all
assumptions
ans = 
I'm quite certain that in previous versions (like 2022a?) the command "clear all" did clear the assumptions from the engine.
Is this a relatively-newly-introduced bug or am I misremembering/misunderstanding the situation?
Answers is running 2024b, I see the same behavior on 2024a.

댓글 수: 16

Apparently Answers is having an issue displyaing results from executed code (@Rena Berman, others have also noted this where everything looks fine while editing the post but the results disaappear when the post is submitted).
Here are the results from running the commands on my local system (R2024a)
>> syms x
>> assume(x < 1);
>> assumptions
ans =
x < 1
>> clear all
>> assumptions
ans =
x < 1
Hey @Paul,
I tried running the same commands and it seems to work as expected for me:
Which version/update of Matlab? The results I showed are for R2024a Update 1. And I got the same result on Answers running R2024b.
I'm using MATLAB R2024a, but I am encountering the issue in R2024b, as mentioned.
Yes, @Paul. Tested in both. Thanks for pointing out the issue.
At the moment, the workaround of dealing with the issue is to clear the assumptions using the 'assume()' command.
Which two specific versions did you test, by release AND update (both of your screenshots above are from 2024b)?
I'm asking because I see the problem in R2024a Update 1 on Windows, and here on Answers running R2024b, which doesn't show an Update number (is Update number no longer a thing in 2024b?).
ver
------------------------------------------------------------------------------------------------- MATLAB Version: 24.2.0.2729000 (R2024b) MATLAB License Number: 40912989 Operating System: Linux 5.15.0-1062-aws #68~20.04.1-Ubuntu SMP Wed May 1 15:24:09 UTC 2024 x86_64 Java Version: Java 1.8.0_292-b10 with AdoptOpenJDK OpenJDK 64-Bit Server VM mixed mode ------------------------------------------------------------------------------------------------- MATLAB Version 24.2 (R2024b) Simulink Version 24.2 (R2024b) 5G Toolbox Version 24.2 (R2024b) Aerospace Blockset Version 24.2 (R2024b) Aerospace Toolbox Version 24.2 (R2024b) Antenna Toolbox Version 24.2 (R2024b) Audio Toolbox Version 24.2 (R2024b) Automated Driving Toolbox Version 24.2 (R2024b) Bioinformatics Toolbox Version 24.2 (R2024b) Bluetooth Toolbox Version 24.2 (R2024b) Communications Toolbox Version 24.2 (R2024b) Computer Vision Toolbox Version 24.2 (R2024b) Control System Toolbox Version 24.2 (R2024b) Curve Fitting Toolbox Version 24.2 (R2024b) DO Qualification Kit Version 24.2 (R2024b) DSP System Toolbox Version 24.2 (R2024b) Database Toolbox Version 24.2 (R2024b) Datafeed Toolbox Version 24.2 (R2024b) Deep Learning Toolbox Version 24.2 (R2024b) Econometrics Toolbox Version 24.2 (R2024b) Embedded Coder Version 24.2 (R2024b) Filter Design HDL Coder Version 24.2 (R2024b) Financial Instruments Toolbox Version 24.2 (R2024b) Financial Toolbox Version 24.2 (R2024b) Fixed-Point Designer Version 24.2 (R2024b) Fuzzy Logic Toolbox Version 24.2 (R2024b) Global Optimization Toolbox Version 24.2 (R2024b) HDL Coder Version 24.2 (R2024b) HDL Verifier Version 24.2 (R2024b) IEC Certification Kit Version 24.2 (R2024b) Image Acquisition Toolbox Version 24.2 (R2024b) Image Processing Toolbox Version 24.2 (R2024b) Industrial Communication Toolbox Version 24.2 (R2024b) Instrument Control Toolbox Version 24.2 (R2024b) LTE Toolbox Version 24.2 (R2024b) MATLAB Coder Version 24.2 (R2024b) MATLAB Compiler Version 24.2 (R2024b) MATLAB Compiler SDK Version 24.2 (R2024b) MATLAB Report Generator Version 24.2 (R2024b) Mapping Toolbox Version 24.2 (R2024b) Medical Imaging Toolbox Version 24.2 (R2024b) Mixed-Signal Blockset Version 24.2 (R2024b) Model Predictive Control Toolbox Version 24.2 (R2024b) Model-Based Calibration Toolbox Version 24.2 (R2024b) Navigation Toolbox Version 24.2 (R2024b) Optimization Toolbox Version 24.2 (R2024b) Parallel Computing Toolbox Version 24.2 (R2024b) Partial Differential Equation Toolbox Version 24.2 (R2024b) Phased Array System Toolbox Version 24.2 (R2024b) Powertrain Blockset Version 24.2 (R2024b) Predictive Maintenance Toolbox Version 24.2 (R2024b) RF Blockset Version 24.2 (R2024b) RF Toolbox Version 24.2 (R2024b) Radar Toolbox Version 24.2 (R2024b) Requirements Toolbox Version 24.2 (R2024b) Risk Management Toolbox Version 24.2 (R2024b) Robotics System Toolbox Version 24.2 (R2024b) Robust Control Toolbox Version 24.2 (R2024b) Sensor Fusion and Tracking Toolbox Version 24.2 (R2024b) SerDes Toolbox Version 24.2 (R2024b) Signal Processing Toolbox Version 24.2 (R2024b) SimBiology Version 24.2 (R2024b) SimEvents Version 24.2 (R2024b) Simscape Version 24.2 (R2024b) Simscape Driveline Version 24.2 (R2024b) Simscape Electrical Version 24.2 (R2024b) Simscape Fluids Version 24.2 (R2024b) Simscape Multibody Version 24.2 (R2024b) Simulink 3D Animation Version 24.2 (R2024b) Simulink Check Version 24.2 (R2024b) Simulink Code Inspector Version 24.2 (R2024b) Simulink Coder Version 24.2 (R2024b) Simulink Control Design Version 24.2 (R2024b) Simulink Coverage Version 24.2 (R2024b) Simulink Design Optimization Version 24.2 (R2024b) Simulink Design Verifier Version 24.2 (R2024b) Simulink Desktop Real-Time Version 24.2 (R2024b) Simulink PLC Coder Version 24.2 (R2024b) Simulink Real-Time Version 24.2 (R2024b) Simulink Report Generator Version 24.2 (R2024b) Simulink Test Version 24.2 (R2024b) Stateflow Version 24.2 (R2024b) Statistics and Machine Learning Toolbox Version 24.2 (R2024b) Symbolic Math Toolbox Version 24.2 (R2024b) System Identification Toolbox Version 24.2 (R2024b) Text Analytics Toolbox Version 24.2 (R2024b) Vehicle Dynamics Blockset Version 24.2 (R2024b) Vehicle Network Toolbox Version 24.2 (R2024b) Vision HDL Toolbox Version 24.2 (R2024b) WLAN Toolbox Version 24.2 (R2024b) Wavelet Toolbox Version 24.2 (R2024b) Wireless HDL Toolbox Version 24.2 (R2024b)
@Animesh reports the problem evident in R2024b, but NOT in 2024a, which would mean it was fixed in 2024a in an update after Update 1, but then the problem resurfaces in 2024b.
The first screenshot was taken using Answers running R2024b. The second screenshot was taken using the basic version of MATLAB Online, which includes the Symbolic Math Toolbox. The "persistant assumptions after clear all" issue has not been filed in the Bug Reports. I hope MathWorks will address it in R2024b Update 1.
I filed a bug report. We'll see what happens ....
If you want to clear all of the assumptions as should happen with "clear all"
syms x y positive
assumptions
assume(assumptions,'clear')
assumptions
ans = Empty sym: 1-by-0
Weird that in the preceding comment the output showed up for the second "assumptions" command but not the first .... hope MathWorks can sort out this issue soon (@Rena Berman)
@Paul, I will forward this on.
FYI, we are investigating the issue in Answers where the symbolic outputs appear when editing but are not rendering when viewing the submitted post. I will post an update here when that is fixed in Answers.
Thank you, @Paul, on the method for clearing all of the assumptions. Also thank @Rena Berman and @Tushal Desai for their attention to this matter.
Tech Support confirmed that this behavior is an "issue" (is that different than a bug?) and may consider fixing it in a future release. I do realize they have reasons to not be concrete about it. Nevertheless, anyone with code that relies on the as-documented, as-previously-implemented behavior might be in for a surprise.

댓글을 달려면 로그인하십시오.

 채택된 답변

Paul
Paul 2025년 6월 7일
편집: Paul 2025년 6월 7일
Looks like this is fixed in whatever version of 2024b that Answers is running now as compared to the version it was running when the question was originally posted.
syms x
assume(x < 1)
assumptions
ans = 
clear all
assumptions
ans = Empty sym: 1-by-0

추가 답변 (0개)

카테고리

제품

릴리스

R2024b

질문:

2024년 9월 22일

편집:

2025년 6월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by