TransWikia.com

Using solved constants without manually setting them as variables

Mathematica Asked by wobY on February 9, 2021

I’m really new to Mathematica and there’s this assignment I can easily solve by just manually copy-pasting everything and sticking to it as I am doing right now but I’d like to start going more in-depth into this software as it can really help me a lot during my studies.

The "issues" I’m having here is the way our teacher showed us how to handle the constants gotten from the equation is to copy-paste them below and just replace the "->" with "=" as shown in the image attached.

Copying 10 or more constants get really bothersome.

[1]
k = 6
Subscript[Ix, z] = Subscript[Ix, 0] (1 - k ((2 z - L)/(2 L))^2)

[2]
numberOfParam=7
Subscript[n, [Psi]]=1;While[Subscript[n, [Psi]]<=numberOfParam,Print[Subscript[[Psi], Subscript[n, [Psi]]]=Sin[(Subscript[n, [Psi]]*[Pi]*z)/L]];Subscript[n, [Psi]]++]

[3]
Rez = Ey*Subscript[Ix, z]*(!(
*UnderoverscriptBox[([Sum]), (i = 1), (numberOfParam)]((
*SubscriptBox[(c), (i)]*
*SubscriptBox[([PartialD]), (z, z)]
*SubscriptBox[([Psi]), (i)])))) + (q*L*z)/6 - (q*z^3)/(6 L)
(L q z)/6 - (q z^3)/(6 L) + 
 Ey (1 - (3 (-L + 2 z)^2)/(
    2 L^2)) (-(([Pi]^2 Sin[([Pi] z)/L] Subscript[c, 1])/L^2) - (
    4 [Pi]^2 Sin[(2 [Pi] z)/L] Subscript[c, 2])/L^2 - (
    9 [Pi]^2 Sin[(3 [Pi] z)/L] Subscript[c, 3])/L^2 - (
    16 [Pi]^2 Sin[(4 [Pi] z)/L] Subscript[c, 4])/L^2 - (
    25 [Pi]^2 Sin[(5 [Pi] z)/L] Subscript[c, 5])/L^2 - (
    36 [Pi]^2 Sin[(6 [Pi] z)/L] Subscript[c, 6])/L^2 - (
    49 [Pi]^2 Sin[(7 [Pi] z)/L] Subscript[c, 7])/L^2) Subscript[Ix, 
  0]

[4]
Subscript[n, jed] = 1; While[Subscript[n, jed] <= numberOfParam, 
 Print[Subscript[A, Subscript[n, jed]] = !(
*SubsuperscriptBox[([Integral]), (0), (L)](Rez*
*SubscriptBox[([Psi]), 
SubscriptBox[(n), (jed)]] [DifferentialD]z))]; 
 Subscript[n, jed]++]

[5]
cSolve = Solve[{Subscript[A, 1] == 0, Subscript[A, 2] == 0, 
   Subscript[A, 3] == 0, Subscript[A, 4] == 0, Subscript[A, 5] == 0, 
   Subscript[A, 6] == 0, Subscript[A, 7] == 0}, {Subscript[c, 1], 
   Subscript[c, 2], Subscript[c, 3], Subscript[c, 4], Subscript[c, 5],
    Subscript[c, 6], Subscript[c, 7]}][![enter image description here][1]][1]

My question is, what other way is there to manipulate these, how would I assign constants without doing what I’m doing right now?

Constants

Also, how would I go around not manually entering "A1 == 0, A2 == 0" in the 5th equation? Also if I were to use the constants in a matrix, how could I insert them in the matrix, automatically expanding it depending on the number of constants?

In case the code formatting doesn’t show nicely I’ll attach extra screenshots to make it easily readable: https://imgur.com/a/9bSBsdV

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP