Help with Mathematica Problem Solving

  • Context: Undergrad 
  • Thread starter Thread starter Reem Hashem
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around troubleshooting a Mathematica code issue involving a for loop and the FindRoot function. Participants are seeking assistance with coding errors and output discrepancies in their Mathematica scripts, focusing on differential systems and root-finding methods.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant reports errors when implementing a for loop in their Mathematica code and requests help.
  • Another participant suggests specific corrections to the code, including changing variable names and adding semicolons, which they believe resolves the error messages.
  • A different participant mentions encountering issues with the FindRoot function, indicating that their system works without it but fails to respond when it is included.
  • Further, the same participant expresses difficulties in changing the interval for the FindRoot function, leading to errors, and seeks clarification on this issue.
  • Another participant explains that FindRoot fails when it cannot find a root within the specified interval and suggests strategies such as changing the interval or plotting the function to better understand the problem.
  • There is a suggestion that this issue may have been discussed previously, indicating a potential ongoing challenge in understanding the problem.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to resolve the issues with the code, and multiple competing views on how to troubleshoot the problems remain evident throughout the discussion.

Contextual Notes

Limitations include potential misunderstandings of the FindRoot function's requirements, the need for clearer definitions of variables, and unresolved coding errors that may depend on the specific context of the problem being addressed.

Reem Hashem
Messages
23
Reaction score
0
Hello,I have a problem in writing my code in Mathematica, when I put values of R,T,S&a the system worked and gave me result but when I put the system in for loop , it gave me errors,I hope someone help me and thank you
 

Attachments

Physics news on Phys.org
In your Untitled-8.nb

Item 1: You have For[S = 6, S <= 6, S = s + 1 and that last "s" should probably be "S"

Item 2: I think you need a ; between your m=NDSOLVE[...] and c=Det[...]

Item 3: I think you have a misplaced ]. It looks like your innermost For[] does 11 different m=..., the For is finished and only the last result is saved in m AND THEN you do c=Det[.../.m]

When I make all those changes with what I guess is correct then your error messages go away and I get very different output.
 
problem in findroot

Hello Mr Bill,thank you again for your help ,my new code is the same like before but with the change of the differential systems but I faced a problem when I used Findroot function,my system works but when I add the FindRoot Function the program did not response,so I hope to find the error in the Findroot function,and thank you again
 

Attachments

Mr Bill I tried to change the interval in the Find Root Function but I got errors,I hope to check them
 

Attachments

Reem Hashem said:
Mr Bill I tried to change the interval in the Find Root Function but I got errors,I hope to check them

You are asking FindRoot to look for a root inside a specific interval and to fail if it cannot find a root in that interval. FindRoot looks, cannot find a root inside that interval and fails. The error message tells you that it failed to find a root in the interval that you require.

You can try to change the interval. You can try to learn more about the function you are trying to solve and thus know better how to solve it. You can try plotting the function before you solve it and see how it behaves. Any and all these can help you understand how to get a correct answer.

Have you and I been through this before? This seems very similar to a problem that I and someone, perhaps you, went over and over and over and over. We never seemed to be able to understand each other with that problem.
 

Similar threads

Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
8
Views
4K