Dear Jason,

Thank you for your feedback and clarification. I apologize for my earlier 
error in assuming that vectorization would apply in this context.

Going forward, I will begin by profiling the existing examples to identify 
the slow areas before attempting any optimization. I appreciate your 
guidance on this matter and will work diligently following the approach you 
have provided.

Thank you again for your insight.

Best regards,
Devarsh Panchal


On Saturday, 22 March 2025 at 8:13:26 am UTC+5:30 moore...@gmail.com wrote:

> Dear Davarsh,
>
> The "bulk operations" behind the Jacobians are just loops, so we don't 
> really have the concept of vectorization like NumPy does. Our loops are in 
> Python, SymPy isn't a wrapper to C/Fortran code that applies vectorized 
> operations to arrays like NumPy is.
>
> The first step in the project you mention here is to profile existing 
> examples to find out what the slow parts are. Once those are identified, 
> you can try to speed them up. Presupposing what is slow is the "root of all 
> evil": https://effectiviology.com/premature-optimization/
>
> Jason
> moorepants.info
> +01 530-601-9791 <(530)%20601-9791>
>
>
> On Mon, Mar 17, 2025 at 5:09 PM Devarsh Panchal <devars...@gmail.com> 
> wrote:
>
>> Greetings, SymPy Developers,
>>
>> My name is Devarsh Panchal, and I'm a physics undergraduate with a strong 
>> passion for classical mechanics and symbolic computation. I'm excited to 
>> contribute to the "Classical Mechanics: Efficient Equations of Motion 
>> Generation" project, and I’m particularly interested in enhancing how we 
>> compute equations of motion in the Mechanics module.
>>
>> I believe there is significant potential to improve performance by 
>> refining current approaches. One key improvement I’m exploring is 
>> Vectorized Force Computation. Rather than relying on nested loops to 
>> compute non-conservative forces, I propose leveraging matrix Jacobians and 
>> bulk operations. This approach takes full advantage of SymPy’s robust 
>> matrix functionalities and should substantially reduce computational 
>> overhead.
>>
>> Another focus area is Efficient Substitution. Currently, we use the subs 
>> method for substitutions, which—while versatile—can be slower for exact, 
>> repetitive replacements. By switching to xreplace and precomputing 
>> substitution dictionaries, especially for frequently encountered terms like 
>> q̈, we can streamline the process and eliminate redundant computations.
>>
>> I’m eager to collaborate with the community to refine these ideas further 
>> and integrate them into the codebase. Your feedback and suggestions are 
>> most welcome as I work towards making these optimizations a reality.
>>
>> Thank you for your time and consideration!
>>
>> Best regards,
>> Devarsh Panchal
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sympy+un...@googlegroups.com.
>> To view this discussion visit 
>> https://groups.google.com/d/msgid/sympy/272019a6-5772-4c52-b3f4-2e38aa27a870n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/sympy/272019a6-5772-4c52-b3f4-2e38aa27a870n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sympy/4a2345a4-e86d-41f1-afde-c6c936b45219n%40googlegroups.com.

Reply via email to